name: Rust on: push: branches: [ "main" ] pull_request: branches: [ "main" ] env: CARGO_TERM_COLOR: always jobs: test: name: Test on ${{ matrix.target }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - target: x86_64-unknown-linux-gnu toolchain: stable - target: aarch64-unknown-linux-gnu toolchain: stable - target: riscv64gc-unknown-linux-gnu toolchain: stable - target: loongarch64-unknown-linux-gnu toolchain: stable - target: s390x-unknown-linux-gnu toolchain: stable # powerpc64 uses experimental asm features - target: powerpc64le-unknown-linux-gnu toolchain: nightly - target: powerpc64-unknown-linux-gnu toolchain: nightly - target: armv7-unknown-linux-gnueabihf toolchain: stable # riscv32 is tier-3 - target: riscv32gc-unknown-linux-gnu toolchain: nightly components: rust-src build_std: true steps: - name: "Checkout" uses: actions/checkout@v6 - name: "Setup Rust toolchain" uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: ${{ matrix.toolchain }} components: ${{ matrix.components || '' }} rustflags: "" - name: "Add Rust target" if: ${{ !matrix.build_std }} run: rustup target add ${{ matrix.target }} - name: "Make Mold the default linker" uses: rui314/setup-mold@v1 - name: "Setup cross-compilation toolchain" uses: taiki-e/setup-cross-toolchain-action@v1 with: target: ${{ matrix.target }} - name: "Build" run: cargo build --verbose --target ${{ matrix.target }} ${{ matrix.build_std && '-Z build-std=core,alloc,panic_abort' || '' }} # tier-3 targets have no prebuilt std and tests are arch-agnostic, so # run them against the host toolchain instead of the cross target. - name: "Run tests" run: cargo test --workspace --exclude microfetch --verbose ${{ matrix.build_std && '--target x86_64-unknown-linux-gnu' || '' }}