Skip to content

Commit 97ef3e1

Browse files
committed
tools: add benchmark runner to test-shared
1 parent f92b376 commit 97ef3e1

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

.github/workflows/test-shared.yml

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,23 @@ on:
1919
- README.md
2020
- .github/**
2121
- '!.github/workflows/test-shared.yml'
22+
workflow_dispatch:
23+
inputs:
24+
commit:
25+
required: true
26+
type: string
27+
description: 'The commit SHA to benchmark against the tip of the current branch'
28+
category:
29+
required: true
30+
type: string
31+
description: The category (or categories) of tests to run, for example buffers, cluster etc. Maps to a folders in node/benchmark
32+
filter:
33+
type: string
34+
description: A substring to restrict the benchmarks to run in a category. e.g. `net-c2c`
35+
runs:
36+
type: number
37+
default: 30
38+
description: How many times to repeat each benchmark
2239

2340
concurrency:
2441
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -63,6 +80,7 @@ jobs:
6380
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
6481

6582
- name: Configure sccache
83+
if: false
6684
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
6785
with:
6886
script: |
@@ -75,6 +93,7 @@ jobs:
7593
run: curl -L https://github.com/npm/cli/pull/8531.diff | git apply --directory=deps/npm --exclude=deps/npm/package-lock.json
7694

7795
- name: Build Node.js and run tests
96+
if: false
7897
run: |
7998
nix-shell \
8099
--pure --keep FLAKY_TESTS \
@@ -84,5 +103,47 @@ jobs:
84103
--arg devTools '[]' \
85104
--arg benchmarkTools '[]' \
86105
--run '
87-
make run-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS"
106+
make ${{ github.event_name == 'workflow_dispatch' && 'build' || 'run' }}-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS"
88107
'
108+
109+
- name: Pull commit to benchmark
110+
if: ${{ github.event_name == 'workflow_dispatch' }}
111+
run: git pull --allow-unrelated-histories --no-rebase --no-commit --no-ff origin ${{ inputs.commit }}
112+
113+
- run: git log
114+
115+
- name: Re-build Node.js
116+
# ccache is disabled here to avoid polluting the cache. Local build outputs should make this build relatively quick anyway.
117+
if: ${{ github.event_name == 'workflow_dispatch' }}
118+
run: |
119+
mv out/Release/node base_node
120+
nix-shell \
121+
--pure \
122+
--arg loadJSBuiltinsDynamically false \
123+
--arg ccache 'null' \
124+
--arg devTools '[]' \
125+
--arg benchmarkTools '[]' \
126+
--run '
127+
make build-ci -j4 V=1
128+
'
129+
130+
- name: Run benchmark
131+
if: ${{ github.event_name == 'workflow_dispatch' }}
132+
run: |
133+
nix-shell \
134+
--pure --keep FILTER \
135+
--arg loadJSBuiltinsDynamically false \
136+
--arg ccache 'null' \
137+
--arg devTools '[]' \
138+
--run '
139+
./base_node benchmark/compare.js \
140+
--filter "$FILTER" \
141+
--runs ${{ inputs.runs }} \
142+
--old ./base_node --new ./node \
143+
-- ${{ inputs.category }} \
144+
| Rscript benchmark/compare.R
145+
'
146+
env:
147+
FILTER: ${{ inputs.filter }}
148+
149+

0 commit comments

Comments
 (0)