a couple of updates #5551
Workflow file for this run
This file contains 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
on: | |
push: | |
branches: [main, auto, canary] | |
pull_request: | |
branches: | |
- main | |
name: CI | |
env: | |
RUSTFLAGS: -D warnings | |
CARGO_TERM_COLOR: always | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2 | |
- name: Lint (clippy) | |
run: cargo clippy --all-features --all-targets | |
- name: Lint (rustfmt) | |
run: cargo xfmt --check | |
- name: Install cargo readme | |
uses: taiki-e/install-action@8cf90305168a5e4e014d1f8eb7f12eaee6993ffe # v2 | |
with: | |
tool: cargo-readme | |
- name: Run cargo readme | |
run: ./scripts/regenerate-readmes.sh | |
- name: Check for differences | |
run: git diff --exit-code | |
build-rustdoc: | |
name: Build documentation | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2 | |
- name: Build rustdoc | |
run: cargo doc --all-features --workspace | |
build: | |
name: Build and test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
# macos-14 for M1 runners | |
- macos-14 | |
- windows-latest | |
# 1.81 is the MSRV | |
rust-version: ["1.81", stable] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust-version }} | |
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2 | |
with: | |
# Matrix instances (other than OS) need to be added to this explicitly | |
key: ${{ matrix.rust-version }} | |
- name: Install latest nextest release | |
uses: taiki-e/install-action@nextest | |
- name: Build nextest-metadata | |
run: cargo build --package nextest-metadata | |
- name: Build cargo-nextest without self-update | |
run: cargo build --package cargo-nextest --no-default-features --features default-no-update | |
- name: Build cargo-nextest | |
run: cargo build --package cargo-nextest | |
- name: Build all targets | |
run: cargo build --all-targets | |
- name: Build all targets with all features | |
run: cargo build --all-targets --all-features | |
- name: Doctests | |
run: cargo test --doc | |
- name: Test with locally built nextest | |
run: cargo local-nt run --profile ci | |
- name: Upload results | |
# Run this step even if the test step fails | |
if: "!cancelled()" | |
uses: trunk-io/analytics-uploader@main | |
with: | |
# Path to your test results. | |
junit-paths: target/nextest/ci/junit.xml | |
# Provide your Trunk organization slug. | |
org-slug: nextest-rs | |
# Provide your Trunk API token as a GitHub secret. | |
token: ${{ secrets.TRUNK_API_TOKEN }} | |
continue-on-error: true | |
- name: Upload JUnit report | |
# Run this step even if the test step fails. Upload it right now because | |
# we're most interested in the JUnit report generated by the local | |
# version of nextest, not the latest release. | |
if: "!cancelled()" | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: junit-${{ matrix.os }}-${{ matrix.rust-version }}.xml | |
path: | | |
target/nextest/ci/junit.xml | |
if-no-files-found: error | |
- name: Test with latest nextest release | |
run: cargo nextest run --profile ci | |
- name: Test without double-spawning | |
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-14' }} | |
env: | |
NEXTEST_DOUBLE_SPAWN: 0 | |
run: cargo local-nt run --profile ci | |
- name: Test without rustup wrappers | |
env: | |
CARGO_NEXTEST: target/debug/cargo-nextest | |
RUSTUP_AVAILABLE: 1 | |
shell: bash | |
run: ./scripts/nextest-without-rustup.sh run --profile ci | |
- name: Upload nextest binary | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: cargo-nextest-${{ matrix.os }}-${{ matrix.rust-version }} | |
path: | | |
target/debug/cargo-nextest | |
target/debug/cargo-nextest.exe | |
if-no-files-found: error | |
test-archive-target-runner: | |
name: Test archives with a target runner | |
# We need at least 24.04 for updated wine and mingw. 22.04 has a wine that's too old (and the | |
# official WineHQ PPA breaks every so often). | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: x86_64-pc-windows-gnu | |
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2 | |
- name: Install wine and gcc-mingw-w64-x86-64-win32 | |
run: | | |
sudo apt-get update | |
sudo apt-get install wine gcc-mingw-w64-x86-64-win32 | |
- name: Build cargo-nextest | |
run: cargo build --package cargo-nextest | |
- name: Archive test fixtures | |
env: | |
CARGO_NEXTEST: target/debug/cargo-nextest | |
RUSTUP_AVAILABLE: 1 | |
run: | | |
./scripts/nextest-without-rustup.sh archive --manifest-path fixtures/nextest-tests/Cargo.toml \ | |
--target x86_64-pc-windows-gnu --archive-file target/fixture-archive.tar.zst \ | |
--package cdylib-example --package nextest-derive | |
# This ensures that for target binaries, we always use the libdir in the archive, never the | |
# one installed by rustup. | |
- name: Remove x86_64-pc-windows-gnu target from rustup | |
run: rustup target remove x86_64-pc-windows-gnu | |
- name: Run test fixtures | |
env: | |
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER: wine | |
run: cargo local-nt run --archive-file target/fixture-archive.tar.zst | |
# Completely uninstall rustup -- this is similar to running an archive on a machine without | |
# cargo. | |
- name: Uninstall rustup | |
run: rustup self uninstall -y | |
- name: Run test fixtures without rustup wrappers | |
env: | |
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER: wine | |
CARGO_NEXTEST: target/debug/cargo-nextest | |
run: ./scripts/nextest-without-rustup.sh run --archive-file target/fixture-archive.tar.zst | |
# Upload the archive for use in the next job. | |
- name: Upload archive | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: fixture-archive | |
path: target/fixture-archive.tar.zst | |
if-no-files-found: error | |
test-archive-runner-dest: | |
name: Test archives with a runner (destination) | |
strategy: | |
matrix: | |
data: | |
- os: ubuntu-24.04 | |
# The artifact name is set by the upload job, which is ubuntu-latest. | |
artifact-name: ubuntu-latest | |
- os: windows-latest | |
artifact-name: windows-latest | |
runs-on: ${{ matrix.data.os }} | |
needs: | |
- test-archive-target-runner | |
- build | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Download nextest binary | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: cargo-nextest-${{ matrix.data.artifact-name }}-stable | |
path: nextest-bin | |
- name: Download archive | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: fixture-archive | |
path: fixture-archive | |
- name: Run test fixtures (host) | |
if: ${{ matrix.data.artifact-name == 'ubuntu-latest' }} | |
env: | |
CARGO_NEXTEST: nextest-bin/cargo-nextest | |
run: | | |
chmod +x $CARGO_NEXTEST | |
./scripts/nextest-without-rustup.sh run \ | |
--archive-file fixture-archive/fixture-archive.tar.zst \ | |
--workspace-remap $GITHUB_WORKSPACE/fixtures/nextest-tests \ | |
-E 'platform(host)' | |
- name: Run test fixtures (target) | |
if: ${{ matrix.data.artifact-name == 'windows-latest' }} | |
shell: bash | |
env: | |
CARGO_NEXTEST: nextest-bin/cargo-nextest.exe | |
run: | | |
./scripts/nextest-without-rustup.sh run \ | |
--archive-file fixture-archive/fixture-archive.tar.zst \ | |
--workspace-remap $GITHUB_WORKSPACE/fixtures/nextest-tests \ | |
-E 'platform(target)' |