Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/mozilla/neqo into qns-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden committed Mar 6, 2024
2 parents c10ce08 + 0f042a3 commit 6033c63
Show file tree
Hide file tree
Showing 125 changed files with 391 additions and 364 deletions.
6 changes: 0 additions & 6 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
* @KershawChang @martinthomson @larseggert
/docker/ @martinthomson
/hooks/ @martinthomson
/neqo-crypto/ @martinthomson
/neqo-http3/ @KershawChang
/neqo-qpack/ @KershawChang
/qns/ @martinthomson
18 changes: 8 additions & 10 deletions .github/actions/nss/action.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
name: Checkout NSS and NSPR
name: Fetch and build NSS

runs:
using: composite
steps:
- name: Fetch NSS and NSPR
- name: Fetch and build NSS
shell: bash
run: |
for i in {1..$RETRIES}; do
hg clone https://hg.mozilla.org/projects/nspr "$NSPR_DIR" && break || sleep $DELAY && false
done
for i in {1..$RETRIES}; do
hg clone https://hg.mozilla.org/projects/nss "$NSS_DIR" && break || sleep $DELAY && false
done
git clone --depth=1 https://github.com/nss-dev/nspr "$NSPR_DIR"
git clone --depth=1 https://github.com/nss-dev/nss "$NSS_DIR"
$NSS_DIR/build.sh -g -Ddisable_tests=1 -o
echo "NSS_DIR=$NSS_DIR" >> "$GITHUB_ENV"
echo "NSPR_DIR=$NSPR_DIR" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$NSS_DIR/../dist/Release/lib" >> "$GITHUB_ENV"
echo "DYLD_FALLBACK_LIBRARY_PATH=$NSS_DIR/../dist/Release/lib" >> "$GITHUB_ENV"
echo "$NSS_DIR/../dist/Release/lib" >> "$GITHUB_PATH"
env:
NSS_DIR: ${{ github.workspace }}/nss
NSPR_DIR: ${{ github.workspace }}/nspr
RETRIES: 10
DELAY: 10
23 changes: 17 additions & 6 deletions .github/actions/rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,22 @@ runs:
toolchain: ${{ inputs.version }}
components: ${{ inputs.components }}

