Files
ramfoxanddependabot[bot] 3e9a854c32 chore(*): dependabot updates (#4652)
This PR rolls up the following dependabot PRs:

- #4632: chore(deps): bump proptest from 1.11.0 to 1.12.0
- #4633: chore(deps): bump redb from 4.3.0 to 4.4.0
- #4634: chore(deps): bump the github-actions group across 1 directory
with 4 updates
- #4648: chore(deps): bump portmapper from 0.19.3 to 0.20.0
- #4649: chore(deps): bump base64-url from 3.0.4 to 4.0.0
- #4650: chore(deps): bump lru from 0.18.4 to 0.19.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-05 13:23:33 +00:00

353 lines
11 KiB
YAML

name: netsim-runner
on:
workflow_dispatch:
inputs:
branch:
required: true
type: string
max_workers:
required: true
type: number
default: 4
netsim_branch:
required: true
type: string
default: "main"
rust_log:
description: "Custom RUST_LOG value (e.g. 'iroh=debug,noq=trace'). If empty, defaults to warn."
required: false
type: string
default: ""
build_profile:
required: false
type: string
default: "release"
sim_paths:
required: false
type: string
default: "sims/iroh,sims/integration"
publish_metrics:
required: false
type: boolean
default: false
pr_number:
required: false
type: string
default: ""
report_table:
required: false
type: boolean
default: false
filter:
description: "Test filter: 'skip:test1,test2' to exclude or 'only:test1,test2' to run exclusively"
required: false
type: string
default: ""
workflow_call:
inputs:
branch:
required: true
type: string
max_workers:
required: true
type: number
default: 4
netsim_branch:
required: true
type: string
default: "main"
rust_log:
description: "Custom RUST_LOG value (e.g. 'iroh=debug,noq=trace'). If empty, defaults to warn."
required: false
type: string
default: ""
build_profile:
required: false
type: string
default: "release"
sim_paths:
required: false
type: string
default: "sims/iroh,sims/integration"
publish_metrics:
required: false
type: boolean
default: false
pr_number:
required: false
type: string
default: ""
report_table:
required: false
type: boolean
default: false
filter:
description: "Test filter: 'skip:test1,test2' to exclude or 'only:test1,test2' to run exclusively. No prefix defaults to only."
required: false
type: string
default: ""
secrets:
S3_ACCESS_KEY_ID:
required: false
S3_ACCESS_KEY:
required: false
S3_BUCKET:
required: false
S3_REPORT_BUCKET:
required: false
METRO_TOKEN:
required: false
METRO_ENDPOINT:
required: false
env:
RUST_BACKTRACE: 1
RUSTFLAGS: -Dwarnings
MSRV: "1.66"
# SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
IROH_FORCE_STAGING_RELAYS: "1"
# Default to read-only; jobs that need more grant it explicitly.
permissions:
contents: read
jobs:
netsim:
permissions:
contents: read
pull-requests: write # posts the report comment
name: Netsim
timeout-minutes: 45
runs-on: [self-hosted, linux, X64]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: recursive
ref: ${{ inputs.branch }}
- name: Install rust stable
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: stable
- name: Install sccache
uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
continue-on-error: true
- uses: $/.github/workflows/sccache-probe
- name: Build iroh
env:
BUILD_PROFILE: ${{ inputs.build_profile }}
run: |
cargo build --locked --profile "$BUILD_PROFILE" --workspace --all-features --examples --bins
- name: Fetch netsim
env:
NETSIM_BRANCH: ${{ inputs.netsim_branch }}
GH_TOKEN: ${{ github.token }}
run: |
cd ..
rm -rf chuck
git clone --depth 1 --single-branch --branch "$NETSIM_BRANCH" https://github.com/n0-computer/chuck.git
- name: Install netsim deps
run: |
cd ../chuck/netsim
sudo apt update
./setup.sh
./cleanup.sh || true
- name: Copy sim configs
run: |
cp -r .github/sims/iroh/ ../chuck/netsim/sims/iroh/
cp -r .github/sims/integration/ ../chuck/netsim/sims/integration/
cp -r .github/sims/paused/ ../chuck/netsim/sims/paused/
- name: Copy binaries to right location
env:
BUILD_PROFILE: ${{ inputs.build_profile }}
run: |
cp "target/$BUILD_PROFILE/examples/"* ../chuck/netsim/bins/
cp "target/$BUILD_PROFILE/examples/transfer" ../chuck/netsim/bins/iroh-transfer
cp "target/$BUILD_PROFILE/iroh-relay" ../chuck/netsim/bins/iroh-relay
cp "target/$BUILD_PROFILE/iroh-dns-server" ../chuck/netsim/bins/iroh-dns-server
- name: Get commit sha
shell: bash
run: |
echo "LAST_COMMIT_SHA=$(git rev-parse --short ${GITHUB_SHA})" >> ${GITHUB_ENV}
- name: Run tests
id: run_tests
continue-on-error: true
env:
SIM_PATHS: ${{ inputs.sim_paths }}
RUST_LOG_INPUT: ${{ inputs.rust_log }}
FILTER: ${{ inputs.filter }}
MAX_WORKERS: ${{ inputs.max_workers }}
run: |
cd ../chuck/netsim
IFS=',' read -ra sim_paths <<< "$SIM_PATHS"
filter_flag=""
if [[ -n "$FILTER" ]]; then
if [[ "$FILTER" == skip:* ]]; then
filter_flag="--skip=${FILTER#skip:}"
elif [[ "$FILTER" == only:* ]]; then
filter_flag="--only=${FILTER#only:}"
else
filter_flag="--only=$FILTER"
fi
fi
for sim_path in "${sim_paths[@]}"; do
if [[ -n "$RUST_LOG_INPUT" ]]; then
sudo RUST_LOG="$RUST_LOG_INPUT" python3 main.py ${filter_flag} --max-workers="$MAX_WORKERS" --integration "$sim_path"
else
sudo python3 main.py ${filter_flag} --max-workers="$MAX_WORKERS" --integration "$sim_path"
fi
done
- name: Generate report
id: generate_report
if: always()
run: |
cd ../chuck/netsim
python3 reports_csv.py --table > report_table.txt
python3 reports_csv.py --prom --commit "$LAST_COMMIT_SHA" > report_prom.txt
python3 reports_csv.py --metro --commit "$LAST_COMMIT_SHA" > report_metro.txt
python3 reports_csv.py --metro --integration --commit "$LAST_COMMIT_SHA" > report_metro_integration.txt
- name: Cache AWS CLI
if: always()
id: cache-awscli
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/awscli
key: awscli-${{ runner.os }}-${{ runner.arch }}-v2
- name: Download awscli
if: always() && steps.cache-awscli.outputs.cache-hit != 'true'
run: |
mkdir -p ~/awscli
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o ~/awscli/awscliv2.zip
cd ~/awscli && unzip -oq awscliv2.zip
- name: Install awscli
if: always()
run: sudo ~/awscli/aws/install --update
- name: Upload report
if: always()
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-west-2
S3_BUCKET: ${{ secrets.S3_BUCKET }}
S3_REPORT_BUCKET: ${{ secrets.S3_REPORT_BUCKET }}
run: |
cd ../chuck/netsim
aws_fname="$LAST_COMMIT_SHA.tar.gz"
tar -cvzf report.tar.gz report_prom.txt report_table.txt report_metro.txt report_metro_integration.txt logs/ report/ viz/
if [[ -n "$S3_BUCKET" ]]; then
aws s3 cp ./report.tar.gz "s3://$S3_REPORT_BUCKET/$aws_fname" --no-progress
fi
- name: Move report
if: always()
run: |
cp ../chuck/netsim/report.tar.gz ./report.tar.gz
- name: Upload report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
id: upload-report
with:
name: netsim-report-${{ env.LAST_COMMIT_SHA }}
path: report.tar.gz
retention-days: 3
overwrite: true
- name: Fail Job if Tests Failed
if: ${{ steps.run_tests.outcome == 'failure' }}
env:
REPORT_URL: ${{ steps.upload-report.outputs.artifact-url }}
run: |
echo "Tests failed. Report: $REPORT_URL"
echo ""
if [ -f ../chuck/netsim/logs/failed_tests.txt ]; then
echo "=== FAILED TESTS ==="
cat ../chuck/netsim/logs/failed_tests.txt
fi
exit 1
- name: Find Docs Comment
if: ${{ inputs.pr_number != '' }}
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4.0.0
id: fc
with:
issue-number: ${{ inputs.pr_number }}
comment-author: 'github-actions[bot]'
body-includes: Netsim report & logs for this PR have been generated
- name: Create or Update Docs Comment
if: ${{ inputs.pr_number != '' && !github.event.pull_request.head.repo.fork }}
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
issue-number: ${{ inputs.pr_number }}
comment-id: ${{ steps.fc.outputs.comment-id }}
body: |
Netsim report & logs for this PR have been generated and is available at: [LOGS](${{steps.upload-report.outputs.artifact-url}})
This report will remain available for 3 days.
Last updated for commit: ${{ env.LAST_COMMIT_SHA }}
edit-mode: replace
- name: Generate report table
if: ${{ inputs.pr_number != '' && inputs.report_table}}
id: generate_report_table
run: |
cd ../chuck/netsim
export NETSIM_REPORT=$(cat report_table.txt)
echo "NETSIM_REPORT<<EOFMARKER" >> ${GITHUB_OUTPUT}
echo "${NETSIM_REPORT}" >> ${GITHUB_OUTPUT}
echo "EOFMARKER" >> ${GITHUB_OUTPUT}
- name: Echo Report Table on PR
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
if: ${{ inputs.pr_number != '' && inputs.report_table && !github.event.pull_request.head.repo.fork }}
with:
issue-number: ${{ inputs.pr_number }}
body: |
`${{ inputs.branch }}.${{ env.LAST_COMMIT_SHA }}`
Perf report:
${{ steps.generate_report_table.outputs.NETSIM_REPORT }}
- name: Publish metrics
if: ${{ inputs.publish_metrics && !github.event.pull_request.head.repo.fork }}
run: |
cd ../chuck/netsim
d=$(cat report_metro.txt)
metro_data=$(printf "%s\n " "$d")
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${{secrets.METRO_TOKEN}}" --data "$metro_data" ${{secrets.METRO_ENDPOINT}}
d=$(cat report_metro_integration.txt)
metro_data=$(printf "%s\n " "$d")
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${{secrets.METRO_TOKEN}}" --data "$metro_data" ${{secrets.METRO_ENDPOINT}}
- name: Echo metrics (debug)
run: |
cd ../chuck/netsim
d=$(cat report_metro.txt)
metro_data=$(printf "%s\n " "$d")
echo "$metro_data"
d=$(cat report_metro_integration.txt)
metro_data=$(printf "%s\n " "$d")
echo "$metro_data"
- name: Cleanup
run: |
./cleanup.sh || true