Skip to content

fix(bin): process events per batch, write responses once the socket is empty #14823

fix(bin): process events per batch, write responses once the socket is empty

fix(bin): process events per batch, write responses once the socket is empty #14823

Workflow file for this run

name: CI
on:
pull_request:
merge_group:
push:
branches: ["main"] # Only to populate the Rust cache
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUST_TEST_TIME_UNIT: 10,30
RUST_TEST_TIME_INTEGRATION: 10,30
RUST_TEST_TIME_DOCTEST: 10,30
CARGO_PROFILE_RELEASE_LTO: true
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
toolchains:
name: Determine toolchains
runs-on: ubuntu-26.04
outputs:
toolchains: ${{ steps.toolchains.outputs.toolchains }}
cacheable: ${{ steps.cacheable.outputs.toolchains }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- id: toolchains
uses: mozilla/actions/toolchains@80429d96b44ae13c8cfe2a2dbec978ffc31c3720 # v3.3.0
# Nightly never uses a cache, so main runs have no reason to build it.
- id: cacheable
env:
TOOLCHAINS: ${{ steps.toolchains.outputs.toolchains }}
run: echo "toolchains=$(jq -c 'map(select(. != "nightly"))' <<<"$TOOLCHAINS")" >> "$GITHUB_OUTPUT"
check:
name: Run checks
needs: toolchains
# TODO: Restore `environment: codecov` once GitHub supports filtering deployment messages.
# environment: codecov
strategy:
fail-fast: false
matrix:
os:
- ubuntu-26.04
- ubuntu-26.04-arm
- macos-26
- windows-2025
- windows-11-arm
rust-toolchain: ${{ fromJSON(github.event_name == 'push' && needs.toolchains.outputs.cacheable || needs.toolchains.outputs.toolchains) }}
type: [debug]
# Include some dynamically-linked release builds, to check that that works on all platforms.
include:
- os: ubuntu-26.04
rust-toolchain: stable
type: release
- os: macos-26
rust-toolchain: stable
type: release
- os: windows-2025
rust-toolchain: stable
type: release
# Also do some debug builds on the oldest OS versions.
- os: ubuntu-24.04
rust-toolchain: stable
type: debug
- os: ubuntu-24.04-arm
rust-toolchain: stable
type: debug
- os: macos-15
rust-toolchain: stable
type: debug
- os: windows-2022
rust-toolchain: stable
type: debug
env:
BUILD_TYPE: ${{ matrix.type == 'release' && '--release' || '' }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: $/.github/actions/install-build-deps
with:
version: ${{ matrix.rust-toolchain }}
components: ${{ matrix.rust-toolchain == 'stable' && 'llvm-tools' || '' }} ${{ matrix.rust-toolchain == 'nightly' && startsWith(matrix.os, 'ubuntu') && !endsWith(matrix.os, 'arm') && 'rust-src ' || '' }}
tools: cargo-hack ${{ matrix.rust-toolchain == 'stable' && 'cargo-llvm-cov' || '' }} ${{ matrix.rust-toolchain == 'nightly' && startsWith(matrix.os, 'ubuntu') && !endsWith(matrix.os, 'arm') && 'cargo-careful' || '' }}
cache-key: ${{ matrix.type }} # Debug and release are different.
- name: Run tests and determine coverage
env:
RUST_LOG: debug
RUST_BACKTRACE: 1
RUST_TEST_TIME_UNIT: 10,30
RUST_TEST_TIME_INTEGRATION: 10,30
RUST_TEST_TIME_DOCTEST: 10,30
TOOLCHAIN: ${{ matrix.rust-toolchain }}
# FIXME: cargo-careful at the moment only works on amd64 Ubuntu
CAREFUL: ${{ matrix.rust-toolchain == 'nightly' && startsWith(matrix.os, 'ubuntu') && !endsWith(matrix.os, 'arm') && 'careful' || '' }}
run: |
DUMP_SIMULATION_SEEDS="$(pwd)/simulation-seeds"
export DUMP_SIMULATION_SEEDS
# Coverage is broken on Windows ARM64, see https://github.com/rust-lang/rust/issues/150123
# shellcheck disable=SC2086
if [ "$TOOLCHAIN" == "stable" ] && [ "$RUNNER_OS-$RUNNER_ARCH" != "Windows-ARM64" ]; then
cargo llvm-cov test $BUILD_TYPE --locked --include-ffi --codecov --output-path codecov.json
if [ "$RUNNER_OS" == "Linux" ] && [ -z "$BUILD_TYPE" ]; then
cargo llvm-cov report --lcov --include-ffi --output-path lcov.info
fi
elif [ -n "$CAREFUL" ]; then
cargo careful test $BUILD_TYPE --locked --target "$(rustc --print host-tuple)"
fi
# Run tests across all meaningful feature combinations.
# shellcheck disable=SC2086
cargo hack test $BUILD_TYPE --locked --feature-powerset --tests --exclude-features gecko,ci,build-fuzzing-corpus --mutually-exclusive-features bench,blapi,default,disable-encryption
- name: Run client/server transfer
run: |
# shellcheck disable=SC2086
cargo build $BUILD_TYPE --locked --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' }}
- name: CodeCov Windows workaround
if: ${{ startsWith(matrix.os, 'windows') && matrix.type == 'debug' && matrix.rust-toolchain == 'stable' }}
run: |
# FIXME: Without this, the codecov/codecov-action fails. No idea why it's looking under C:/msys64 now, it shouldn't.
mkdir -p C:/msys64/home/runneradmin/
touch C:/msys64/home/runneradmin/.gitconfig
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: matrix.os == 'ubuntu-26.04' && matrix.rust-toolchain == 'stable' && matrix.type == 'debug' && github.event_name != 'push'
with:
name: lcov-coverage
path: lcov.info
retention-days: 1
- uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
files: codecov.json
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }} # zizmor: ignore[secrets-outside-env]
verbose: true
flags: ${{ startsWith(matrix.os, 'ubuntu') && 'linux' || startsWith(matrix.os, 'macos') && 'macos' || 'windows' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # zizmor: ignore[secrets-outside-env]
if: matrix.type == 'debug' && matrix.rust-toolchain == 'stable' && github.event_name != 'push'
- name: Save simulation seeds artifact
if: ${{ always() && github.event_name != 'push' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: simulation-seeds-${{ matrix.os }}-${{ matrix.rust-toolchain }}-${{ matrix.type }}
path: simulation-seeds
compression-level: 9
crap:
name: CRAP analysis
needs: check
if: ${{ !cancelled() && github.event_name != 'push' }}
runs-on: ubuntu-26.04
permissions:
contents: read
security-events: write # for uploading SARIF to code scanning
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: lcov-coverage
- uses: mozilla/actions/crap@80429d96b44ae13c8cfe2a2dbec978ffc31c3720 # v3.3.0
with:
lcov-path: lcov.info
threshold: "30"
token: ${{ secrets.GITHUB_TOKEN }}
- # merge_group's ref is often gone by upload time: github/codeql-action#1572
if: ${{ github.event_name != 'merge_group' }}
uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
sarif_file: crap.sarif
category: cargo-crap
check-cargo-lock:
name: Ensure `Cargo.lock` contains all required dependencies
if: ${{ github.event_name != 'push' }}
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: $/.github/actions/install-build-deps
with:
version: stable
tools: cargo-hack
nss: "false"
- run: |
cargo update -w --locked
cargo hack update -w --locked
check-android:
name: Check Android
if: ${{ github.event_name != 'push' }}
runs-on: ubuntu-26.04
strategy:
matrix:
target: ["x86_64-linux-android", "aarch64-linux-android"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: $/.github/actions/check-android
with:
target: ${{ matrix.target }}
# Prove neqo builds for a 32-bit target. Covers 32-bit pointer width,
# not i686-pc-windows-msvc or Windows-specific neqo-udp/mtu paths.
check-i686:
name: Check i686-unknown-linux-gnu
if: ${{ github.event_name != 'push' }}
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install 32-bit host toolchain
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends gcc-multilib g++-multilib
- uses: $/.github/actions/install-build-deps
with:
target: i686-unknown-linux-gnu
- name: Compile
run: cargo test --locked --no-run --all-targets --target i686-unknown-linux-gnu
check-vm:
name: Run checks for VM-only platforms
if: ${{ github.event_name != 'push' }}
runs-on: ubuntu-26.04
# TODO: Restore `environment: codecov` once GitHub supports filtering deployment messages.
# environment: codecov
strategy:
fail-fast: false
matrix:
os: [freebsd, netbsd, openbsd, solaris]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: $/.github/actions/check-vm
with:
platform: ${{ matrix.os }}
codecov-token: ${{ secrets.CODECOV_TOKEN }} # zizmor: ignore[secrets-outside-env]