Skip to content

More ergonomics

More ergonomics #179

Workflow file for this run

name: CI - Network Tests
on:
push:
branches: [main]
paths:
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'docker/**'
- 'scripts/docker-network-tests.sh'
- '.github/workflows/ci-network.yml'
pull_request:
branches: [main]
paths:
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'docker/**'
- 'scripts/docker-network-tests.sh'
- '.github/workflows/ci-network.yml'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
# Multi-process network tests (localhost) - cross-platform
network-tests:
name: Network Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v6
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install cargo-nextest
uses: ./.github/actions/install-cargo-tool
with:
tool: cargo-nextest
- name: Configure sccache
id: sccache
uses: mozilla-actions/[email protected]
continue-on-error: true
- name: Verify sccache is working (Unix)
id: sccache-check-unix
if: steps.sccache.outcome == 'success' && runner.os != 'Windows'
run: ./scripts/verify-sccache.sh
continue-on-error: true
- name: Verify sccache is working (Windows)
id: sccache-check-windows
if: steps.sccache.outcome == 'success' && runner.os == 'Windows'
shell: bash
run: ./scripts/verify-sccache.sh
continue-on-error: true
- name: Set sccache working status
id: sccache-check
shell: bash
run: |
# Assign GitHub expressions to variables (avoids shellcheck SC2193)
unix_working="${{ steps['sccache-check-unix'].outputs.working }}"
windows_working="${{ steps['sccache-check-windows'].outputs.working }}"
if [ "$unix_working" == "true" ] || [ "$windows_working" == "true" ]; then
echo "working=true" >> "$GITHUB_OUTPUT"
else
echo "working=false" >> "$GITHUB_OUTPUT"
fi
- name: Clear sccache env on failure
if: steps.sccache.outcome != 'success' || steps.sccache-check.outputs.working != 'true'
shell: bash
run: |
echo "RUSTC_WRAPPER=" >> "$GITHUB_ENV"
echo "SCCACHE_GHA_ENABLED=" >> "$GITHUB_ENV"
- name: Cache cargo registry and build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: network-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
network-${{ runner.os }}-cargo-
- name: Build network test peer
run: cargo build --release -p network-test-peer
env:
RUSTC_WRAPPER: ${{ steps.sccache-check.outputs.working == 'true' && 'sccache' || '' }}
SCCACHE_GHA_ENABLED: ${{ steps.sccache-check.outputs.working == 'true' && 'true' || 'false' }}
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
SCCACHE_STARTUP_NOTIFY_TIMEOUT: "60"
SCCACHE_IDLE_TIMEOUT: "0"
- name: Run multi-process network tests (nextest)
run: cargo nextest run --profile ci --release -E 'test(multi_process)' --test network
timeout-minutes: 10
env:
RUSTC_WRAPPER: ${{ steps.sccache-check.outputs.working == 'true' && 'sccache' || '' }}
SCCACHE_GHA_ENABLED: ${{ steps.sccache-check.outputs.working == 'true' && 'true' || 'false' }}
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
SCCACHE_STARTUP_NOTIFY_TIMEOUT: "60"
SCCACHE_IDLE_TIMEOUT: "0"
# Docker-based network tests with tc/netem
docker-network-tests:
name: Network Tests (Docker)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
run: docker compose -f docker/docker-compose.yml build
- name: Run Docker network tests (quick)
run: ./scripts/docker-network-tests.sh --quick
timeout-minutes: 15
- name: Upload test results
if: always()
uses: actions/upload-artifact@v6
with:
name: docker-network-test-results
path: test-results/
retention-days: 7