File tree 2 files changed +45
-2
lines changed
2 files changed +45
-2
lines changed Original file line number Diff line number Diff line change
1
+ name : Benchmark Tests
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ schedule :
6
+ - cron : ' 0 10 * * 1'
7
+
8
+ env :
9
+ # Enable versioned runner quiet mode to make CI output easier to read:
10
+ OUTPUT_MODE : quiet
11
+
12
+ jobs :
13
+ benchmarks :
14
+ runs-on : ubuntu-latest
15
+
16
+ strategy :
17
+ fail-fast : false
18
+ matrix :
19
+ node-version : [16.x, 18.x, 20.x, 22.x]
20
+
21
+ steps :
22
+ - uses : actions/checkout@v4
23
+ - name : Use Node.js ${{ matrix.node-version }}
24
+ uses : actions/setup-node@v4
25
+ with :
26
+ node-version : ${{ matrix.node-version }}
27
+ - name : Install Dependencies
28
+ run : npm install
29
+ - name : Run Benchmark Tests
30
+ run : node ./bin/run-bench.js --filename=${{ github.base_ref || 'main' }}_${{ matrix.node-version }}
31
+ - name : Verify Benchmark Output
32
+ run : ls benchmark_results
33
+ - name : Archive Benchmark Test
34
+ uses : actions/upload-artifact@v4
35
+ with :
36
+ name : benchmark-tests-${{ github.base_ref || 'main' }}-${{ matrix.node-version }}
37
+ path : ./benchmark_results
38
+
Original file line number Diff line number Diff line change @@ -20,7 +20,11 @@ const globs = []
20
20
const opts = Object . create ( null )
21
21
22
22
process . argv . slice ( 2 ) . forEach ( function forEachFileArg ( file ) {
23
- if ( / ^ - - / . test ( file ) ) {
23
+ if ( / ^ - - / . test ( file ) && file . indexOf ( '=' ) > - 1 ) {
24
+ // this one has a value assigned
25
+ const arg = file . substring ( 2 ) . split ( '=' )
26
+ opts [ arg [ 0 ] ] = arg [ 1 ]
27
+ } else if ( / ^ - - / . test ( file ) ) {
24
28
opts [ file . substring ( 2 ) ] = true
25
29
} else if ( / [ * ] / . test ( file ) ) {
26
30
globs . push ( path . join ( benchpath , file ) )
@@ -69,13 +73,14 @@ class Printer {
69
73
/* eslint-enable no-console */
70
74
}
71
75
const resultPath = 'benchmark_results'
76
+ const filePrefix = opts . filename ? `${ opts . filename } ` : 'benchmark'
72
77
try {
73
78
await fs . stat ( resultPath )
74
79
} catch ( e ) {
75
80
await fs . mkdir ( resultPath )
76
81
}
77
82
const content = JSON . stringify ( this . _tests , null , 2 )
78
- const fileName = `${ resultPath } /benchmark_ ${ new Date ( ) . getTime ( ) } .json`
83
+ const fileName = `${ resultPath } /${ filePrefix } _ ${ new Date ( ) . getTime ( ) } .json`
79
84
await fs . writeFile ( fileName , content )
80
85
console . log ( `Done! Test output written to ${ fileName } ` )
81
86
}
You can’t perform that action at this time.
0 commit comments