Skip to content

Commit 7983c7c

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

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

.github/workflows/test-shared.yml

Lines changed: 57 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 }}
@@ -84,5 +101,44 @@ jobs:
84101
--arg devTools '[]' \
85102
--arg benchmarkTools '[]' \
86103
--run '
87-
make run-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS"
104+
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"
88105
'
106+
- name: Fetch commit to benchmark
107+
if: ${{ github.event_name == 'workflow_dispatch' }}
108+
run: git pull --no-rebase ${{ inputs.commit }}
109+
110+
- name: Re-build Node.js
111+
# ccache is disabled here to avoid polluting the cache. Local build outputs should make this build relatively quick anyway.
112+
if: ${{ github.event_name == 'workflow_dispatch' }}
113+
run: |
114+
mv out/Release/node base_node
115+
nix-shell \
116+
--pure \
117+
--arg loadJSBuiltinsDynamically false \
118+
--arg ccache 'null' \
119+
--arg devTools '[]' \
120+
--arg benchmarkTools '[]' \
121+
--run '
122+
make build-ci -j4 V=1
123+
'
124+
125+
- name: Run benchmark
126+
if: ${{ github.event_name == 'workflow_dispatch' }}
127+
run: |
128+
nix-shell \
129+
--pure --keep FILTER \
130+
--arg loadJSBuiltinsDynamically false \
131+
--arg ccache 'null' \
132+
--arg devTools '[]' \
133+
--run '
134+
./base_node benchmark/compare.js \
135+
--filter "$FILTER" \
136+
--runs ${{ inputs.runs }} \
137+
--old ./base_node --new ./node \
138+
-- ${{ inputs.category }} \
139+
| Rscript benchmark/compare.R
140+
'
141+
env:
142+
FILTER: ${{ inputs.filter }}
143+
144+

0 commit comments

Comments
 (0)