Allow running the mold test suite #2298
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ 'main' ] | |
pull_request: | |
branches: [ '**' ] | |
workflow_dispatch: | |
permissions: {} | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: '-D warnings' | |
jobs: | |
test-nightly: | |
name: Test (${{ contains(matrix.runs-on, 'arm') && 'AArch64' || 'x86_64'}}, ${{ matrix.container }}${{ matrix.test-qemu && ', QEMU' || ''}}) | |
strategy: | |
matrix: | |
runs-on: | |
- ubuntu-24.04 | |
- ubuntu-24.04-arm | |
container: | |
- 'ubuntu:24.04' | |
- 'opensuse/tumbleweed:latest' | |
- 'rust:1.87-alpine' | |
test-qemu: | |
- false | |
include: | |
- runs-on: ubuntu-24.04 | |
container: 'ubuntu:25.04' | |
test-qemu: true | |
- runs-on: ubuntu-24.04-arm | |
container: 'ubuntu:25.04' | |
test-qemu: false | |
- runs-on: ubuntu-24.04 | |
container: 'ubuntu:25.10' | |
test-qemu: true | |
- runs-on: ubuntu-24.04-arm | |
container: 'ubuntu:25.10' | |
test-qemu: false | |
# Ubuntu 22.04 contains an old lld linker which cannot do a relaxation on AArch64 (required by linker-diff) | |
- runs-on: ubuntu-24.04 | |
container: 'ubuntu:22.04' | |
exclude: # TODO: https://github.com/actions/runner/issues/1637 | |
- runs-on: ubuntu-24.04-arm | |
container: 'rust:1.87-alpine' | |
fail-fast: false | |
runs-on: ${{ matrix.runs-on }} | |
container: | |
image: ${{ matrix.container }} | |
steps: | |
- run: echo "WILD_TEST_CONFIG=test-config-ci.toml" >> $GITHUB_ENV | |
if: ${{ env.CI == 'true' }} | |
- run: echo "WILD_TEST_CROSS=aarch64,riscv64" >> $GITHUB_ENV | |
if: ${{ matrix.test-qemu }} | |
- run: apt-get update && apt-get -y install gcc g++ clang lld curl bubblewrap binutils-aarch64-linux-gnu binutils-riscv64-linux-gnu git | |
if: ${{ contains(matrix.container, 'ubuntu') }} | |
- run: apt-get update && apt-get -y install qemu-user gcc-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-riscv64-linux-gnu g++-riscv64-linux-gnu git | |
if: ${{ matrix.test-qemu }} | |
- run: zypper in -y gcc gcc-c++ glibc-devel-static clang lld curl rustup bubblewrap git | |
if: ${{ contains(matrix.container, 'opensuse') }} | |
- run: apk add build-base lld clang bash curl git | |
if: ${{ contains(matrix.container, 'alpine') }} | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
submodules: recursive | |
- uses: dtolnay/rust-toolchain@nightly | |
id: rust-toolchain | |
with: | |
targets: x86_64-unknown-linux-gnu,x86_64-unknown-linux-musl,aarch64-unknown-linux-gnu,aarch64-unknown-linux-musl,riscv64gc-unknown-linux-gnu,riscv64gc-unknown-linux-musl | |
components: rustc-codegen-cranelift-preview | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-${{ matrix.container }}-${{ matrix.runs-on }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }} | |
if: ${{ !contains(matrix.container, 'alpine') }} | |
- run: cargo build --profile ci --workspace --no-default-features | |
- run: WILD_TEST_CROSS=$WILD_TEST_CROSS cargo test --profile ci --workspace | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
# This is where we check that we're not using features from a more recent rust version. When | |
# updating this, please also update workspace.package.rust-version in `Cargo.toml`. | |
- uses: dtolnay/[email protected] | |
id: rust-toolchain | |
with: | |
components: clippy | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-clippy-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }} | |
- run: cargo clippy --workspace --target x86_64-unknown-linux-gnu | |
rustfmt: | |
name: Check formatting | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- run: cargo fmt --all -- --check | |
spelling: | |
name: Spell Check with Typos | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Spell Check Repo | |
uses: crate-ci/[email protected] | |
calc-matrix: | |
name: Find Nix checks | |
runs-on: ubuntu-24.04 | |
outputs: | |
matrix: ${{ steps.calc-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Nix | |
uses: nixbuild/nix-quick-install-action@v30 | |
with: | |
nix_on_tmpfs: true | |
- name: Calculate check | |
id: calc-matrix | |
run: | | |
matrix=$(nix flake show --json | jq -c '.checks."x86_64-linux"|keys_unsorted') | |
echo "Matrix: $matrix" | |
echo "matrix=$matrix" >> "$GITHUB_OUTPUT" | |
nix-checks: | |
needs: | |
- calc-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
check: ${{ fromJson(needs.calc-matrix.outputs.matrix) }} | |
runs-on: ubuntu-24.04 | |
name: Nix/${{ matrix.check }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Install Nix | |
uses: nixbuild/nix-quick-install-action@v30 | |
- name: Restore Nix store | |
uses: nix-community/cache-nix-action/restore@v6 | |
id: cache | |
with: | |
primary-key: ${{ runner.os }}-${{ hashFiles( 'flake.lock', 'Cargo.lock') }} | |
- name: Run ${{ matrix.check }} | |
run: nix build .#checks.x86_64-linux.${{ matrix.check }} -L --show-trace |