Skip to content

refactor(deleting-properties): added more benchmarks (#56) #4

refactor(deleting-properties): added more benchmarks (#56)

refactor(deleting-properties): added more benchmarks (#56) #4

Workflow file for this run

name: 'Watch Benchmarks'
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'bench/**'
permissions:
issues: write
jobs:
changes:
runs-on: ubuntu-latest
outputs:
files: ${{ steps.changes.outputs.benchmarks_files }}
changes: ${{ steps.changes.outputs.benchmarks }}
steps:
- uses: actions/checkout@v3
- name: 'Detect File Changes'
uses: dorny/paths-filter@v2
id: changes
with:
list-files: json
base: ${{ github.ref }}
working-directory: bench
filters: |
benchmarks:
- added|modified: 'bench/*.js'
benchmark:
needs: changes
if: needs.changes.outputs.files != '[]'
strategy:
fail-fast: true
matrix:
# Parse JSON array containing names of all filters matching any of changed files
# e.g. ['add-property.js', 'array-append.js'] if both bench files contains changes
bench-file: ${{ fromJSON(needs.changes.outputs.files) }}
node-version: [16.0.0, 16.18.1, 16.19.0, 16.20.0, 18.0.0, 18.14.2, 18.15.0, 18.16.0, 19.0.0, 19.8.0, 19.8.1, 19.9.0, 20.0.0]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js v${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: |
npm install
- name: Run Benchmark
id: benchmark
run: node ${{ matrix.bench-file }} > ./bench-result.md
env:
CI: true
- name: Notify on Error
if: ${{ failure() }}
uses: dacbd/create-issue-action@main
with:
token: ${{ github.token }}
title: Benchmark ${{ inputs.bench-file }} failed on v${{ matrix.node-version }}
body: |
### Context
[Failed Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
[Codebase](https://github.com/${{ github.repository }}/tree/${{ github.sha }})
Workflow name - `${{ github.workflow }}`
Job - `${{ github.job }}`
status - `${{ job.status }}`
assignees: RafaelGSS
labels: bug
- name: Set Env Variable
run: |
result=$(cat ./bench-result.md)
echo "$result" >> $GITHUB_STEP_SUMMARY
export RESULT_IN_BASE64=$(cat ./bench-result.md | base64 -w 0)
echo "BENCH_RESULT=$RESULT_IN_BASE64" >> "$GITHUB_ENV"
## Write for matrix outputs workaround
- uses: cloudposse/github-action-matrix-outputs-write@main
id: out
with:
matrix-step-name: benchmark
matrix-key: ${{ matrix.bench-file }}:${{ matrix.node-version }}
outputs: |-
result: ${{ env.BENCH_RESULT }}
## Read matrix outputs
read:
runs-on: ubuntu-latest
needs: [benchmark]
steps:
- uses: cloudposse/github-action-matrix-outputs-read@main
id: read
with:
matrix-step-name: benchmark
outputs:
result: '${{ steps.read.outputs.result }}'
commit:
runs-on: ubuntu-latest
needs: [read]
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
ref: main
- name: Use Node.js v20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Write Benchmark Results
run: |
node scripts/write-bench-results.mjs
node scripts/generate-reports.mjs
env:
BENCH_RESULT: ${{ needs.read.outputs.result }}
- name: Commit and Push Updated Results
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: 'main'
commit_message: 'chore(bench): update benchmark results'