-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (130 loc) · 3.91 KB
/
Copy pathtest.yml
File metadata and controls
147 lines (130 loc) · 3.91 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Test
on:
pull_request:
push:
branches: [ main ]
permissions:
contents: read
jobs:
unit:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
- name: Check JavaScript
run: npm run check
- name: Run unit tests
run: npm test
discover:
name: Discover available threads
needs: [ unit ]
runs-on: ubuntu-latest
outputs:
cores: ${{ steps.discover.outputs.cores }}
matrix: ${{ steps.discover.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Check available CPU cores
shell: bash
run: |
echo "CPUs reported by nproc: $(nproc)"
if command -v lscpu >/dev/null 2>&1; then
lscpu
fi
- id: discover
name: Create one test job per available thread count
uses: ./
with:
mode: discover
strategy: thread-sharded
threads: auto
replicas: 1
benchmarks: >-
[
{
"name": "timer-smoke-test",
"command": "node -e \"setTimeout(() => {}, Math.max(10, 120 / {threads}))\"",
"working_directory": ".",
"workload": 120,
"workload_unit": "units"
}
]
- name: Report dynamic fan-out
env:
CORES: ${{ steps.discover.outputs.cores }}
JOB_COUNT: ${{ steps.discover.outputs.job-count }}
THREAD_LIST: ${{ steps.discover.outputs.thread-list }}
shell: bash
run: |
echo "ThreadScale detected ${CORES} available threads"
echo "Thread counts: ${THREAD_LIST}"
echo "Spawning ${JOB_COUNT} measurement jobs"
{
echo "## ThreadScale test fan-out"
echo
echo "Available threads: ${CORES}"
echo
echo "Measurement jobs: ${JOB_COUNT} (${THREAD_LIST})"
} >> "${GITHUB_STEP_SUMMARY}"
benchmark:
name: Threads ${{ matrix.threads }}
needs: [ discover ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.discover.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v6
- id: benchmark
name: Measure timer with ${{ matrix.threads }} threads
uses: ./
with:
benchmark-name: ${{ matrix.benchmark }}
command: ${{ matrix.command }}
working-directory: ${{ matrix.working_directory }}
threads: ${{ matrix.threads }}
replica: ${{ matrix.replica }}
runs: 3
warmup-runs: 0
workload: ${{ matrix.workload }}
workload-unit: ${{ matrix.workload_unit }}
output-dir: thread-scaling-part
- name: Upload partial result
uses: actions/upload-artifact@v7
with:
name: thread-scaling-part-${{ matrix.id }}
path: ${{ steps.benchmark.outputs.result-file }}
if-no-files-found: error
report:
name: Aggregate results and plot
needs: [ benchmark ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download partial results
uses: actions/download-artifact@v7
with:
pattern: thread-scaling-part-*
path: thread-scaling-parts
- id: report
name: Create final summary and plots
uses: ./
with:
mode: report
input-dir: thread-scaling-parts
output-dir: thread-scaling
summary-plots: both
- name: Upload final report
uses: actions/upload-artifact@v7
with:
name: thread-scaling-report
path: ${{ steps.report.outputs.results-dir }}
if-no-files-found: error