Repository navigation
69 lines (62 loc) · 2.22 KB
/
Copy pathbench.yml
File metadata and controls
69 lines (62 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: bench
# runs the library comparison in bench/ and commits the results (results.json, installs.json, charts, README) to the
# default branch. release.yml runs it after a regular release reached npm, measuring the released version; can also
# be run by hand from the Actions tab, measuring the version bench/package.json has (or the one given)
on:
workflow_call:
inputs:
version:
description: ImageScript version to measure (release.yml passes the released one)
type: string
default: ''
workflow_dispatch:
inputs:
version:
description: ImageScript version to measure (empty keeps bench/package.json's)
type: string
default: ''
permissions:
contents: write
concurrency:
group: bench
cancel-in-progress: false
jobs:
bench:
runs-on: ubuntu-latest
defaults:
run:
working-directory: bench
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.repository.default_branch }}
- uses: actions/setup-node@v7
with:
node-version: 24.x
- run: npm ci --no-audit --no-fund
# a version that was just published can take some minutes to show up on the registry (3.6.0 took more than 2.5);
# npm ci cached the package's versions from before, which --prefer-online skips
- if: inputs.version != ''
run: |
for attempt in $(seq 20); do
npm install --save-exact --prefer-online --no-audit --no-fund "imagescript@$VERSION" && exit 0
sleep 30
done
exit 1
env:
VERSION: ${{ inputs.version }}
- run: node run.js
- run: node installs.js
- run: node report.js
# pushes with GITHUB_TOKEN don't trigger other workflows; rebases onto anything pushed meanwhile
- run: |
git add -A .
if git diff --cached --quiet; then echo "nothing changed"; exit 0; fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "benchmark ImageScript $(node -p "require('./node_modules/imagescript/package.json').version")"
for attempt in 1 2 3; do
git push && exit 0
git pull --rebase
done
exit 1