fix(cloudflare): wait for per-route version propagation (#3164) #1856
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |