Files

296 lines
15 KiB
YAML

name: Weekly
on:
schedule:
- cron: '23 4 * * 1'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.event_name == 'pull_request' && format('ci-{0}-pr-{1}', github.workflow, github.event.pull_request.number) || format('ci-{0}-{1}', github.workflow, github.run_id) }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CARGO_TERM_COLOR: always
jobs:
toolchain-preview:
runs-on: ubuntu-24.04
timeout-minutes: 40
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: stable
components: rustfmt, clippy
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: nightly
components: rust-src, llvm-tools
- name: Record preview compilers
id: versions
run: |
set -euo pipefail
rustc +stable -V | tee -a "$GITHUB_STEP_SUMMARY"
rustc +nightly -V | tee -a "$GITHUB_STEP_SUMMARY"
echo "stable=$(rustc +stable -V)" >> "$GITHUB_OUTPUT"
echo "nightly=$(rustc +nightly -V)" >> "$GITHUB_OUTPUT"
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: toolchain-preview-${{ steps.versions.outputs.stable }}-${{ steps.versions.outputs.nightly }}
cache-on-failure: true
save-if: ${{ github.event_name != 'pull_request' }}
workspaces: |
. -> target
crates/honk-ebpf -> target
- uses: taiki-e/install-action@073e1fd0bc889c9aee68dbaaa927cde1b5653a83 # v2.90.11
with:
tool: nextest
- name: Install build dependencies
run: |
set -euo pipefail
sudo grep -lE 'dl\.google\.com|packages\.microsoft\.com' /etc/apt/sources.list.d/* | xargs -r sudo rm -f || true
sudo apt-get -o Acquire::Retries=5 update
sudo apt-get -o Acquire::Retries=5 install -y cmake libclang-dev clang llvm zstd
- name: Install geo assets for the geosite tests
run: |
set -euo pipefail
source .github/ci/pins.env
geo_dir="$RUNNER_TEMP/geo-assets"
mkdir -p "$geo_dir"
if ! test -f "$geo_dir/geosite.dat"; then
curl -fsSL --retry 5 --retry-all-errors --retry-delay 5 -o "$geo_dir/geosite.dat" \
"https://github.com/v2fly/domain-list-community/releases/download/$GEOSITE_TAG/dlc.dat"
fi
if ! test -f "$geo_dir/geoip.dat"; then
curl -fsSL --retry 5 --retry-all-errors --retry-delay 5 -o "$geo_dir/geoip.dat" \
"https://github.com/v2fly/geoip/releases/download/$GEOIP_TAG/geoip.dat"
fi
echo "$GEOSITE_SHA256 $geo_dir/geosite.dat" | sha256sum -c -
echo "$GEOIP_SHA256 $geo_dir/geoip.dat" | sha256sum -c -
sudo install -D -m 0644 "$geo_dir/geosite.dat" /etc/dae/geosite.dat
sudo install -D -m 0644 "$geo_dir/geoip.dat" /etc/dae/geoip.dat
- name: Install pinned bpf-linker
run: |
set -euo pipefail
source .github/ci/pins.env
curl -fsSL --retry 5 --retry-all-errors --retry-delay 5 -o "$RUNNER_TEMP/bpf-linker.tar.zst" \
"https://github.com/aya-rs/bpf-linker/releases/download/v$BPF_LINKER_VERSION/bpf-linker-x86_64-unknown-linux-musl.tar.zst"
echo "$BPF_LINKER_SHA256 $RUNNER_TEMP/bpf-linker.tar.zst" | sha256sum -c -
zstd -dc "$RUNNER_TEMP/bpf-linker.tar.zst" | tar -xf - -C "$CARGO_HOME/bin"
bpf-linker --version
# Floating selectors deliberately bypass the repository pins to expose drift.
- run: cargo +stable fmt --all -- --check
- run: cargo +stable clippy --all --all-targets --features honk-core/udp-bench,honk-core/dns-bench -- -D warnings
- run: cargo +stable nextest run --workspace --profile ci
- name: Upload preview JUnit
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: toolchain-preview-junit
path: target/nextest/ci/junit.xml
- name: Build the object with current nightly
working-directory: crates/honk-ebpf
run: |
set -euo pipefail
cargo +nightly build --release -Zbuild-std=core --target bpfel-unknown-none
readelf -S target/bpfel-unknown-none/release/honk-ebpf | grep '\.BTF'
public-vless-loopback:
name: Public VLESS and shared-source loopback interop (5 cases)
runs-on: ubuntu-24.04
timeout-minutes: 40
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Read Rust toolchain
id: toolchain
run: echo "stable=$(grep -oP '^channel\s*=\s*\"\K[^\"]+' rust-toolchain.toml)" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: ${{ steps.toolchain.outputs.stable }}
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: public-vless-loopback-${{ steps.toolchain.outputs.stable }}
cache-on-failure: true
save-if: ${{ github.event_name != 'pull_request' }}
- uses: taiki-e/install-action@073e1fd0bc889c9aee68dbaaa927cde1b5653a83 # v2.90.11
with:
tool: nextest
- name: Install build and archive dependencies
run: |
set -euo pipefail
sudo grep -lE 'dl\.google\.com|packages\.microsoft\.com' /etc/apt/sources.list.d/* | xargs -r sudo rm -f || true
sudo apt-get -o Acquire::Retries=5 update
sudo apt-get -o Acquire::Retries=5 install -y cmake libclang-dev unzip
- name: Install pinned official Xray prerelease and sing-box
run: |
set -euo pipefail
source .github/ci/pins.env
tools="$RUNNER_TEMP/public-vless-interop"
mkdir -p "$tools"
curl -fsSL --retry 5 --retry-all-errors --retry-delay 5 -o "$tools/Xray-linux-64.zip" \
"https://github.com/XTLS/Xray-core/releases/download/v$XRAY_VERSION/Xray-linux-64.zip"
curl -fsSL --retry 5 --retry-all-errors --retry-delay 5 -o "$tools/sing-box.tar.gz" \
"https://github.com/SagerNet/sing-box/releases/download/v$SING_BOX_VERSION/sing-box-$SING_BOX_VERSION-linux-amd64-musl.tar.gz"
echo "$XRAY_SHA256 $tools/Xray-linux-64.zip" | sha256sum -c -
echo "$SING_BOX_SHA256 $tools/sing-box.tar.gz" | sha256sum -c -
unzip -j "$tools/Xray-linux-64.zip" xray -d "$tools"
tar -xzf "$tools/sing-box.tar.gz" -C "$tools" --strip-components=1 \
"sing-box-$SING_BOX_VERSION-linux-amd64-musl/sing-box"
HONK_XRAY_BIN=$(realpath "$tools/xray")
HONK_SING_BOX_BIN=$(realpath "$tools/sing-box")
test -x "$HONK_XRAY_BIN"
test -x "$HONK_SING_BOX_BIN"
echo "HONK_XRAY_BIN=$HONK_XRAY_BIN" >> "$GITHUB_ENV"
echo "HONK_SING_BOX_BIN=$HONK_SING_BOX_BIN" >> "$GITHUB_ENV"
printf 'Official Xray prerelease v%s; sing-box v%s\n' "$XRAY_VERSION" "$SING_BOX_VERSION" | tee -a "$GITHUB_STEP_SUMMARY"
"$HONK_XRAY_BIN" version | tee -a "$GITHUB_STEP_SUMMARY"
"$HONK_SING_BOX_BIN" version | tee -a "$GITHUB_STEP_SUMMARY"
- name: Enable loopback IPv6 and low ports on the ephemeral runner
run: |
set -euo pipefail
test "${{ runner.environment }}" = github-hosted
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 net.ipv6.conf.lo.disable_ipv6=0 net.ipv4.ip_unprivileged_port_start=0
ip -6 address show dev lo scope host | grep -F '::1/128'
- name: Run exactly three public ignored loopback cases
run: |
set -euo pipefail
test -x "$HONK_XRAY_BIN"
test -x "$HONK_SING_BOX_BIN"
ci/run-exact-ignored-tests.sh --test vless_udp \
official_xray_and_sing_box_vless_udp_loopback_interop \
'chain::official_xray_carries_auto_udp_through_a_chain' \
'reality::official_xray_reality_authenticates_first_connection_and_rejects_wrong_key'
- name: Run the official Vision uplink Direct case
run: |
set -euo pipefail
ci/run-exact-ignored-tests.sh --lib \
proxy::vless::handler::tests::interop::official_vision_peers_switch_inner_tls_to_direct
- name: Run the shared-source sing-box interop matrix
run: |
set -euo pipefail
test -x "$HONK_SING_BOX_BIN"
ci/run-exact-ignored-tests.sh --test shared_source_sing_box \
sing_box_shared_source_eim_eif_and_domain_matrix
- name: Upload public loopback JUnit
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: public-vless-loopback-junit
path: target/nextest/ci/junit.xml
pins:
runs-on: ubuntu-24.04
timeout-minutes: 40
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Fetch and verify every pinned download without caches
run: |
set -euo pipefail
source .github/ci/pins.env
downloads=$(mktemp -d "$RUNNER_TEMP/pins.XXXXXX")
trap 'rm -rf "$downloads"' EXIT
fetch() {
local url=$1 sha256=$2 name=$3
curl -fsSL --retry 5 --retry-all-errors --retry-delay 5 -H 'Cache-Control: no-cache' -o "$downloads/$name" "$url"
printf '%s %s\n' "$sha256" "$downloads/$name" | sha256sum -c -
}
fetch "https://github.com/v2fly/domain-list-community/releases/download/$GEOSITE_TAG/dlc.dat" "$GEOSITE_SHA256" geosite.dat
fetch "https://github.com/v2fly/geoip/releases/download/$GEOIP_TAG/geoip.dat" "$GEOIP_SHA256" geoip.dat
fetch "https://github.com/aya-rs/bpf-linker/releases/download/v$BPF_LINKER_VERSION/bpf-linker-x86_64-unknown-linux-musl.tar.zst" "$BPF_LINKER_SHA256" bpf-linker.tar.zst
fetch "$VIRTME_NG_WHEEL_URL" "$VIRTME_NG_SHA256" virtme-ng.whl
fetch "https://github.com/XTLS/Xray-core/releases/download/v$XRAY_VERSION/Xray-linux-64.zip" "$XRAY_SHA256" Xray-linux-64.zip
fetch "https://github.com/SagerNet/sing-box/releases/download/v$SING_BOX_VERSION/sing-box-$SING_BOX_VERSION-linux-amd64-musl.tar.gz" "$SING_BOX_SHA256" sing-box.tar.gz
fetch "https://github.com/juicity/juicity-rs/releases/download/v$JUICITY_VERSION/juicity-x86_64-unknown-linux-musl.zip" "$JUICITY_SHA256" juicity.zip
fetch "$KERNEL_FLOOR_BASE/$KERNEL_FLOOR_IMAGE" "$KERNEL_FLOOR_IMAGE_SHA256" "$KERNEL_FLOOR_IMAGE"
fetch "$KERNEL_FLOOR_BASE/$KERNEL_FLOOR_MODULES" "$KERNEL_FLOOR_MODULES_SHA256" "$KERNEL_FLOOR_MODULES"
fetch "$KERNEL_RECENT_BASE/$KERNEL_RECENT_IMAGE" "$KERNEL_RECENT_IMAGE_SHA256" "$KERNEL_RECENT_IMAGE"
fetch "$KERNEL_RECENT_BASE/$KERNEL_RECENT_MODULES" "$KERNEL_RECENT_MODULES_SHA256" "$KERNEL_RECENT_MODULES"
advisories:
runs-on: ubuntu-24.04
timeout-minutes: 40
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Read Rust toolchain
id: toolchain
run: echo "stable=$(grep -oP '^channel\s*=\s*\"\K[^\"]+' rust-toolchain.toml)" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: ${{ steps.toolchain.outputs.stable }}
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: advisories-${{ steps.toolchain.outputs.stable }}
cache-on-failure: true
save-if: ${{ github.event_name != 'pull_request' }}
- uses: taiki-e/install-action@073e1fd0bc889c9aee68dbaaa927cde1b5653a83 # v2.90.11
with:
tool: cargo-audit
- run: cargo audit
fuzz:
runs-on: ubuntu-24.04
timeout-minutes: 40
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/fuzz/target
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Read pinned fuzz toolchain
id: toolchain
run: echo "nightly=$(grep -oP '^channel\s*=\s*\"\K[^\"]+' crates/honk-ebpf/rust-toolchain.toml)" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: ${{ steps.toolchain.outputs.nightly }}
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: fuzz-${{ steps.toolchain.outputs.nightly }}
workspaces: fuzz -> target
cache-on-failure: true
- name: Install clang and pinned cargo-fuzz
env:
FUZZ_NIGHTLY: ${{ steps.toolchain.outputs.nightly }}
run: |
set -euo pipefail
sudo grep -lE 'dl\.google\.com|packages\.microsoft\.com' /etc/apt/sources.list.d/* | xargs -r sudo rm -f || true
sudo apt-get -o Acquire::Retries=5 update
sudo apt-get -o Acquire::Retries=5 install -y clang
source .github/ci/pins.env
cargo +"$FUZZ_NIGHTLY" install --locked "cargo-fuzz@$CARGO_FUZZ_VERSION"
rustc +"$FUZZ_NIGHTLY" -V | tee -a "$GITHUB_STEP_SUMMARY"
cargo +"$FUZZ_NIGHTLY" fuzz --version | tee -a "$GITHUB_STEP_SUMMARY"
- name: Fuzz parser inputs
working-directory: fuzz
env:
FUZZ_NIGHTLY: ${{ steps.toolchain.outputs.nightly }}
run: |
set -euo pipefail
failed=0
# New inputs go to a scratch directory (libFuzzer writes to the first
# corpus argument); the committed seeds under fuzz/corpus stay seeds.
for target in document share_link lexer; do
mkdir -p "$RUNNER_TEMP/fuzz-grown/$target"
if cargo +"$FUZZ_NIGHTLY" fuzz run "$target" \
"$RUNNER_TEMP/fuzz-grown/$target" "corpus/$target" -- \
-jobs=2 -workers=2 -max_total_time=480 -timeout=10 -rss_limit_mb=2048; then
echo "- $target: completed the 480-second run" >> "$GITHUB_STEP_SUMMARY"
else
echo "- $target: failed; inspect fuzz-inputs and the job log" >> "$GITHUB_STEP_SUMMARY"
failed=1
fi
done
exit "$failed"
- name: Upload fuzz findings and corpus
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: fuzz-inputs
path: |
fuzz/artifacts/
fuzz/corpus/
${{ runner.temp }}/fuzz-grown/
fuzz/*.log
retention-days: 30
if-no-files-found: error