@@ -19,7 +19,7 @@ name: "Rust checks"
1919on :
2020 pull_request :
2121 paths :
22- - " rs/**"
22+ - " rs/**" # TODO: Add python/handlebarrz after fixing linker errors.
2323 - " Cargo.toml"
2424 - " Cargo.lock"
2525 - " .github/workflows/rust.yml"
4141 - name : Checkout code
4242 uses : actions/checkout@v4
4343
44- - name : Install Rust toolchain (${{ matrix.toolchain }})
45- uses : dtolnay/rust-toolchain@master
46- with :
47- toolchain : ${{ matrix.toolchain }}
48-
4944 - name : Cache Cargo registry and index
5045 uses : actions/cache@v4
5146 with :
6863 continue-on-error : ${{ matrix.toolchain == 'nightly' }}
6964
7065 - name : Run tests
66+ env :
67+ RUST_BACKTRACE : 1
7168 run : cargo test --all-targets --workspace
7269 # Allow nightly tests to fail
7370 continue-on-error : ${{ matrix.toolchain == 'nightly' }}
71+
72+ check-build-test-musl-matrix :
73+ name : Check, Build & Test (${{ matrix.toolchain }}, alpine-${{ matrix.arch }}-musl)
74+ runs-on : ubuntu-latest # Runner OS
75+ container : # Run steps inside this container
76+ image : rust:alpine # Use official Rust image based on Alpine (multi-arch)
77+ strategy :
78+ fail-fast : false
79+ matrix :
80+ include :
81+ - arch : x86_64
82+ target : x86_64-unknown-linux-musl
83+ - arch : aarch64
84+ target : aarch64-unknown-linux-musl
85+ toolchain : [stable, nightly]
86+ steps :
87+ - name : Checkout code
88+ uses : actions/checkout@v4
89+
90+ - name : Install musl build dependencies
91+ run : |
92+ apk add --no-cache musl-dev gcc bash docker-cli
93+
94+ - name : Set up QEMU
95+ uses : docker/setup-qemu-action@v3
96+
97+ - name : Install Rust toolchain (${{ matrix.toolchain }}) via rustup
98+ shell : bash
99+ run : |
100+ rustup toolchain install ${{ matrix.toolchain }} --profile minimal --target ${{ matrix.target }}
101+ rustup default ${{ matrix.toolchain }}
102+
103+ - name : Cache Cargo registry and index (musl)
104+ uses : actions/cache@v4
105+ with :
106+ path : |
107+ /usr/local/cargo/registry/index/
108+ /usr/local/cargo/registry/cache/
109+ /usr/local/cargo/git/db/
110+ target/
111+ # Include architecture and toolchain in cache key
112+ key : linux-musl-${{ matrix.arch }}-cargo-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
113+
114+ - name : Check code (musl, ${{ matrix.arch }}, ${{ matrix.toolchain }})
115+ shell : bash
116+ run : cargo check --all-targets --workspace --target ${{ matrix.target }}
117+ # Allow nightly check to fail
118+ continue-on-error : ${{ matrix.toolchain == 'nightly' }}
119+
120+ - name : Build code (musl, ${{ matrix.arch }}, ${{ matrix.toolchain }})
121+ shell : bash
122+ run : cargo build --all-targets --workspace --target ${{ matrix.target }}
123+ # Allow nightly build to fail
124+ continue-on-error : ${{ matrix.toolchain == 'nightly' }}
125+
126+ - name : Run tests (musl, ${{ matrix.arch }}, ${{ matrix.toolchain }})
127+ shell : bash
128+ env :
129+ RUST_BACKTRACE : 1 # Keep the backtrace env var
130+ run : cargo test --all-targets --workspace --target ${{ matrix.target }}
131+ # Allow nightly tests to fail
132+ continue-on-error : ${{ matrix.toolchain == 'nightly' }}
0 commit comments