Files
iroh/.github/workflows/tests.yaml
T
dependabot[bot] 70ba7cfccd chore(deps): bump the github-actions group across 1 directory with 4 updates
Bumps the github-actions group with 4 updates in the / directory: [dtolnay/rust-toolchain](https://github.com/dtolnay/rust-toolchain), [taiki-e/install-action](https://github.com/taiki-e/install-action), [actions/setup-java](https://github.com/actions/setup-java) and [actions/create-github-app-token](https://github.com/actions/create-github-app-token).


Updates `dtolnay/rust-toolchain` from e2a55d2ffb04f378e9626c28d38b36d230d1e12f to 683b588c487a69d01f6c6ddf40f036ff682cc2c8
- [Release notes](https://github.com/dtolnay/rust-toolchain/releases)
- [Commits](https://github.com/dtolnay/rust-toolchain/compare/e2a55d2ffb04f378e9626c28d38b36d230d1e12f...683b588c487a69d01f6c6ddf40f036ff682cc2c8)

Updates `taiki-e/install-action` from 2.87.26 to 2.87.30
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/install-action/compare/f7e5d7c961414b23f5b25b2da9294395d08513ad...a4d3f3f761dcd95cce1b72cb61cb6d1963438177)

Updates `actions/setup-java` from 6.0.1 to 6.1.0
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/de7274f081f381c8f8158605e0321c36c376e2e6...b843ebf9b913146b38da2eaa7aeddf76074ae1ad)

Updates `actions/create-github-app-token` from 3.2.0 to 3.3.0
- [Release notes](https://github.com/actions/create-github-app-token/releases)
- [Changelog](https://github.com/actions/create-github-app-token/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/create-github-app-token/compare/bcd2ba49218906704ab6c1aa796996da409d3eb1...64ab729a6294000f5aa4a4bc0b73d1f32bc45510)

---
updated-dependencies:
- dependency-name: actions/create-github-app-token
  dependency-version: 3.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: actions/setup-java
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: dtolnay/rust-toolchain
  dependency-version: 683b588c487a69d01f6c6ddf40f036ff682cc2c8
  dependency-type: direct:production
  dependency-group: github-actions
- dependency-name: taiki-e/install-action
  dependency-version: 2.87.28
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-29 12:40:00 -04:00

287 lines
10 KiB
YAML

# Run all tests, with or without flaky tests.
name: Tests
on:
workflow_call:
inputs:
rust-version:
description: "The version of the rust compiler to run"
type: string
default: "stable"
flaky:
description: "Whether to also run flaky tests"
type: boolean
default: false
git-ref:
description: "Which git ref to checkout"
type: string
default: ${{ github.ref }}
env:
RUST_BACKTRACE: 1
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
SCCACHE_CACHE_SIZE: "10G"
CRATES_LIST: "iroh,iroh-bench,iroh-dns-server,iroh-relay"
IROH_FORCE_STAGING_RELAYS: "1"
NEXTEST_VERSION: "0.9.80"
# Default to read-only; jobs that need more grant it explicitly.
permissions:
contents: read
jobs:
build_and_test_nix:
timeout-minutes: 30
name: "Tests"
runs-on: ${{ matrix.runs_on }}
strategy:
fail-fast: false
matrix:
name: [ubuntu-latest, macOS-arm-latest]
rust: ["${{ inputs.rust-version }}"]
features: [all, none, default]
include:
- name: ubuntu-latest
os: ubuntu-latest
release-os: linux
release-arch: amd64
runs_on: blacksmith-8vcpu-ubuntu-2404
- name: macOS-arm-latest
os: macOS-latest
release-os: darwin
release-arch: aarch64
runs_on: blacksmith-6vcpu-macos-26
env:
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "on"
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ inputs.git-ref }}
- name: Install ${{ matrix.rust }} rust
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: ${{ matrix.rust }}
- name: Install cargo-nextest
uses: taiki-e/install-action@a4d3f3f761dcd95cce1b72cb61cb6d1963438177 # v2.87.30
with:
tool: nextest@${{ env.NEXTEST_VERSION }}
- name: Install sccache
uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
continue-on-error: true
- uses: $/.github/workflows/sccache-probe
- name: Select features
run: |
case "${{ matrix.features }}" in
all)
echo "FEATURES=--all-features" >> "$GITHUB_ENV"
;;
none)
echo "FEATURES=--no-default-features" >> "$GITHUB_ENV"
;;
default)
echo "FEATURES=" >> "$GITHUB_ENV"
;;
*)
exit 1
esac
- name: check features
if: ${{ ! inputs.flaky }}
run: |
for i in ${CRATES_LIST//,/ }
do
echo "Checking $i $FEATURES"
targets="--lib --bins"
echo cargo check --locked -p $i $FEATURES $targets
cargo check --locked -p $i $FEATURES $targets
done
env:
RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG'}}
- name: build tests
run: |
cargo nextest run --locked --workspace $FEATURES --lib --bins --tests --no-run
- name: list ignored tests
run: |
cargo nextest list --locked --workspace $FEATURES --lib --bins --tests --run-ignored ignored-only
- name: run tests
run: |
mkdir -p output
cargo nextest run --locked --workspace $FEATURES --lib --bins --tests --profile ci --run-ignored "$RUN_IGNORED" $VERBOSE --no-fail-fast --message-format "$MSG_FORMAT" > "output/$OUT_NAME.json"
env:
RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG'}}
NEXTEST_EXPERIMENTAL_LIBTEST_JSON: 1
RUN_IGNORED: ${{ inputs.flaky && 'all' || 'default' }}
VERBOSE: ${{ inputs.flaky && '--verbose' || '' }}
MSG_FORMAT: ${{ inputs.flaky && 'libtest-json' || 'human' }}
OUT_NAME: ${{ matrix.name }}_${{ matrix.features }}_${{ matrix.rust }}
- name: upload results
if: ${{ failure() && inputs.flaky }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: libtest_run_${{ github.run_number }}-${{ github.run_attempt }}-${{ matrix.name }}_${{ matrix.features }}_${{ matrix.rust }}.json
path: output
retention-days: 45
compression-level: 0
- name: doctests
if: ${{ (! inputs.flaky) && matrix.features == 'all' }}
env:
RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG'}}
run: |
cargo test --locked --workspace --all-features --doc
# We can not check the doctest features by only compiling them,
# so are forced to run them once more.
- name: Check doctest features
if: ${{ ! inputs.flaky }}
env:
RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG'}}
run: |
for i in ${CRATES_LIST//,/ }
do
echo "Checking $i doctest $FEATURES"
echo cargo test --locked -p $i --doc $FEATURES
cargo test --locked -p $i --doc $FEATURES
done
build_and_test_windows:
timeout-minutes: 30
name: "Tests"
runs-on: blacksmith-8vcpu-windows-2025
strategy:
fail-fast: false
matrix:
name: [windows-latest]
rust: ["${{ inputs.rust-version}}"]
features: [all, none, default]
target:
- x86_64-pc-windows-msvc
env:
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "on"
# Installing a toolchain does not select it, so without this every cargo
# invocation below uses whatever the runner image ships as rustup default.
# As an env var this applies to the job only and leaves the image's
# rustup default untouched.
RUSTUP_TOOLCHAIN: "${{ matrix.rust }}"
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ inputs.git-ref }}
- name: Install ${{ matrix.rust }}
env:
RUST_TOOLCHAIN: ${{ matrix.rust }}
RUST_TARGET: ${{ matrix.target }}
# bash: pwsh steps ignore a command's exit status, so a failed rustup
# call here goes unnoticed.
shell: bash
run: |
rustup toolchain install "$RUST_TOOLCHAIN" --target "$RUST_TARGET"
rustup set default-host "$RUST_TARGET"
# Fail here rather than building with the wrong compiler if the
# requested toolchain is not the active one.
rustup show active-toolchain | grep -q "^${RUST_TOOLCHAIN}-"
rustc --version
# Was a bare Invoke-WebRequest from get.nexte.st with no checksum,
# unpacked into ~/.cargo/bin on a long-lived host.
- name: Install cargo-nextest
uses: taiki-e/install-action@a4d3f3f761dcd95cce1b72cb61cb6d1963438177 # v2.87.30
with:
tool: nextest@${{ env.NEXTEST_VERSION }}
- name: Select features
run: |
switch ("${{ matrix.features }}") {
"all" {
echo "FEATURES=--all-features" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
}
"none" {
echo "FEATURES=--no-default-features" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
}
"default" {
echo "FEATURES=" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
}
default {
Exit 1
}
}
- name: Install sccache
uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
continue-on-error: true
with:
# Pinned: sccache >= 0.17.0 expands rustc @argfiles and breaks Windows'
# 32K command line limit: https://github.com/mozilla/sccache/issues/2397
version: "v0.16.0"
- uses: $/.github/workflows/sccache-probe
- uses: msys2/setup-msys2@ec48f7c5447b3140e2b088413ae3a55687bccb6e # v2.33.0
with:
# Blacksmith's Windows image ships no pre-installed MSYS2 (C:\msys64).
release: true
- name: Install aws-lc-sys build dependencies
shell: powershell
run: |
$chocoPath = "$Env:ProgramData\chocolatey\bin\choco.exe"
if (!(Test-Path $chocoPath)) {
$chocoPath = "$Env:SystemDrive\ProgramData\chocolatey\bin\choco.exe"
}
& $chocoPath install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
& $chocoPath install nasm -y
echo "C:\Program Files\CMake\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\Program Files\NASM" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
- name: build tests
env:
RUST_TARGET: ${{ matrix.target }}
run: |
$feat = if ($env:FEATURES) { $env:FEATURES -split '\s+' } else { @() }
cargo nextest run --locked --workspace @feat --lib --bins --tests --target $env:RUST_TARGET --no-run
- name: list ignored tests
env:
RUST_TARGET: ${{ matrix.target }}
run: |
$feat = if ($env:FEATURES) { $env:FEATURES -split '\s+' } else { @() }
cargo nextest list --locked --workspace @feat --lib --bins --tests --target $env:RUST_TARGET --run-ignored ignored-only
- name: tests
run: |
mkdir -p output
$feat = if ($env:FEATURES) { $env:FEATURES -split '\s+' } else { @() }
cargo nextest run --locked --workspace @feat --lib --bins --tests --profile ci --target $env:RUST_TARGET --run-ignored $env:RUN_IGNORED --no-fail-fast --message-format $env:MSG_FORMAT > "output/$($env:OUT_NAME).json"
env:
RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG'}}
NEXTEST_EXPERIMENTAL_LIBTEST_JSON: 1
RUST_TARGET: ${{ matrix.target }}
RUN_IGNORED: ${{ inputs.flaky && 'all' || 'default' }}
MSG_FORMAT: ${{ inputs.flaky && 'libtest-json' || 'human' }}
OUT_NAME: ${{ matrix.name }}_${{ matrix.features }}_${{ matrix.rust }}
- name: upload results
if: ${{ failure() && inputs.flaky }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: libtest_run_${{ github.run_number }}-${{ github.run_attempt }}-${{ matrix.name }}_${{ matrix.features }}_${{ matrix.rust }}.json
path: output
retention-days: 1
compression-level: 0