- name: Use sccache
uses: mozilla-actions/[email protected]
- name: Install cargo-binstall (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: Set-ExecutionPolicy Unrestricted -Scope Process; iex (iwr "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1").Content

- name: Enable sscache
- name: Install cargo-binstall (Windows)
if: runner.os != 'Windows'
shell: bash
run: |
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash

- name: Install Rust tools
shell: bash
run: cargo +${{ inputs.version }} binstall --no-confirm cargo-llvm-cov cargo-nextest flamegraph cargo-hack

- name: Use Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
cache-directories: "${{ github.workspace }}/dist"
13 changes: 5 additions & 8 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,25 @@ jobs:
defaults:
run:
shell: bash
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/dist/Release/lib

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set PATH
run: echo "/home/bench/.cargo/bin" >> "${GITHUB_PATH}"

- name: Install Rust
uses: ./.github/actions/rust
with:
version: $TOOLCHAIN
components: rustfmt

- name: Configure Rust
run: cargo install flamegraph

- name: Fetch NSS and NSPR
- name: Fetch and build NSS and NSPR
uses: ./.github/actions/nss

- name: Build
run: |
$NSS_DIR/build.sh -g -Ddisable_tests=1 -o
cargo +$TOOLCHAIN bench --features bench --no-run
cargo +$TOOLCHAIN build --release --bin neqo-client --bin neqo-server
Expand Down Expand Up @@ -142,7 +139,7 @@ jobs:
- name: Archive perf data
uses: actions/upload-artifact@v4
with:
name: ${{ github.head_ref || github.ref_name }}-perf
name: ${{ github.event.repository.name }}-${{ github.sha }}
path: |
*.svg
*.perf
Expand Down
45 changes: 16 additions & 29 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
branches: ["main"]
paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"]
merge_group:
branches: ["main"]
paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
Expand Down Expand Up @@ -54,8 +52,7 @@ jobs:
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get install -y --no-install-recommends gyp mercurial ninja-build lld
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
sudo apt-get install -y --no-install-recommends gyp ninja-build lld
echo "RUSTFLAGS=-C link-arg=-fuse-ld=lld" >> "$GITHUB_ENV"
# In addition to installing dependencies, first make sure System Integrity Protection (SIP)
Expand All @@ -67,7 +64,7 @@ jobs:
if: runner.os == 'MacOS'
run: |
csrutil status | grep disabled
brew install ninja mercurial cargo-binstall llvm
brew install ninja llvm
echo "/opt/homebrew/opt/llvm/bin" >> "$GITHUB_PATH"
ln -s /opt/homebrew/bin/python3 /opt/homebrew/bin/python
# python3 -m pip install gyp-next
Expand All @@ -78,11 +75,6 @@ jobs:
echo "$(python3 -m site --user-base)/bin" >> "$GITHUB_PATH"
echo "RUSTFLAGS=-C link-arg=-fuse-ld=lld" >> "$GITHUB_ENV"
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: Set-ExecutionPolicy Unrestricted -Scope Process; iex (iwr "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1").Content

- name: Use MSYS2 environment and install more dependencies (Windows)
if: runner.os == 'Windows'
run: |
Expand All @@ -97,17 +89,6 @@ jobs:
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Install Rust tools
run: cargo +${{ matrix.rust-toolchain }} binstall --no-confirm cargo-llvm-cov cargo-nextest

# This step might be removed if the distro included a recent enough
# version of NSS. Ubuntu 20.04 only has 3.49, which is far too old.
# (neqo-crypto/build.rs would also need to query pkg-config to get the
# right build flags rather than building NSS.)
# Clone from the main hg repo, because the GitHub mirror can be out of date.
- name: Fetch NSS and NSPR
uses: ./.github/actions/nss

- name: Set up NSS/NSPR build environment (Windows)
if: runner.os == 'Windows'
run: |
Expand All @@ -117,14 +98,15 @@ jobs:
# See https://github.com/ilammy/msvc-dev-cmd#name-conflicts-with-shell-bash
rm /usr/bin/link.exe
# This step might be removed if the distro included a recent enough
# version of NSS. Ubuntu 20.04 only has 3.49, which is far too old.
# (neqo-crypto/build.rs would also need to query pkg-config to get the
# right build flags rather than building NSS.)
- name: Fetch and build NSS and NSPR
uses: ./.github/actions/nss

- name: Build
run: |
cargo +${{ matrix.rust-toolchain }} build $BUILD_TYPE --all-targets --features ci,bench
echo "LD_LIBRARY_PATH=${{ github.workspace }}/dist/$LIB_DIR/lib" >> "$GITHUB_ENV"
echo "DYLD_FALLBACK_LIBRARY_PATH=${{ github.workspace }}/dist/$LIB_DIR/lib" >> "$GITHUB_ENV"
echo "${{ github.workspace }}/dist/$LIB_DIR/lib" >> "$GITHUB_PATH"
env:
LIB_DIR: ${{ matrix.type == 'release' && 'Release' || 'Debug' }}
run: cargo +${{ matrix.rust-toolchain }} build $BUILD_TYPE --all-targets --features ci

- name: Run tests and determine coverage
run: |
Expand Down Expand Up @@ -153,7 +135,12 @@ jobs:
if: success() || failure()

- name: Clippy
run: cargo +${{ matrix.rust-toolchain }} clippy --all-targets -- -D warnings || ${{ matrix.rust-toolchain == 'nightly' }}
run: |
# Use cargo-hack to run clippy on each crate individually with its
# respective default features only. Can reveal warnings otherwise
# hidden given that a plain cargo clippy combines all features of the
# workspace. See e.g. https://github.com/mozilla/neqo/pull/1695.
cargo +${{ matrix.rust-toolchain }} hack clippy --all-targets -- -D warnings || ${{ matrix.rust-toolchain == 'nightly' }}
if: success() || failure()

- name: Check rustdoc links
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/qns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
# - 'qns/**'
# - '.github/workflows/qns.yml'
merge_group:
branches: ["main"]

jobs:
quic-network-simulator:
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ members = [
"neqo-transport",
"test-fixture",
]
resolver = "2"

[workspace.package]
homepage = "https://github.com/mozilla/neqo/"
Expand All @@ -21,6 +22,9 @@ license = "MIT OR Apache-2.0"
# https://firefox-source-docs.mozilla.org/writing-rust-code/update-policy.html#schedule
rust-version = "1.74.0"

[workspace.lints.clippy]
pedantic = { level = "warn", priority = -1 }

[profile.bench]
# Inherits from the "release" profile, so just provide overrides here:
# https://doc.rust-lang.org/cargo/reference/profiles.html#release
Expand Down
16 changes: 9 additions & 7 deletions neqo-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ edition.workspace = true
rust-version.workspace = true
license.workspace = true

[lints]
workspace = true

[dependencies]
# neqo-client is not used in Firefox, so we can be liberal with dependency versions
clap = { version = "4.4", features = ["derive"] }
futures = "0.3"
hex = "0.4"
clap = { version = "4.4", default-features = false, features = ["std", "derive"] }
futures = { version = "0.3", default-features = false }
hex = { version = "0.4", default-features = false, features = ["std"] }
log = { version = "0.4", default-features = false }
neqo-common = { path = "./../neqo-common", features = ["udp"] }
neqo-crypto = { path = "./../neqo-crypto" }
neqo-http3 = { path = "./../neqo-http3" }
neqo-qpack = { path = "./../neqo-qpack" }
neqo-transport = { path = "./../neqo-transport" }
qlog = "0.12"
tokio = { version = "1", features = ["net", "time", "macros", "rt", "rt-multi-thread"] }
url = "2.5"

qlog = { version = "0.12", default-features = false }
tokio = { version = "1", default-features = false, features = ["net", "time", "macros", "rt", "rt-multi-thread"] }
url = { version = "2.5", default-features = false }
Loading

0 comments on commit 6033c63

Please sign in to comment.