Test (MSRV check) #5906
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: Test (MSRV check) | |
| # TL;DR https://github.com/noir-lang/noir/issues/4384 | |
| # | |
| # This workflow acts to ensure that we can publish to crates.io, we need this extra check as libraries don't respect the Cargo.lock file committed in this repository. | |
| # We must then always be able to build the workspace using the latest versions of all of our dependencies, so we explicitly update them and build in this workflow. | |
| on: | |
| schedule: | |
| # Run a nightly check at 2 AM UTC | |
| - cron: "0 2 * * *" | |
| push: | |
| branches: | |
| - master | |
| permissions: {} | |
| # This will cancel previous runs when a branch or PR is updated | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-test-artifacts: | |
| name: Build test artifacts | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Delete android SDK | |
| run: sudo rm -rf /usr/local/lib/android/sdk | |
| - name: Setup toolchain | |
| uses: dtolnay/rust-toolchain@1.89.0 | |
| with: | |
| targets: x86_64-unknown-linux-gnu | |
| # We force the ACVM crate and all of its dependencies to update their dependencies | |
| # This ensures that we'll be able to build the crates when they're being published. | |
| - name: Update Cargo.lock | |
| run: | | |
| cargo update --package acvm --aggressive | |
| cargo update --package bn254_blackbox_solver --aggressive | |
| - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 | |
| with: | |
| key: x86_64-unknown-linux-gnu-msrv-check | |
| cache-on-failure: true | |
| save-if: ${{ github.event_name != 'merge_group' }} | |
| - name: Install nextest | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: nextest@0.9.88 | |
| - name: Install mold linker | |
| run: sudo apt-get update && sudo apt-get install -y mold | |
| - name: Build and archive tests | |
| run: cargo nextest archive --workspace --archive-file nextest-archive.tar.zst | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # The archive is uploaded once and downloaded by every test partition. | |
| # Debug info dominates its size but is never read during a CI test run | |
| # (a failure is reproduced locally with a normal debug build), so drop | |
| # it to keep the per-partition `Download archive` step off the timeout. | |
| CARGO_PROFILE_DEV_DEBUG: "0" | |
| CARGO_PROFILE_TEST_DEBUG: "0" | |
| # Link test binaries with mold instead of GNU ld to cut link time. | |
| RUSTFLAGS: "-C link-arg=-fuse-ld=mold" | |
| # `compile_fail` runs trybuild, which spawns its own `cargo build` and | |
| # needs the cargo registry to resolve transitive proc-macro deps. The | |
| # run-tests job runs from the archive without registry access, so the | |
| # test detects the nextest run via NEXTEST_TEST_GROUP and skips itself. | |
| # We exercise it here via plain `cargo test`, where the registry cache | |
| # restored by Swatinem/rust-cache is intact. | |
| - name: Run trybuild compile_fail tests | |
| run: cargo test -p msgpack_tagged --test compile_fail | |
| - name: Upload archive to workflow | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: nextest-archive | |
| path: nextest-archive.tar.zst | |
| run-tests: | |
| name: "Run tests (partition ${{matrix.partition}})" | |
| runs-on: ubuntu-22.04 | |
| needs: [build-test-artifacts] | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| partition: [1, 2, 3, 4, 5, 6, 7, 8] | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup toolchain | |
| uses: dtolnay/rust-toolchain@1.89.0 | |
| with: | |
| targets: x86_64-unknown-linux-gnu | |
| - name: Install nextest | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: nextest@0.9.88 | |
| - name: Download archive | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| name: nextest-archive | |
| - name: Run tests | |
| run: | | |
| RUST_MIN_STACK=8388608 \ | |
| cargo nextest run --archive-file nextest-archive.tar.zst \ | |
| --partition count:${{ matrix.partition }}/8 \ | |
| --profile ci-master | |
| env: | |
| # Tests that spawn their own `cargo build` (notably trybuild's | |
| # compile_fail in `msgpack_tagged`) detect this and skip — see | |
| # acvm-repo/msgpack_tagged/tests/compile_fail.rs. They run instead | |
| # in the build-test-artifacts job where the registry cache is intact. | |
| NOIR_NEXTEST_ARCHIVED: 1 | |
| # This is a job which depends on all test jobs and reports the overall status. | |
| # This allows us to add/remove test jobs without having to update the required workflows. | |
| tests-end: | |
| name: Rust End | |
| runs-on: ubuntu-22.04 | |
| # We want this job to always run (even if the dependant jobs fail) as we want this job to fail rather than skipping. | |
| if: ${{ always() }} | |
| needs: | |
| - run-tests | |
| permissions: | |
| contents: read | |
| issues: write | |
| steps: | |
| - name: Report overall success | |
| run: | | |
| if [[ $FAIL == true ]]; then | |
| exit 1 | |
| else | |
| exit 0 | |
| fi | |
| env: | |
| # We treat any cancelled, skipped or failing jobs as a failure for the workflow as a whole. | |
| FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') }} | |
| - name: Checkout | |
| if: ${{ failure() }} | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| # Raise an issue if the tests failed | |
| - name: Alert on failed publish | |
| uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2 | |
| if: ${{ failure() }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| WORKFLOW_NAME: ${{ github.workflow }} | |
| WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| with: | |
| update_existing: true | |
| filename: .github/ACVM_NOT_PUBLISHABLE.md |