Files
iroh/.github/workflows/tests.yaml
T
Asmir Avdicevic 98d45f3b86 feat: iroh-perf (#2186)
## Description

In progress thing for what should later be `iroh-perf`. For now you can
run with `cargo run --release -- iroh` and `cargo run --release --
quinn` to do a simple comparison benchmark.

More knobs are available for tuning with `--help`.
There's a much more stark difference on macOS compared to running on
Linux.

Next steps bumping to test against `quinn 0.11`

Sample output:
```
iroh (macOS)

Client 0 stats:
Connect time: 13.788583ms
Overall download stats:

Transferred 1073741824 bytes on 1 streams in 5.47s (187.27 MiB/s)

Time to first byte (TTFB): 1ms

Total chunks: 130319

Average chunk time: 41.936ms

Average chunk size: 8.04KiB

Stream download metrics:

      │  Throughput   │ Duration 
──────┼───────────────┼──────────
 AVG  │  187.31 MiB/s │     5.47s
 P0   │  187.25 MiB/s │     5.46s
 P10  │  187.37 MiB/s │     5.47s
 P50  │  187.37 MiB/s │     5.47s
 P90  │  187.37 MiB/s │     5.47s
 P100 │  187.37 MiB/s │     5.47s
 ```
 
```
quinn (macOS)

Client 0 stats:
Connect time: 1.81875ms
Overall download stats:

Transferred 1073741824 bytes on 1 streams in 2.85s (358.92 MiB/s)

Time to first byte (TTFB): 61.168ms

Total chunks: 47412

Average chunk time: 60.176ms

Average chunk size: 22.12KiB

Stream download metrics:

      │  Throughput   │ Duration 
──────┼───────────────┼──────────
 AVG  │  358.88 MiB/s │     2.85s
 P0   │  358.75 MiB/s │     2.85s
 P10  │  359.00 MiB/s │     2.85s
 P50  │  359.00 MiB/s │     2.85s
 P90  │  359.00 MiB/s │     2.85s
 P100 │  359.00 MiB/s │     2.85s
 ```

```
iroh (linux)

Client 0 stats:
Connect time: 3.83554ms
Overall download stats:

Transferred 1073741824 bytes on 1 streams in 1.16s (884.52 MiB/s)

Time to first byte (TTFB): 2.014ms

Total chunks: 38046

Average chunk time: 30.408ms

Average chunk size: 27.55KiB

Stream download metrics:

      │  Throughput   │ Duration 
──────┼───────────────┼──────────
 AVG  │  884.75 MiB/s │     1.16s
 P0   │  884.50 MiB/s │     1.16s
 P10  │  885.00 MiB/s │     1.16s
 P50  │  885.00 MiB/s │     1.16s
 P90  │  885.00 MiB/s │     1.16s
 P100 │  885.00 MiB/s │     1.16s
 ```
 
```
quinn (linux)

Client 0 stats:
Connect time: 1.22085ms
Overall download stats:

Transferred 1073741824 bytes on 1 streams in 994.57ms (1029.59 MiB/s)

Time to first byte (TTFB): 1.483ms

Total chunks: 32809

Average chunk time: 30.296ms

Average chunk size: 31.96KiB

Stream download metrics:

      │  Throughput   │ Duration 
──────┼───────────────┼──────────
 AVG  │ 1030.50 MiB/s │  993.00ms
 P0   │ 1030.00 MiB/s │  993.00ms
 P10  │ 1031.00 MiB/s │  993.00ms
 P50  │ 1031.00 MiB/s │  993.00ms
 P90  │ 1031.00 MiB/s │  993.00ms
 P100 │ 1031.00 MiB/s │  993.00ms
 ```

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR.
-->

## Change checklist

- [ ] Self-review.
- [ ] Documentation updates if relevant.
- [ ] Tests if relevant.
2024-05-22 20:05:09 +00:00

206 lines
6.1 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: "50G"
CRATES_LIST: "iroh,iroh-blobs,iroh-gossip,iroh-metrics,iroh-net,iroh-net-bench,iroh-docs,iroh-test,iroh-cli,iroh-dns-server"
jobs:
build_and_test_nix:
timeout-minutes: 30
name: "Tests"
runs-on: ${{ matrix.runner }}
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
runner: [self-hosted, linux, X64]
- name: macOS-arm-latest
os: macOS-latest
release-os: darwin
release-arch: aarch64
runner: [self-hosted, macOS, ARM64]
env:
# Using self-hosted runners so use local cache for sccache and
# not SCCACHE_GHA_ENABLED.
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.git-ref }}
- name: Install ${{ matrix.rust }} rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.4
- 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"
if [ $i = "iroh-cli" ]; then
targets="--bins"
else
targets="--lib --bins"
fi
cargo check -p $i $FEATURES $targets
done
env:
RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG'}}
- name: build tests
run: |
cargo nextest run --workspace ${{ env.FEATURES }} --lib --bins --tests --no-run
- name: list ignored tests
run: |
cargo nextest list --workspace ${{ env.FEATURES }} --lib --bins --tests --run-ignored ignored-only
- name: run tests
run: |
cargo nextest run --workspace ${{ env.FEATURES }} --lib --bins --tests --run-ignored ${{ inputs.flaky && 'all' || 'default' }} --no-fail-fast
env:
RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG'}}
- name: doctests
if: ${{ (! inputs.flaky) && matrix.features == 'all' }}
run: |
if [ -n "${{ runner.debug }}" ]; then
export RUST_LOG=TRACE
else
export RUST_LOG=DEBUG
fi
cargo test --workspace --all-features --doc
build_and_test_windows:
timeout-minutes: 30
name: "Tests"
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
name: [windows-latest]
rust: [ '${{ inputs.rust-version}}' ]
features: [all, none, default]
target:
- x86_64-pc-windows-msvc
include:
- name: windows-latest
os: windows
runner: [self-hosted, windows, x64]
env:
# Using self-hosted runners so use local cache for sccache and
# not SCCACHE_GHA_ENABLED.
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.git-ref }}
- name: Install ${{ matrix.rust }}
run: |
rustup toolchain install ${{ matrix.rust }}
rustup toolchain default ${{ matrix.rust }}
rustup target add ${{ matrix.target }}
rustup set default-host ${{ matrix.target }}
- name: Install cargo-nextest
shell: powershell
run: |
$tmp = New-TemporaryFile | Rename-Item -NewName { $_ -replace 'tmp$', 'zip' } -PassThru
Invoke-WebRequest -OutFile $tmp https://get.nexte.st/latest/windows
$outputDir = if ($Env:CARGO_HOME) { Join-Path $Env:CARGO_HOME "bin" } else { "~/.cargo/bin" }
$tmp | Expand-Archive -DestinationPath $outputDir -Force
$tmp | Remove-Item
- 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@v0.0.4
- uses: msys2/setup-msys2@v2
- name: build tests
run: |
cargo nextest run --workspace ${{ env.FEATURES }} --lib --bins --tests --target ${{ matrix.target }} --no-run
- name: list ignored tests
run: |
cargo nextest list --workspace ${{ env.FEATURES }} --lib --bins --tests --target ${{ matrix.target }} --run-ignored ignored-only
- name: tests
run: |
cargo nextest run --workspace ${{ env.FEATURES }} --lib --bins --tests --target ${{ matrix.target }} --run-ignored ${{ inputs.flaky && 'all' || 'default' }} --no-fail-fast
env:
RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG'}}