Skip to content

Fix UI test runner flag handling and recursive provenance resolution #286

Fix UI test runner flag handling and recursive provenance resolution

Fix UI test runner flag handling and recursive provenance resolution #286

Workflow file for this run

name: 'Test'
on:
pull_request:
branches: [ "master" ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
code-quality:
name: "Code Quality"
runs-on: [self-hosted, linux, normal]
steps:
- name: 'Check out code'
uses: actions/checkout@v4
with:
# Check out pull request HEAD instead of merge commit.
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: "Set up nightly Rust" # https://github.com/rust-lang/rustup/issues/3409
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-11-29 # Hardcoded version, same as is in the build.rs
- name: 'Build stable-mir-json' # rustfmt documentation claims it is unstable on code that doesn't build
run: |
cargo build -vv
- name: "Check `cargo clippy`"
run: |
rustup component add clippy
cargo clippy -- -Dwarnings
- name: "Check `cargo fmt`"
run: |
rustup component add rustfmt
cargo fmt --check
- name: 'Install Nix'
uses: cachix/install-nix-action@v31.5.1
with:
install_url: https://releases.nixos.org/nix/nix-2.30.1/install
extra_nix_config: |
substituters = https://cache.nixos.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
- name: "Check `nixfmt`"
run: |
NIX_FILES=$(bash -O globstar -c 'ls **/*.nix')
nix shell nixpkgs#nixfmt-rfc-style --command nixfmt --check ${NIX_FILES}
integration-tests:
needs: code-quality
name: "Integration tests"
runs-on: [self-hosted, linux, normal]
steps:
- name: 'Check out code'
uses: actions/checkout@v4
with:
# Check out pull request HEAD instead of merge commit.
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: "Set up nightly Rust" # https://github.com/rust-lang/rustup/issues/3409
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-11-29 # Hardcoded version, same as is in the build.rs
- name: 'Build stable-mir-json'
run: | # Warning check should be redundant since code-quality runs first
RUSTFLAGS='--deny warnings' cargo build -vv
- name: 'Install a good-enough jq version'
uses: dcarbone/install-jq-action@v3
with:
version: 1.7.1
force: true
- name: 'Run smir integration tests'
run: |
which jq
jq --version
make integration-test
ui-tests:
needs: code-quality
name: "ui-tests"
runs-on: [self-hosted, linux, normal]
steps:
- name: 'Check out code'
uses: actions/checkout@v4
with:
# Check out pull request HEAD instead of merge commit.
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: 'Check out Rust repo'
uses: actions/checkout@v4
with:
repository: rust-lang/rust
ref: a2545fd6fc66b4323f555223a860c451885d1d2b # hash of Hardcoded Rust version
path: rust
fetch-depth: 1
- name: "Set up nightly Rust" # https://github.com/rust-lang/rustup/issues/3409
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-11-29 # Hardcoded version, same as is in the build.rs
- name: 'Build stable-mir-json'
run: | # Warning check should be redundant since code-quality runs first
RUSTFLAGS='--deny warnings' cargo build -vv
- name: 'Run smir integration tests'
run: |
RUST_DIR_ROOT='rust' VERBOSE=1 make test-ui
nix:
needs: code-quality
name: 'Nix Tests'
strategy:
fail-fast: false
matrix:
runner: [normal, MacM1] # MacM1 / normal are self-hosted,
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
steps:
- name: 'Check out code'
uses: actions/checkout@v4
with:
# Check out pull request HEAD instead of merge commit.
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: 'Install Nix'
if: ${{ matrix.runner != 'MacM1' }}
uses: cachix/install-nix-action@v31.5.1
with:
install_url: https://releases.nixos.org/nix/nix-2.30.1/install
extra_nix_config: |
substituters = http://cache.nixos.org https://cache.iog.io
trusted-public-keys = cache.nixos.org
- name: 'Install Cachix'
if: ${{ matrix.runner != 'MacM1' }}
uses: cachix/cachix-action@v16
with:
name: k-framework
- name: 'Build and test'
run: |
set -euxo pipefail
nix --version
nix flake check # build and run integration & unit tests