mirror of
https://github.com/imjasonh/krust
synced 2026-07-08 06:45:32 +00:00
The cargo-zigbuild cache was shared between x86 and ARM runners (cache key only used runner.os), causing "Exec format error" when an ARM binary was restored on x86 or vice versa. Added runner.arch to all cache keys and use --force install to overwrite stale binaries. https://claude.ai/code/session_01EcsZDNeWn56wFqryb4Wq7r
71 lines
2.4 KiB
YAML
71 lines
2.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, ubuntu-24.04-arm]
|
|
rust: [stable, beta]
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
targets: x86_64-unknown-linux-musl,aarch64-unknown-linux-musl
|
|
components: rustfmt,clippy
|
|
- name: Cache cargo registry
|
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4
|
|
with:
|
|
path: ~/.cargo/registry
|
|
key: ${{ runner.os }}-${{ runner.arch }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
- name: Cache cargo index
|
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4
|
|
with:
|
|
path: ~/.cargo/git
|
|
key: ${{ runner.os }}-${{ runner.arch }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
|
- name: Cache cargo build
|
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4
|
|
with:
|
|
path: target
|
|
key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
- name: Cache cargo-zigbuild
|
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4
|
|
with:
|
|
path: ~/.cargo/bin/cargo-zigbuild
|
|
key: ${{ runner.os }}-${{ runner.arch }}-cargo-zigbuild-${{ matrix.rust }}
|
|
- name: Install zig and cargo-zigbuild
|
|
run: |
|
|
pip install --break-system-packages ziglang
|
|
# ziglang pip package installs as python-zig, symlink to zig for cargo-zigbuild
|
|
sudo ln -sf "$(which python-zig)" /usr/local/bin/zig
|
|
zig version
|
|
cargo-zigbuild --version || cargo install --force cargo-zigbuild
|
|
|
|
- run: make check-fmt
|
|
- run: make lint
|
|
- run: make build
|
|
- run: make test
|
|
|
|
# Only run cross-compilation integration test on x86_64 runners
|
|
- name: Run integration test (cross-compilation)
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: make run-built-image
|
|
|
|
- run: cargo install cargo-audit
|
|
- run: cargo audit
|
|
|
|
# TODO: fails in CI for now.
|
|
#- run: cargo install cargo-tarpaulin
|
|
#- run: cargo tarpaulin --verbose --workspace
|