|
41 | 41 | - name: Checkout code |
42 | 42 | uses: actions/checkout@v4 |
43 | 43 |
|
44 | | - - name: Install Rust toolchain (${{ matrix.toolchain }}) |
45 | | - uses: dtolnay/rust-toolchain@master |
46 | | - with: |
47 | | - toolchain: ${{ matrix.toolchain }} |
48 | | - |
49 | 44 | - name: Cache Cargo registry and index |
50 | 45 | uses: actions/cache@v4 |
51 | 46 | with: |
|
68 | 63 | continue-on-error: ${{ matrix.toolchain == 'nightly' }} |
69 | 64 |
|
70 | 65 | - name: Run tests |
| 66 | + env: |
| 67 | + RUST_BACKTRACE: 1 |
71 | 68 | run: cargo test --all-targets --workspace |
72 | 69 | # Allow nightly tests to fail |
73 | 70 | 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