Skip to content

Commit

Permalink
workflows/ci: Build statically linked executables where possible
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Gunnerson <[email protected]>
  • Loading branch information
chenxiaolong committed Dec 30, 2023
1 parent 712f2b5 commit 45e3789
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ jobs:
runs-on: ${{ matrix.os }}
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -C strip=symbols
RUSTFLAGS: -C strip=symbols -C target-feature=+crt-static
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
Expand All @@ -54,16 +57,14 @@ jobs:
| sed -E "s/^v//g;s/([^-]*-g)/r\1/;s/-/./g" \
>> "${GITHUB_OUTPUT}"
- name: Get Rust LLVM target triple
- name: Get Rust target triple
id: get_target
shell: bash
env:
RUSTC_BOOTSTRAP: '1'
run: |
echo -n 'name=' >> "${GITHUB_OUTPUT}"
rustc -Z unstable-options --print target-spec-json \
| jq -r '."llvm-target"' \
>> "${GITHUB_OUTPUT}"
rustc -vV | sed -n 's|host: ||p' >> "${GITHUB_OUTPUT}"
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
Expand All @@ -72,15 +73,19 @@ jobs:

- name: Clippy
working-directory: custota-tool
run: cargo clippy --release
run: |
cargo clippy --release --features static \
--target ${{ steps.get_target.outputs.name }}
- name: Formatting
working-directory: custota-tool
run: cargo fmt -- --check

- name: Build
working-directory: custota-tool
run: cargo build --release
run: |
cargo build --release --features static \
--target ${{ steps.get_target.outputs.name }}
- name: Archive artifacts
uses: actions/upload-artifact@v3
Expand Down
3 changes: 3 additions & 0 deletions custota-tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ x509-cert = "0.2.4"
[dependencies.avbroot]
git = "https://github.com/chenxiaolong/avbroot"
tag = "v3.0.0"

[features]
static = ["avbroot/static"]

0 comments on commit 45e3789

Please sign in to comment.