Skip to content

chore(deps): bump js-sys from 0.3.94 to 0.3.95 in /loom-tests in the cargo-loom-tests group across 1 directory #337

chore(deps): bump js-sys from 0.3.94 to 0.3.95 in /loom-tests in the cargo-loom-tests group across 1 directory

chore(deps): bump js-sys from 0.3.94 to 0.3.95 in /loom-tests in the cargo-loom-tests group across 1 directory #337

Workflow file for this run

name: CI - Benchmarks
# Run benchmarks and track regressions
# Results are stored in GitHub Pages at gh-pages branch (bench/)
# Alerts are posted as commit comments when performance regresses
on:
push:
branches: [main]
paths:
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'benches/**'
- '.github/workflows/ci-benchmarks.yml'
pull_request:
branches: [main]
paths:
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'benches/**'
- '.github/workflows/ci-benchmarks.yml'
workflow_dispatch: # Allow manual runs
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
benchmark:
name: Run Benchmarks
runs-on: ubuntu-latest
permissions:
# Required for github-pages deployment
contents: write
# Required for posting benchmark comments on commits
deployments: write
# Required for posting PR comments (benchmark alerts)
pull-requests: write
# Skip for Dependabot PRs - it doesn't have write permissions for PR comments
if: github.actor != 'dependabot[bot]'
# Use a consistent runner for reproducible results
# Note: Performance may vary between runner hardware revisions
steps:
- uses: actions/checkout@v6
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Configure sccache
id: sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- name: Verify sccache is working
id: sccache-check
if: steps.sccache.outcome == 'success'
run: ./scripts/ci/verify-sccache.sh
continue-on-error: true
- name: Clear sccache env on failure
if: steps.sccache.outcome != 'success' || steps.sccache-check.outcome != 'success'
run: |
echo "RUSTC_WRAPPER=" >> "$GITHUB_ENV"
echo "SCCACHE_GHA_ENABLED=" >> "$GITHUB_ENV"
- name: Cache cargo registry and build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: bench-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
bench-${{ runner.os }}-cargo-
# Run all criterion benchmarks
- name: Run benchmarks
run: cargo bench --bench input_queue --bench p2p_session --bench sync_layer -- --output-format bencher | tee benchmark-results.txt
env:
RUSTC_WRAPPER: ${{ steps.sccache-check.outputs.working == 'true' && 'sccache' || '' }}
SCCACHE_GHA_ENABLED: ${{ steps.sccache-check.outputs.working == 'true' && 'true' || 'false' }}
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
# Increase startup timeout to handle slow GitHub Actions runners
SCCACHE_STARTUP_NOTIFY_TIMEOUT: "60"
SCCACHE_IDLE_TIMEOUT: "0"
# Check if gh-pages branch exists, create it if pushing to main
- name: Check and create gh-pages branch if needed
id: gh-pages-check
run: |
if git ls-remote --exit-code --heads origin gh-pages > /dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
echo "::notice::gh-pages branch does not exist yet."
# Create gh-pages branch on push to main (bootstrap case)
if [ "${{ github.event_name }}" = "push" ]; then
echo "Creating gh-pages branch for benchmark storage..."
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout --orphan gh-pages
git reset --hard
git commit --allow-empty -m "Initialize gh-pages branch for benchmarks"
git push origin gh-pages
git checkout main
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "::notice::gh-pages branch created successfully."
fi
fi
# Store benchmark results and detect regressions
# Uses github-action-benchmark: https://github.com/benchmark-action/github-action-benchmark
- name: Store benchmark results
if: steps.gh-pages-check.outputs.exists == 'true'
uses: benchmark-action/github-action-benchmark@v1
with:
name: Fortress Rollback Benchmarks
tool: 'cargo'
output-file-path: benchmark-results.txt
# Store results in gh-pages branch under bench/
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: ${{ github.event_name != 'pull_request' }}
# Alert if performance regresses by more than 50%
# Note: Sub-10ns benchmarks have high variance due to timer resolution,
# so we use a generous threshold to avoid false positives
alert-threshold: '150%'
# Post alert as commit comment when regression detected
comment-on-alert: true
# Don't fail workflow on alerts - use for tracking only
# Nanosecond-scale benchmarks have too much noise for reliable CI gates
fail-on-alert: false
# Keep benchmark history for trend analysis
max-items-in-chart: 50
# Only update on push to main (not PRs) to avoid benchmark pollution
gh-pages-branch: gh-pages
benchmark-data-dir-path: bench
- name: Skip benchmark storage (no gh-pages branch yet)
if: steps.gh-pages-check.outputs.exists == 'false' && github.event_name != 'push'
run: |
echo "::notice::Skipping benchmark storage - gh-pages branch does not exist yet."
echo "The gh-pages branch will be created when the first commit is pushed to main."
# On PRs, compare with main branch baseline (only if gh-pages exists)
- name: Compare PR benchmarks with main
if: github.event_name == 'pull_request' && steps.gh-pages-check.outputs.exists == 'true'
uses: benchmark-action/github-action-benchmark@v1
with:
name: Fortress Rollback Benchmarks
tool: 'cargo'
output-file-path: benchmark-results.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
# Compare against main but don't push
auto-push: false
# Summary comparison comment on PR
comment-always: true
# External JSON for baseline comparison
external-data-json-path: ./cache/benchmark-data.json
gh-pages-branch: gh-pages
benchmark-data-dir-path: bench
- name: Skip PR comparison (no baseline)
if: github.event_name == 'pull_request' && steps.gh-pages-check.outputs.exists == 'false'
run: |
echo "::notice::Skipping PR benchmark comparison - no baseline data available yet."
echo "Baseline will be established after first merge to main."
# Upload raw benchmark results as artifact for debugging
- name: Upload benchmark results
uses: actions/upload-artifact@v7
with:
name: benchmark-results
path: benchmark-results.txt
retention-days: 30
# Quick benchmark sanity check (runs on every PR)
benchmark-quick:
name: Quick Benchmark Smoke Test
runs-on: ubuntu-latest
permissions:
contents: read
# Quick benchmarks run even if full benchmark fails
# Skip for Dependabot PRs - benchmark results aren't useful for dependency updates
if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]'
steps:
- uses: actions/checkout@v6
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Configure sccache
id: sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- name: Verify sccache is working
id: sccache-check
if: steps.sccache.outcome == 'success'
run: ./scripts/ci/verify-sccache.sh
continue-on-error: true
- name: Clear sccache env on failure
if: steps.sccache.outcome != 'success' || steps.sccache-check.outcome != 'success'
run: |
echo "RUSTC_WRAPPER=" >> "$GITHUB_ENV"
echo "SCCACHE_GHA_ENABLED=" >> "$GITHUB_ENV"
- name: Cache cargo registry and build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: bench-quick-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
bench-quick-${{ runner.os }}-cargo-
# Run a quick smoke test of benchmarks (1 sample each)
- name: Smoke test benchmarks
run: |
cargo bench --bench input_queue -- --sample-size 10 --warm-up-time 1 --measurement-time 1
cargo bench --bench p2p_session -- --sample-size 10 --warm-up-time 1 --measurement-time 1
cargo bench --bench sync_layer -- --sample-size 10 --warm-up-time 1 --measurement-time 1
timeout-minutes: 10
env:
RUSTC_WRAPPER: ${{ steps.sccache-check.outputs.working == 'true' && 'sccache' || '' }}
SCCACHE_GHA_ENABLED: ${{ steps.sccache-check.outputs.working == 'true' && 'true' || 'false' }}
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
# Increase startup timeout to handle slow GitHub Actions runners
SCCACHE_STARTUP_NOTIFY_TIMEOUT: "60"
SCCACHE_IDLE_TIMEOUT: "0"