mirror of
https://github.com/cloudflare/vinext.git
synced 2026-09-14 19:04:59 +08:00
6c33639d4b
Bumps [actions/checkout](https://github.com/actions/checkout) from 7.0.0 to 7.0.1. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0...3d3c42e5aac5ba805825da76410c181273ba90b1) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
104 lines
3.4 KiB
YAML
104 lines
3.4 KiB
YAML
name: Benchmarks
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch: # Allow manual runs
|
|
|
|
# Only allow one benchmark run at a time (they're slow and resource-intensive)
|
|
concurrency:
|
|
group: benchmarks
|
|
cancel-in-progress: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
benchmark:
|
|
name: Run Benchmarks
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 0 # Need full history for commit info
|
|
|
|
- uses: ./.github/actions/setup
|
|
|
|
- name: Build vinext plugin
|
|
run: vp run build
|
|
|
|
- name: Install hyperfine
|
|
run: |
|
|
wget https://github.com/sharkdp/hyperfine/releases/download/v1.19.0/hyperfine_1.19.0_amd64.deb
|
|
echo "5ffe6996aefbbf547f383116eea53569263cc7cf6598ee53f0081e37b702055d hyperfine_1.19.0_amd64.deb" | sha256sum -c
|
|
sudo dpkg -i hyperfine_1.19.0_amd64.deb
|
|
|
|
# Generate the shared benchmark app (copies app/ into each project dir)
|
|
- name: Generate benchmark app
|
|
run: node benchmarks/generate-app.mjs
|
|
|
|
- name: Install Next.js benchmark dependencies
|
|
working-directory: benchmarks/nextjs
|
|
run: npm install
|
|
|
|
# Run the benchmarks
|
|
- name: Run benchmarks
|
|
run: node benchmarks/run.mjs --runs=5 --dev-runs=10
|
|
|
|
# Find the latest results JSON
|
|
- name: Locate results
|
|
id: results
|
|
run: |
|
|
RESULTS_FILE=$(ls -t benchmarks/results/bench-*.json | head -1)
|
|
echo "file=$RESULTS_FILE" >> "$GITHUB_OUTPUT"
|
|
echo "Found results: $RESULTS_FILE"
|
|
|
|
# Upload results as artifact (backup)
|
|
- name: Upload results artifact
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: benchmark-results-${{ github.sha }}
|
|
path: benchmarks/results/bench-*.json
|
|
retention-days: 90
|
|
|
|
# Upload results to the benchmarks dashboard
|
|
- name: Upload to dashboard
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
env:
|
|
BENCHMARK_UPLOAD_TOKEN: ${{ secrets.BENCHMARK_UPLOAD_TOKEN }}
|
|
RESULTS_FILE: ${{ steps.results.outputs.file }}
|
|
COMMIT_SHA: ${{ github.sha }}
|
|
run: |
|
|
COMMIT_SHORT="${COMMIT_SHA:0:7}"
|
|
COMMIT_MSG=$(git log -1 --format='%s' "$COMMIT_SHA")
|
|
COMMIT_DATE=$(git log -1 --format='%aI' "$COMMIT_SHA")
|
|
|
|
# Read the benchmark results JSON and wrap with commit metadata
|
|
RESULTS_JSON=$(cat "$RESULTS_FILE")
|
|
|
|
jq -n \
|
|
--arg sha "$COMMIT_SHA" \
|
|
--arg short "$COMMIT_SHORT" \
|
|
--arg msg "$COMMIT_MSG" \
|
|
--arg date "$COMMIT_DATE" \
|
|
--argjson results "$RESULTS_JSON" \
|
|
'{
|
|
commitSha: $sha,
|
|
commitShort: $short,
|
|
commitMessage: $msg,
|
|
commitDate: $date,
|
|
results: $results
|
|
}' | curl -f -X POST \
|
|
-H "Authorization: Bearer $BENCHMARK_UPLOAD_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d @- \
|
|
"https://benchmarks.vinext.workers.dev/api/upload"
|
|
|
|
# Post summary as a GitHub Actions summary
|
|
- name: Post summary
|
|
run: |
|
|
MD_FILE=$(ls -t benchmarks/results/bench-*.md | head -1)
|
|
cat "$MD_FILE" >> "$GITHUB_STEP_SUMMARY"
|