Skip to content

Minimal tests - mmtk-core #501

Minimal tests - mmtk-core

Minimal tests - mmtk-core #501

name: Minimal tests - mmtk-core
on:
pull_request:
branches:
- master
merge_group:
branches:
- master
concurrency:
# Cancels pending runs when a PR gets updated.
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
# Setup dynamic test matrix
setup-test-matrix:
runs-on: ubuntu-latest
outputs:
rust: ${{ steps.rust.outputs.array }}
steps:
- uses: actions/checkout@v4
# Get rust version
- id: rust
run: |
export MSRV=`cargo read-manifest | python -c 'import json,sys; print(json.load(sys.stdin)["rust_version"])'`
export TEST=`cat rust-toolchain`
echo "array=[\"$MSRV\", \"$TEST\", \"stable\"]" >> $GITHUB_OUTPUT
minimal-tests-core:
needs: setup-test-matrix
strategy:
fail-fast: false
matrix:
target:
- { os: ubuntu-22.04, triple: x86_64-unknown-linux-gnu }
- { os: ubuntu-22.04, triple: i686-unknown-linux-gnu }
- { os: macos-15, triple: x86_64-apple-darwin }
rust: ${{ fromJson(needs.setup-test-matrix.outputs.rust )}}
name: minimal-tests-core/${{ matrix.target.triple }}/${{ matrix.rust }}
runs-on: ${{ matrix.target.os }}
env:
# This determines the default target which cargo-build, cargo-test, etc. use.
CARGO_BUILD_TARGET: "${{ matrix.target.triple }}"
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
# "rustup toolchain install" should always install the host toolchain,
# so we don't specify the triple.
rustup toolchain install ${{ matrix.rust }}
rustup override set ${{ matrix.rust }}
# Ensure we install the target support for the target we are testing for.
# This is especially important for i686-unknown-linux-gnu
# because it's different from the host.
rustup target add ${{ matrix.target.triple }}
rustup component add rustfmt clippy
# Show the Rust toolchain and target we are actually using
- run: rustup show
- run: cargo --version
- run: cargo rustc -- --print cfg
# Setup Environments
- name: Setup Environments
run: ./.github/scripts/ci-setup-${{ matrix.target.triple }}.sh
# Build
- name: Build
run: ./.github/scripts/ci-build.sh
# Test
- name: Test
run: ./.github/scripts/ci-test.sh
style-check:
needs: setup-test-matrix
strategy:
fail-fast: false
matrix:
target:
- { os: ubuntu-22.04, triple: x86_64-unknown-linux-gnu }
- { os: ubuntu-22.04, triple: i686-unknown-linux-gnu }
- { os: macos-12, triple: x86_64-apple-darwin }
rust: ${{ fromJson(needs.setup-test-matrix.outputs.rust )}}
name: style-check/${{ matrix.target.triple }}/${{ matrix.rust }}
runs-on: ${{ matrix.target.os }}
env:
# This determines the default target which cargo-build, cargo-test, etc. use.
CARGO_BUILD_TARGET: "${{ matrix.target.triple }}"
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
# "rustup toolchain install" should always install the host toolchain,
# so we don't specify the triple.
rustup toolchain install ${{ matrix.rust }}
rustup override set ${{ matrix.rust }}
# Ensure we install the target support for the target we are testing for.
# This is especially important for i686-unknown-linux-gnu
# because it's different from the host.
rustup target add ${{ matrix.target.triple }}
rustup component add rustfmt clippy
# Show the Rust toolchain and target we are actually using
- run: rustup show
- run: cargo --version
- run: cargo rustc -- --print cfg
# Setup Environments
- name: Setup Environments
run: ./.github/scripts/ci-setup-${{ matrix.target.triple }}.sh
# Style checks
- name: Style checks
run: ./.github/scripts/ci-style.sh
# Document check
- name: Rustdoc
run: ./.github/scripts/ci-doc.sh