chore(deps): Bump actions/upload-pages-artifact from 3.0.1 to 4.0.0 #26
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
# Inspired on: https://github.com/fastify/fastify/blob/main/.github/workflows/benchmark.yml | |
name: Benchmark | |
on: | |
pull_request: | |
types: | |
- labeled | |
permissions: | |
contents: write | |
jobs: | |
benchmark-pr: | |
runs-on: ubuntu-latest | |
if: > | |
( | |
github.event.action == 'labeled' | |
&& contains(github.event.label.name, 'benchmarks') | |
) | |
name: Benchmark Pull Request | |
outputs: | |
PR-BENCH-20: ${{ steps.benchmark-pr-run.outputs.BENCH_RESULT20 }} | |
PR-BENCH-22: ${{ steps.benchmark-pr-run.outputs.BENCH_RESULT22 }} | |
PR-BENCH-24: ${{ steps.benchmark-pr-run.outputs.BENCH_RESULT24 }} | |
strategy: | |
fail-fast: true | |
matrix: | |
node-version: [20, 22, 24] | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
ref: ${{github.event.pull_request.head.sha}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
cache-dependency-path: package.json | |
- name: Install Dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Benchmark Branch | |
id: benchmark-pr-run | |
run: | | |
npm run --silent --if-present benchmark:ci > result.txt | |
result=$(cat result.txt) | |
echo 'BENCH_RESULT${{matrix.node-version}}<<EOF' >> $GITHUB_OUTPUT | |
echo "$result" >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
benchmark-current: | |
runs-on: ubuntu-latest | |
needs: [benchmark-pr] | |
name: Benchmark Current Version | |
outputs: | |
CURRENT-BENCH-20: ${{ steps.benchmark-current-run.outputs.BENCH_RESULT20 }} | |
CURRENT-BENCH-22: ${{ steps.benchmark-current-run.outputs.BENCH_RESULT22 }} | |
CURRENT-BENCH-24: ${{ steps.benchmark-current-run.outputs.BENCH_RESULT24 }} | |
strategy: | |
fail-fast: true | |
matrix: | |
node-version: [20, 22, 24] | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
ref: "current" | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
cache-dependency-path: package.json | |
- name: Install Dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Benchmark Current | |
id: benchmark-current-run | |
run: | | |
npm run --silent --if-present benchmark:ci > result.txt | |
result=$(cat result.txt) | |
echo 'BENCH_RESULT${{matrix.node-version}}<<EOF' >> $GITHUB_OUTPUT | |
echo "$result" >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
print-benchmark: | |
needs: | |
- benchmark-pr | |
- benchmark-current | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Comment PR | |
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
message: | | |
### Benchmarks Results | |
>Numbers are in Ops/sec | |
**Node**: 20 | |
**PR**: | |
```shell | |
${{ needs.benchmark-pr.outputs.PR-BENCH-20 }} | |
``` | |
**MAIN**: | |
```shell | |
${{ needs.benchmark-current.outputs.CURRENT-BENCH-20 }} | |
``` | |
--- | |
**Node**: 22 | |
**PR**: | |
```shell | |
${{ needs.benchmark-pr.outputs.PR-BENCH-22 }} | |
``` | |
**MAIN**: | |
```shell | |
${{ needs.benchmark-current.outputs.CURRENT-BENCH-22 }} | |
``` | |
--- | |
**Node**: 24 | |
**PR**: | |
```shell | |
${{ needs.benchmark-pr.outputs.PR-BENCH-24 }} | |
``` | |
**MAIN**: | |
```shell | |
${{ needs.benchmark-current.outputs.CURRENT-BENCH-24 }} | |
``` | |
remove-label: | |
if: ${{ github.event.label.name == 'benchmarks' }} | |
needs: | |
- print-benchmark | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Remove benchmark label | |
uses: octokit/request-action@dad4362715b7fb2ddedf9772c8670824af564f0d # v2.4.0 | |
id: remove-label | |
with: | |
route: DELETE /repos/{repo}/issues/{issue_number}/labels/{name} | |
repo: ${{ github.repository }} | |
issue_number: ${{ github.event.pull_request.number }} | |
name: benchmarks | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |