test: Dump simulator RNG seeds #4329
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
name: CI | |
on: | |
push: | |
branches: ["main"] | |
paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] | |
pull_request: | |
branches: ["main"] | |
paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] | |
merge_group: | |
workflow_dispatch: | |
inputs: | |
run_benchmarks: | |
description: 'Run benchmarks' | |
type: boolean | |
required: false | |
default: false | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
DUMP_SIMULATION_SEEDS: /tmp/simulation-seeds | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
check: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
# Keep in sync with Cargo.toml | |
rust-toolchain: [1.76.0, stable, nightly] | |
type: [debug] | |
include: | |
- os: ubuntu-latest | |
rust-toolchain: stable | |
type: release | |
env: | |
BUILD_TYPE: ${{ matrix.type == 'release' && '--release' || '' }} | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- uses: ./.github/actions/rust | |
with: | |
version: ${{ matrix.rust-toolchain }} | |
components: ${{ matrix.rust-toolchain == 'stable' && 'llvm-tools-preview' || matrix.rust-toolchain == 'nightly' && 'rust-src' || '' }} | |
tools: ${{ matrix.rust-toolchain == 'stable' && 'cargo-llvm-cov, ' || '' }} cargo-nextest | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- id: nss-version | |
run: echo "minimum=$(cat neqo-crypto/min_version.txt)" >> "$GITHUB_OUTPUT" | |
- uses: ./.github/actions/nss | |
with: | |
minimum-version: ${{ steps.nss-version.outputs.minimum }} | |
- name: Check | |
run: | | |
# shellcheck disable=SC2086 | |
cargo +${{ matrix.rust-toolchain }} check $BUILD_TYPE --all-targets --features ci | |
- name: Run tests and determine coverage | |
env: | |
RUST_LOG: trace | |
run: | | |
# shellcheck disable=SC2086 | |
if [ "${{ matrix.rust-toolchain }}" == "stable" ]; then | |
cargo +${{ matrix.rust-toolchain }} llvm-cov nextest $BUILD_TYPE --features ci --no-fail-fast --lcov --output-path lcov.info | |
else | |
cargo +${{ matrix.rust-toolchain }} nextest run $BUILD_TYPE --features ci --no-fail-fast | |
fi | |
- name: Run client/server transfer | |
run: | | |
# shellcheck disable=SC2086 | |
cargo +${{ matrix.rust-toolchain }} build $BUILD_TYPE --bin neqo-client --bin neqo-server | |
"target/$BUILD_DIR/neqo-server" "$HOST:4433" & | |
PID=$! | |
# Give the server time to start. | |
sleep 1 | |
"target/$BUILD_DIR/neqo-client" --output-dir . "https://$HOST:4433/$SIZE" | |
kill $PID | |
[ "$(wc -c <"$SIZE")" -eq "$SIZE" ] || exit 1 | |
env: | |
HOST: localhost | |
SIZE: 54321 | |
RUST_LOG: warn | |
BUILD_DIR: ${{ matrix.type == 'release' && 'release' || 'debug' }} | |
- uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 | |
with: | |
file: lcov.info | |
fail_ci_if_error: false | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
if: matrix.type == 'debug' && matrix.rust-toolchain == 'stable' | |
- name: Run tests with sanitizers | |
if: (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest') && matrix.rust-toolchain == 'nightly' | |
env: | |
RUST_LOG: trace | |
run: | | |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then | |
TARGET="x86_64-unknown-linux-gnu" | |
SANITIZERS="address thread leak" | |
elif [ "${{ matrix.os }}" = "macos-latest" ]; then | |
TARGET="aarch64-apple-darwin" | |
# no leak sanitizer support yet | |
SANITIZERS="address thread" | |
fi | |
for sanitizer in $SANITIZERS; do | |
echo "Running tests with $sanitizer sanitizer..." | |
# shellcheck disable=SC2078 | |
if [ "${{ env.DUMP_SIMULATION_SEEDS }}" ]; then | |
export DUMP_SIMULATION_SEEDS="${{ env.DUMP_SIMULATION_SEEDS }}/sanitizer/$sanitizer" | |
fi | |
RUSTFLAGS="-Z sanitizer=$sanitizer" RUSTDOCFLAGS="-Z sanitizer=$sanitizer" cargo +nightly nextest run -Z build-std --features ci --target "$TARGET" | |
done | |
- name: Save simulation seeds artifact | |
if: env.DUMP_SIMULATION_SEEDS | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: simulation-seeds-${{ matrix.os }}-${{ matrix.rust-toolchain }}-${{ matrix.type }} | |
path: ${{ env.DUMP_SIMULATION_SEEDS }} | |
compression-level: 9 | |
bench: | |
needs: [check] | |
if: > | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_benchmarks) || | |
(github.event_name == 'pull_request' && !github.event.pull_request.draft) || | |
(github.event_name != 'workflow_dispatch' && github.event_name != 'pull_request') | |
uses: ./.github/workflows/bench.yml |