Merge pull request #7 from SergioGasquez/feature/cd-aarch64

Add `aarch64-unknown-linux-gnu` binary
This commit is contained in:
Björn Quentin 2023-02-13 15:57:00 +01:00 committed by GitHub
commit 3b512ffd4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 276 additions and 111 deletions

View File

@ -1,53 +0,0 @@
name: Package
on:
workflow_call:
inputs:
runs_on:
required: true
type: string
target:
required: true
type: string
extension:
default: ""
type: string
jobs:
build:
name: Build static binaries
runs-on: ${{ inputs.runs_on }}
steps:
- name: Change apt mirror and install dependencies
if: ${{ inputs.runs_on == 'ubuntu-latest' }}
run: |
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install musl-tools libudev-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ inputs.target }}
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --all --target ${{ inputs.target }}
- uses: papeloto/action-zip@v1
with:
files: target/${{ inputs.target }}/release/web-flash${{ inputs.extension }}
recursive: true
dest: web-flash-${{ inputs.target }}.zip
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: web-flash-${{ inputs.target }}.zip
tag: ${{ github.ref }}

View File

@ -4,47 +4,81 @@ on:
release:
types: [created]
env:
CARGO_TERM_COLOR: always
jobs:
# Linux
x86_64-unknown-linux-gnu:
uses: ./.github/workflows/package.yml
with:
runs_on: ubuntu-latest
build:
name: Generating artifacts for ${{ matrix.job.target }}
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl:
uses: ./.github/workflows/package.yml
with:
runs_on: ubuntu-latest
- os: ubuntu-20.04
target: x86_64-unknown-linux-musl
# macOS
aarch64-apple-darwin:
uses: ./.github/workflows/package.yml
with:
runs_on: macos-latest
target: aarch64-apple-darwin
x86_64-apple-darwin:
uses: ./.github/workflows/package.yml
with:
runs_on: macos-latest
target: x86_64-apple-darwin
# Windows
x86_64-pc-windows-gnu:
uses: ./.github/workflows/package.yml
with:
runs_on: windows-latest
target: x86_64-pc-windows-gnu
extension: .exe
x86_64-pc-windows-msvc:
uses: ./.github/workflows/package.yml
with:
runs_on: windows-latest
- os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
extension: .exe
- os: windows-latest
target: x86_64-pc-windows-gnu
extension: .exe
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-latest
target: x86_64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
targets: ${{ matrix.job.target }}
- name: Install dependencies
if: matrix.job.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install libudev-dev librust-libudev-sys-dev pkg-config
- name: Setup cross compile env
if: matrix.job.target == 'aarch64-unknown-linux-gnu'
run: |
sudo sed -i 's/azure\.//' /etc/apt/sources.list
sudo apt-get update
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal main universe" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-updates main universe" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo dpkg --add-architecture arm64
sudo apt-get install -y curl git libudev-dev musl-tools pkg-config "libudev1:arm64" "libgcc-s1:arm64" "libc6:arm64" "libudev-dev:arm64" gcc-arm-linux-gnueabihf pkg-config-arm-linux-gnueabihf gcc-aarch64-linux-gnu pkg-config-aarch64-linux-gnu
echo "PKG_CONFIG_ALLOW_SYSTEM_LIBS=0" >> $GITHUB_ENV
echo "PKG_CONFIG_DIR=/opt/" >> $GITHUB_ENV
echo "PKG_CONFIG_LIBDIR=/opt/usr/lib/pkgconfig:/opt/usr/share/pkgconfig" >> $GITHUB_ENV
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig" >> $GITHUB_ENV
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Build project
run: cargo build --release --all --target ${{ matrix.job.target }}
- name: Compress (Unix)
if: ${{ matrix.job.os != 'windows-latest' }}
run: zip -j web-flash-${{ matrix.job.target }}.zip target/${{ matrix.job.target }}/release/web-flash
- name: Compress (Windows)
if: ${{ matrix.job.os == 'windows-latest' }}
run: Compress-Archive target/${{ matrix.job.target }}/release/web-flash${{ matrix.job.extension }} web-flash-${{ matrix.job.target }}.zip
- name: Upload archives
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: web-flash-${{ matrix.job.target }}.zip
tag: ${{ github.ref }}

214
Cargo.lock generated
View File

