Skip to content

add constructors for UsernameLabelParserLayer #4025

add constructors for UsernameLabelParserLayer

add constructors for UsernameLabelParserLayer #4025

Workflow file for this run

name: CI
env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN: stable
RUST_TOOLCHAIN_NIGHTLY: nightly
RUST_TOOLCHAIN_MSRV: 1.91.0
RUST_TOOLCHAIN_BETA: beta
CARGO_INCREMENTAL: 0
CARGO_PROFILE_TEST_DEBUG: 0
on:
push:
branches:
- main
pull_request: {}
jobs:
precheck-rust:
strategy:
matrix:
toolchain:
- 1.91.0 # MSRV
- stable
- beta
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v6
- uses: ilammy/setup-nasm@v1
if: startsWith(matrix.os, 'windows')
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
with:
env-vars: "RUST_TOOLCHAIN=${{ matrix.toolchain }}"
key: ${{ matrix.os }}-${{ matrix.toolchain }}
# https://github.com/rust-lang/cmake-rs/pull/259 breaks handling of long Windows paths
# https://github.com/cloudflare/boring/issues/414
# https://github.com/0x676e67/boring/commit/efacedb5bf409d0d773e8ce4f5080cb4b4c10f54
- name: Pin some dependencies, temporary patch for cmake breakage
if: startsWith(matrix.os, 'windows')
run: |
cargo update --package cmake --precise 0.1.54
- name: check
run: |
cargo check --workspace --all-targets --all-features
- name: clippy
run: |
cargo clippy --workspace --all-targets --all-features
- name: rustfmt
run: |
cargo fmt --all --check
precheck-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: extra-checks
run: |
./scripts/extra-checks.sh
test-rust-base:
strategy:
matrix:
toolchain:
- stable
os:
- ubuntu-latest
- macos-15-intel
- macos-15
- windows-2025
- windows-11-arm
runs-on: ${{ matrix.os }}
needs:
- precheck-rust
- precheck-docs
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v6
- uses: ilammy/setup-nasm@v1
if: startsWith(matrix.os, 'windows')
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.toolchain }}
env-vars: "RUST_TOOLCHAIN=${{ matrix.toolchain }}"
# https://github.com/rust-lang/cmake-rs/pull/259 breaks handling of long Windows paths
# https://github.com/cloudflare/boring/issues/414
# https://github.com/0x676e67/boring/commit/efacedb5bf409d0d773e8ce4f5080cb4b4c10f54
- name: Pin some dependencies, temporary patch for cmake breakage
if: startsWith(matrix.os, 'windows')
run: |
cargo update --package cmake --precise 0.1.54
- name: Run tests (cargo test)
run: cargo test --all-features --workspace
- name: Run doc tests (cargo test)
run: cargo test --doc --all-features --workspace
- name: Run example tests (cargo test)
run: cargo test --all-features --examples --workspace
precheck-rust-tier2:
strategy:
matrix:
thing:
- arm-android
- arm64-android
- i686-android
- x86_64-android
- aarch64-ios
- x86_64-ios
include:
- custom_env: {}
- thing: arm-android
target: armv7-linux-androideabi
rust: stable
os: ubuntu-latest
- thing: arm64-android
target: aarch64-linux-android
rust: stable
os: ubuntu-latest
- thing: i686-android
target: i686-linux-android
rust: stable
os: ubuntu-latest
- thing: x86_64-android
target: x86_64-linux-android
rust: stable
os: ubuntu-latest
- thing: aarch64-ios
target: aarch64-apple-ios
rust: stable
os: macos-latest
custom_env:
IPHONEOS_DEPLOYMENT_TARGET: 17.5
- thing: x86_64-ios
target: x86_64-apple-ios
os: macos-latest
rust: stable
custom_env:
IPHONEOS_DEPLOYMENT_TARGET: 17.5
needs:
- precheck-rust
- precheck-docs
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
with:
env-vars: "RUST_TOOLCHAIN=${{ matrix.rust }}"
key: ${{ matrix.os }}-${{ matrix.rust }}-${{ matrix.target }}
- run: rustup target add ${{ matrix.target }}
- name: Setup Android NDK
if: endsWith(matrix.thing, '-android')
uses: nttld/setup-ndk@v1
with:
ndk-version: r26d
- name: Configure Android toolchain env
if: endsWith(matrix.thing, '-android')
shell: bash
run: |
ANDROID_API=21
TOOLCHAIN="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin"
echo "${TOOLCHAIN}" >> "$GITHUB_PATH"
TRIPLE="${{ matrix.target }}"
# What Cargo expects for the linker env var name
TARGET_UPPER="$(echo "${TRIPLE}" | tr '[:lower:]-' '[:upper:]_')"
# What cc-rs expects for CC_*/CXX_* env var names
TARGET_LOWER_UNDERSCORES="$(echo "${TRIPLE}" | tr '-' '_' | tr '[:upper:]' '[:lower:]')"
# What the NDK clang wrapper is called
NDK_TRIPLE="$(echo "${TRIPLE}" | sed 's/^armv7/armv7a/')"
echo "CARGO_TARGET_${TARGET_UPPER}_LINKER=${TOOLCHAIN}/${NDK_TRIPLE}${ANDROID_API}-clang++" >> "$GITHUB_ENV"
echo "CC_${TARGET_LOWER_UNDERSCORES}=${TOOLCHAIN}/${NDK_TRIPLE}${ANDROID_API}-clang" >> "$GITHUB_ENV"
echo "CXX_${TARGET_LOWER_UNDERSCORES}=${TOOLCHAIN}/${NDK_TRIPLE}${ANDROID_API}-clang++" >> "$GITHUB_ENV"
echo "AR_${TARGET_LOWER_UNDERSCORES}=${TOOLCHAIN}/llvm-ar" >> "$GITHUB_ENV"
- name: check
env: ${{ matrix.custom_env }}
run: |
cargo check --workspace --target ${{ matrix.target }} --all-features
- name: Build tests
env: ${{ matrix.custom_env }}
# We `build` because we want the linker to verify we are cross-compiling correctly for check-only targets.
run: |
cargo build --target ${{ matrix.target }} --tests --all-features
test-rust-extra:
runs-on: ubuntu-latest
needs:
- precheck-rust
- precheck-docs
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{env.RUST_TOOLCHAIN}}
- uses: Swatinem/rust-cache@v2
with:
env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}"
key: ubuntu-latest-${{env.RUST_TOOLCHAIN}}
# Extra: Loom Tests
- name: Run Loom tests (rama-utils)
run: |
RUSTFLAGS="--cfg loom -Dwarnings" \
cargo test --all-features -p rama-utils
# Extra: Cargo Hack
- name: install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: cargo hack check
run: cargo hack check --each-feature --no-dev-deps --workspace
# Extra: Cargo Deny
- name: cargo deny
uses: EmbarkStudios/cargo-deny-action@v2
with:
rust-version: ${{env.RUST_TOOLCHAIN}}
# Extra: sort dependencies (Cargo)
- name: cargo sort (dependencies)
run: |
cargo install cargo-sort 2>/dev/null || true
cargo sort --workspace --grouped --check
test-rust-e2e:
strategy:
matrix:
toolchain:
- stable
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
needs:
- precheck-rust
- precheck-docs
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v6
- uses: ilammy/setup-nasm@v1
if: startsWith(matrix.os, 'windows')
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.toolchain }}
env-vars: "RUST_TOOLCHAIN=${{ matrix.toolchain }}"
# https://github.com/rust-lang/cmake-rs/pull/259 breaks handling of long Windows paths
# https://github.com/cloudflare/boring/issues/414
# https://github.com/0x676e67/boring/commit/efacedb5bf409d0d773e8ce4f5080cb4b4c10f54
- name: Pin some dependencies, temporary patch for cmake breakage
if: startsWith(matrix.os, 'windows')
run: |
cargo update --package cmake --precise 0.1.54
- name: Run tests (--ignored)
run: |
cargo build --all-features --bins --examples
cargo test --all-features --workspace -- --ignored
test-rust-e2e-release:
strategy:
matrix:
toolchain:
- stable
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
needs:
- precheck-rust
- precheck-docs
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v6
- uses: ilammy/setup-nasm@v1
if: startsWith(matrix.os, 'windows')
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.toolchain }}
env-vars: "RUST_TOOLCHAIN=${{ matrix.toolchain }}"
# https://github.com/rust-lang/cmake-rs/pull/259 breaks handling of long Windows paths
# https://github.com/cloudflare/boring/issues/414
# https://github.com/0x676e67/boring/commit/efacedb5bf409d0d773e8ce4f5080cb4b4c10f54
- name: Pin some dependencies, temporary patch for cmake breakage
if: startsWith(matrix.os, 'windows')
run: |
cargo update --package cmake --precise 0.1.54
- name: Run tests in release mode (--ignored)
run: |
cargo build --all-features --release --bins --examples
cargo test --all-features --release --workspace -- --ignored
test-ws-autobahn:
runs-on: ubuntu-latest
needs:
- precheck-rust
- precheck-docs
timeout-minutes: 90
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- uses: Swatinem/rust-cache@v2
with:
key: ubuntu-latest-${{ env.RUST_TOOLCHAIN }}
env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}"
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Run autobahn ws server test-suite
shell: bash
working-directory: "./rama-ws"
run: ./autobahn/server.sh
- name: Run autobahn ws client test-suite
shell: bash
working-directory: "./rama-ws"
run: ./autobahn/client.sh
fuzz-rust:
runs-on: ubuntu-latest
needs:
- precheck-rust
- precheck-docs
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: ${{env.RUST_TOOLCHAIN_NIGHTLY}}
- name: Install cargo-fuzz
run: |
cargo install cargo-fuzz 2>/dev/null || true
- name: fuzz — ua_parse
run: |
cargo +nightly fuzz run ua_parse -- -max_len=131072 -max_total_time=30
- name: fuzz — http_header_x_robots_tag
run: |
cargo +nightly fuzz run http_header_x_robots_tag -- -max_len=131072 -max_total_time=30
- name: fuzz — h2
run: |
cargo +nightly fuzz run h2_client -- -max_total_time=30
cargo +nightly fuzz run h2_e2e -- -max_total_time=30
cargo +nightly fuzz run h2_hpack -- -max_total_time=30
test-spec-h2:
runs-on: ubuntu-latest
needs:
- precheck-rust
- precheck-docs
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{env.RUST_TOOLCHAIN}}
- name: h2spec
run: |
bash rama-http-core/ci/h2spec.sh -F
semver-checks:
runs-on: ubuntu-latest
needs:
- precheck-rust
- precheck-docs
steps:
- uses: actions/checkout@v6
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
rust-toolchain: ${{env.RUST_TOOLCHAIN}}
deploy-rama-cli-docker:
runs-on: ubuntu-latest
needs:
- precheck-rust-tier2
- test-rust-base
- test-rust-extra
- test-rust-e2e
- test-ws-autobahn
- fuzz-rust
- test-spec-h2
- semver-checks
if: github.ref == 'refs/heads/main'
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: glendc/rama:edge
file: rama-cli/infra/Dockerfile
deploy-rama-fp-fly:
runs-on: ubuntu-latest
needs: deploy-rama-cli-docker
steps:
- uses: actions/checkout@v6
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: |
cd rama-fp/infra/deployments/fp
flyctl deploy --verbose --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
deploy-rama-fp-h1-fly:
runs-on: ubuntu-latest
needs: deploy-rama-cli-docker
steps:
- uses: actions/checkout@v6
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: |
cd rama-fp/infra/deployments/fp-h1
flyctl deploy --verbose --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
deploy-rama-ip-ipv4-fly:
runs-on: ubuntu-latest
needs: deploy-rama-cli-docker
steps:
- uses: actions/checkout@v6
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: |
cd rama-fp/infra/deployments/ipv4
flyctl deploy --verbose --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
deploy-rama-ip-ipv6-fly:
runs-on: ubuntu-latest
needs: deploy-rama-cli-docker
steps:
- uses: actions/checkout@v6
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: |
cd rama-fp/infra/deployments/ipv6
flyctl deploy --verbose --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
deploy-rama-echo-fly:
runs-on: ubuntu-latest
needs: deploy-rama-cli-docker
steps:
- uses: actions/checkout@v6
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: |
cd rama-fp/infra/deployments/echo
flyctl deploy --verbose --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
deploy-rama-http-test-fly:
runs-on: ubuntu-latest
needs: deploy-rama-cli-docker
steps:
- uses: actions/checkout@v6
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: |
cd rama-fp/infra/deployments/http-test
flyctl deploy --verbose --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}