Skip to content

web: bump fast-uri from 3.1.0 to 3.1.2 in /web #373

web: bump fast-uri from 3.1.0 to 3.1.2 in /web

web: bump fast-uri from 3.1.0 to 3.1.2 in /web #373

Workflow file for this run

name: Benchmarks
on:
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
benchmark:
name: Run Benchmarks
runs-on: qnap-nas
steps:
- name: Checkout PR branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
with:
go-version-file: 'go.mod'
cache: true
- name: Run benchmarks on PR branch
run: |
go test -bench=. -benchmem -count=5 ./internal/agent/router/... 2>&1 | tee new.bench
go test -bench=. -benchmem -count=5 ./internal/agent/lb/... 2>&1 | tee -a new.bench
go test -bench=. -benchmem -count=5 ./internal/agent/policy/... 2>&1 | tee -a new.bench
- name: Checkout main branch
run: |
git stash
git checkout origin/main
- name: Run benchmarks on main branch
run: |
go test -bench=. -benchmem -count=5 ./internal/agent/router/... 2>&1 | tee old.bench
go test -bench=. -benchmem -count=5 ./internal/agent/lb/... 2>&1 | tee -a old.bench
go test -bench=. -benchmem -count=5 ./internal/agent/policy/... 2>&1 | tee -a old.bench
- name: Install benchstat
run: go install golang.org/x/perf/cmd/benchstat@latest
- name: Compare benchmarks
id: compare
run: |
benchstat old.bench new.bench > benchstat.txt
cat benchstat.txt
# Check for significant regressions (>10% slower)
if grep -E '~\s+[0-9]+\.[0-9]+%\s+\+' benchstat.txt; then
echo "::warning::Potential performance regression detected"
fi
# Save output for PR comment
{
echo 'BENCHSTAT<<EOF'
cat benchstat.txt
echo 'EOF'
} >> $GITHUB_OUTPUT
- name: Comment on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
const fs = require('fs');
const benchstat = fs.readFileSync('benchstat.txt', 'utf8');
const body = `## 📊 Benchmark Results
\`\`\`
${benchstat}
\`\`\`
| Symbol | Meaning |
|--------|---------|
| ~ | No significant change |
| + | Performance improved |
| - | Performance regressed |
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});
- name: Upload benchmark results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: benchmark-results
path: |
old.bench
new.bench
benchstat.txt
retention-days: 30