@ -109,9 +109,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.65"
version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602"
checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
[[package]]
name = "array-init"
@ -169,7 +169,7 @@ version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"hermit-abi 0.1.19",
"libc",
"winapi",
]
@ -256,6 +256,18 @@ dependencies = [
"serde",
]
[[package]]
name = "bstr"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7f0778972c64420fdedc63f09919c8a88bda7b25135357fd25a5d9f3257e832"
dependencies = [
"memchr",
"once_cell",
"regex-automata",
"serde",
]
[[package]]
name = "bytemuck"
version = "1.12.1"
@ -311,8 +323,8 @@ checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750"
dependencies = [
"atty",
"bitflags",
"clap_derive",
"clap_lex",
"clap_derive 3.2.18",
"clap_lex 0.2.4",
"indexmap",
"once_cell",
"strsim",
@ -320,6 +332,21 @@ dependencies = [
"textwrap",
]
[[package]]
name = "clap"
version = "4.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76"
dependencies = [
"bitflags",
"clap_derive 4.1.0",
"clap_lex 0.3.1",
"is-terminal",
"once_cell",
"strsim",
"termcolor",
]
[[package]]
name = "clap_derive"
version = "3.2.18"
@ -333,6 +360,19 @@ dependencies = [
"syn",
]
[[package]]
name = "clap_derive"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"
dependencies = [
"heck 0.4.0",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "clap_lex"
version = "0.2.4"
@ -342,6 +382,15 @@ dependencies = [
"os_str_bytes",
]
[[package]]
name = "clap_lex"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade"
dependencies = [
"os_str_bytes",
]
[[package]]
name = "comfy-table"
version = "5.0.1"
@ -454,7 +503,7 @@ version = "1.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1"
dependencies = [
"bstr",
"bstr 0.2.17",
"csv-core",
"itoa 0.4.8",
"ryu",
@ -576,6 +625,27 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "errno"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
dependencies = [
"errno-dragonfly",
"libc",
"winapi",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "espflash"
version = "1.5.2-dev"
@ -583,7 +653,7 @@ source = "git+https://github.com/esp-rs/espflash?rev=55bce336c6718c1c7f019e4da71
dependencies = [
"binread",
"bytemuck",
"clap",
"clap 3.2.22",
"comfy-table",
"crossterm",
"csv",
@ -848,6 +918,12 @@ dependencies = [
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
[[package]]
name = "hkdf"
version = "0.12.3"
@ -962,6 +1038,16 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "io-lifetimes"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
dependencies = [
"libc",
"windows-sys 0.45.0",
]
[[package]]
name = "ioctl-rs"
version = "0.1.6"
@ -971,6 +1057,18 @@ dependencies = [
"libc",
]
[[package]]
name = "is-terminal"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef"
dependencies = [
"hermit-abi 0.3.1",
"io-lifetimes",
"rustix",
"windows-sys 0.45.0",
]
[[package]]
name = "is_ci"
version = "1.1.1"
@ -1021,6 +1119,12 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "linux-raw-sys"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
[[package]]
name = "lock_api"
version = "0.4.8"
@ -1164,7 +1268,7 @@ dependencies = [
"libc",
"log",
"wasi",
"windows-sys",
"windows-sys 0.36.1",
]
[[package]]
@ -1223,7 +1327,7 @@ version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
dependencies = [
"hermit-abi",
"hermit-abi 0.1.19",
"libc",
]
@ -1275,11 +1379,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "opener"
version = "0.5.0"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ea3ebcd72a54701f56345f16785a6d3ac2df7e986d273eb4395c0b01db17952"
checksum = "293c15678e37254c15bd2f092314abb4e51d7fdde05c2021279c12631b54f005"
dependencies = [
"bstr",
"bstr 1.2.0",
"winapi",
]
@ -1315,7 +1419,7 @@ dependencies = [
"libc",
"redox_syscall",
"smallvec 1.9.0",
"windows-sys",
"windows-sys 0.36.1",
]
[[package]]
@ -1636,6 +1740,20 @@ version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]]
name = "rustix"
version = "0.36.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys 0.45.0",
]
[[package]]
name = "rustversion"
version = "1.0.9"
@ -2323,10 +2441,10 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "web-flash"
version = "0.1.0"
version = "0.2.1"
dependencies = [
"anyhow",
"clap",
"clap 4.1.4",
"espflash",
"opener",
"rocket",
@ -2389,6 +2507,36 @@ dependencies = [
"windows_x86_64_msvc 0.36.1",
]
[[package]]
name = "windows-sys"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.42.1",
"windows_i686_gnu 0.42.1",
"windows_i686_msvc 0.42.1",
"windows_x86_64_gnu 0.42.1",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.42.1",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
[[package]]
name = "windows_aarch64_msvc"
version = "0.32.0"
@ -2401,6 +2549,12 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
[[package]]
name = "windows_i686_gnu"
version = "0.32.0"
@ -2413,6 +2567,12 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
[[package]]
name = "windows_i686_gnu"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
[[package]]
name = "windows_i686_msvc"
version = "0.32.0"
@ -2425,6 +2585,12 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
[[package]]
name = "windows_i686_msvc"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
[[package]]
name = "windows_x86_64_gnu"
version = "0.32.0"
@ -2437,6 +2603,18 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
[[package]]
name = "windows_x86_64_msvc"
version = "0.32.0"
@ -2449,6 +2627,12 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "xmas-elf"
version = "0.8.0"

View File

@ -1,11 +1,11 @@
[package]
name = "web-flash"
version = "0.1.0"
version = "0.2.1"
edition = "2021"
[dependencies]
rocket = "0.5.0-rc.2"
espflash = { rev = "55bce336c6718c1c7f019e4da718f97c8cdf1b95", git = "https://github.com/esp-rs/espflash" }
clap = { version = "3.1.18", features=["env"] }
opener = "0.5.0"
anyhow = "1.0.57"
clap = { version = "4.1.4", features = ["env", "derive"] }
opener = "0.5.2"
anyhow = "1.0.69"

View File

@ -10,18 +10,18 @@ use rocket::{response::content, State};
extern crate rocket;
#[derive(Parser, Debug, Clone)]
#[clap(author, version, about, long_about = None)]
#[command(author, version, about, long_about = None)]
struct Args {
/// chip name
#[clap(short, long)]
#[arg(short, long)]
chip: Chip,
/// path to bootloader
#[clap(short, long)]
#[arg(short, long)]
bootloader: Option<PathBuf>,
/// path to partition table csv
#[clap(short, long)]
#[arg(short, long)]
partition_table: Option<PathBuf>,
elf: PathBuf,