-
Notifications
You must be signed in to change notification settings - Fork 0
223 lines (201 loc) · 7.86 KB
/
StandardStryker.yml
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: Apply Stryker's Standard Mutation Operators
on:
workflow_dispatch:
inputs:
packages:
description: "JSON file that specifies packages to generate mutants for"
default: "benchmarks.json"
strykerOptions:
description: "stryker options (e.g., --concurrency 4) to pass to stryker"
default: ""
debug_enabled:
type: boolean
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
default: false
jobs:
setup:
runs-on: ubuntu-latest
outputs:
packages: "${{ steps.parse_packages.outputs.packages }}"
strykerOptions: "${{ github.event.inputs.strykerOptions }}"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- id: parse_packages
run: |
packages=$(node \
.github/find_benchmarks.js " \
.github/${{ github.event.inputs.packages || 'benchmarks.json' }}")
packages=$(echo $packages | tr '\n' ' ')
echo "packages=$packages" >> $GITHUB_OUTPUT
benchmark:
needs:
- setup
runs-on: ubuntu-latest
# steps:
# - name : print needs
# run: |
# echo "packages=${{ fromJson(needs.setup.outputs.packages) }}"
continue-on-error: true
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.setup.outputs.packages) }}
steps:
- name: checkout master branch of StrykerJS from https://github.com/neu-se/stryker-js into directory stryker-js
uses: actions/checkout@v3
with:
repository: neu-se/stryker-js
ref: master
path: stryker-js
- name: build StrykerJS
run: |
cd stryker-js
npm install
npm run build
- name: print package info
run: |
echo "package.host=${{ matrix.package.host }}"
echo "package.name=${{ matrix.package.name }}"
echo "package.owner=${{ matrix.package.owner }}"
echo "package.repo=${{ matrix.package.repo }}"
echo "package.sha=${{ matrix.package.sha }}"
echo "package.edits=${{ matrix.package.edits }}"
echo "package.files=${{ matrix.package.files }}"
echo "package.ignore=${{ matrix.package.ignore }}"
- name: check out benchmark
if: ${{ matrix.package.host == 'github.com' }}
uses: actions/checkout@v3
with:
repository: ${{ format('{0}/{1}', matrix.package.owner, matrix.package.repo) }}
ref: ${{ matrix.package.sha }}
path: ${{ matrix.package.name }}
- name: Checkout gitlab package repo
if: ${{ matrix.package.host == 'gitlab.com' }}
run: |
git clone ${{ format('https://gitlab.com/{0}/{1}', matrix.package.owner, matrix.package.repo) }} ${{ matrix.package.name }}
cd ${{ matrix.package.name }}
git checkout ${{ matrix.package.sha }}
- name: build project
run: |
cd ${{ matrix.package.name }}
# if an edit command for editing package.json is specified (e.g., to disable linting), run it
if [ -n "$MATRIX_PACKAGE_EDITS" ]; then
${{ matrix.package.edits }}
fi
npm install
# if a build script exists, run it
npm run build || echo "No build script found"
env:
MATRIX_PACKAGE_EDITS: ${{ matrix.package.edits }}
- name: Check out llm-mutation-testing
uses: actions/checkout@v3
with:
path: llm-mutation-testing
- name: Set up llm-mutation-testing
run: |
cd llm-mutation-testing
npm run build
- name: install stryker-js and run stryker (standard mutators)
run: |
cd ${{ matrix.package.name }}
npm install install-local # install-local is needed to install our custom version of stryker-js
npx install-local ../stryker-js/packages/{core,util,api,instrumenter,*-runner} --legacy-peer-deps
STRYKER_FILES=$(node ../llm-mutation-testing/.github/expandGlob.js $(pwd) "${{ matrix.package.files }}" "${{ matrix.package.ignore }}")
STRYKER_OPTIONS="${{ needs.setup.outputs.strykerOptions }}"
(time npx stryker run $STRYKER_OPTIONS --mutate $STRYKER_FILES) 2>&1 | tee -a StrykerOutput.txt
- name: extract summary from StrykerOutput.txt
run: |
cd ${{ matrix.package.name }}
node ../llm-mutation-testing/.github/parseStrykerReport.js StrykerOutput.txt
- name: gather reports/mutation/mutation.html, StrykerOutput.txt, and StrykerInfo.json into results.zip
run: |
cd ${{ matrix.package.name }}
mkdir results
mkdir results/results-${{ matrix.package.name }}
cp reports/mutation/mutation.html results/results-${{ matrix.package.name }}/mutation.html
cp StrykerOutput.txt results/results-${{ matrix.package.name }}/StrykerOutput.txt
cp StrykerInfo.json results/results-${{ matrix.package.name }}/StrykerInfo.json
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: results-${{ matrix.package.name }}
path: ${{ matrix.package.name }}/results
combine_output:
name: Combine output from all benchmarks
needs:
- setup
- benchmark
runs-on: ubuntu-latest
steps:
- name: Download output zips
uses: actions/[email protected]
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Combine outputs
run: |
mkdir results
mkdir results/results
cd results/results
# move all benchmark info into a single directory
for benchmark in ../../results-*
do
# extract benchmark name
name=$(echo $benchmark | sed 's/..\/..\/results-//')
mv $benchmark/results-$name $name
done
cd ../..
- name: Upload combined output files
uses: actions/upload-artifact@v2
with:
name: results
path: results/results
generate_report:
name: Generate report
needs:
- setup
- combine_output
runs-on: ubuntu-latest
steps:
- name: Download combined output files
uses: actions/[email protected]
with:
name: results
path: results
- name: Check out llm-mutation-testing
uses: actions/checkout@v3
with:
path: llm-mutation-testing
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Generate report
run: |
cd llm-mutation-testing
npm run build
# if stryker options are specified, include them in the title
STRYKER_OPTIONS="${{ needs.setup.outputs.strykerOptions }}"
if [ -n "$STRYKER_OPTIONS" ]; then
title="Report (StrykerJS standard mutators $STRYKER_OPTIONS)"
else
title="Report (StrykerJS standard mutators)"
fi
node .github/generateReport.js "$title" ../results > report.md
more report.md > $GITHUB_STEP_SUMMARY
- name: Upload report
uses: actions/upload-artifact@v2
with:
name: report.md
path: llm-mutation-testing/report.md
- name: generate Latex table
run: |
cd llm-mutation-testing
node .github/generateStrykerJSTable.js "$title" ../results > table.tex
- name: Upload table
uses: actions/upload-artifact@v2
with:
name: table.tex
path: llm-mutation-testing/table.tex