-
Notifications
You must be signed in to change notification settings - Fork 0
280 lines (274 loc) · 11.6 KB
/
evaluation-workflow.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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
name: Execute and report a JQF performance evaluation campaign
on:
workflow_call:
inputs:
trials:
description: Number of trials to conduct of each fuzzing target
required: false
default: 5
type: number
duration:
description: Duration of each fuzzing campaign, e.g. 5m, 24h
required: false
default: 5m
type: string
report_on_branches:
description: Other branches to include in the report
required: false
default: fast-collision-free-coverage,reporting-ci
type: string
fuzzer_to_invoke:
description: Path to script to invoke for fuzzing run, defaults to ./bin/jqf-zest
required: false
default: ./bin/jqf-zest
type: string
java_home:
required: false
default: /usr/lib/jvm/java-11-openjdk-amd64/
type: string
runs_on:
required: false
default: self-hosted
type: string
PROFILE_HEAP:
required: false
type: boolean
INFLUX_URL:
required: false
type: string
default: https://dashboard-influx.apps.in.ripley.cloud
INFLUX_BUCKET:
required: false
type: string
default: java-fuzzing-dev
INFLUX_ORGANIZATION:
required: false
type: string
default: ripley.cloud
JVM_OPTS:
required: false
type: string
secrets:
INFLUX_TOKEN:
required: false
description: InflxuDB access token
jobs:
build-matrix:
runs-on: self-hosted
outputs:
matrix-run: ${{ steps.set-matrix.outputs.matrix-run }}
matrix-analyze: ${{ steps.set-matrix.outputs.matrix-analyze }}
base-url: ${{ steps.set-matrix.outputs.base-url }}
steps:
- uses: actions/checkout@v2
- name: Set matrix for evaluation
id: set-matrix
run: |
echo "::set-output name=matrix-run::$( python3 scripts/experiments/generate-experiment-matrix.py ${{ inputs.trials }} )"
echo "::set-output name=matrix-analyze::$( python3 scripts/experiments/generate-experiment-matrix.py )"
echo "::set-output name=base-url::https://ci.in.ripley.cloud/logs/public/${{ github.repository }}/${{ github.sha }}/$(./scripts/experiments/urlencode.sh "${{ github.workflow }}")/${{ github.run_id }}/${{ github.run_attempt }}/site/"
run-fuzzer:
runs-on: ${{ inputs.runs_on }}
timeout-minutes: 1560
needs: build-matrix
env:
JAVA_HOME: ${{ inputs.java_home }}
RESULTS_DIR: /ci-logs/public/${{ github.repository }}/${{ github.sha }}/${{ github.workflow }}/${{ github.run_id }}/${{ github.run_attempt }}/artifacts
JVM_OPTS: -Dtime=${{ inputs.duration }} -Djqf.ei.QUIET_MODE=true -DZEST_STATS_REFRESH_TIME_PERIOD=60000 -DuseFastNonCollidingCoverageInstrumentation=true -Djqf.ei.MAX_FAILURES_REPORT=10 ${{ inputs.JVM_OPTS }}
PROFILE_HEAP: ${{ inputs.PROFILE_HEAP }}
strategy:
matrix: ${{fromJson(needs.build-matrix.outputs.matrix-run)}}
steps:
- uses: actions/checkout@v2
- name: Set up Telegraf config
uses: DamianReeves/[email protected]
with:
path: telegraf.conf
write-mode: preserve
contents: |
[global_tags]
experiment = "$EXPERIMENT"
benchmark = "$BENCHMARK"
fuzzer = "$FUZZER_NAME"
trial = "$TRIAL"
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
hostname = ""
omit_hostname = false
[[outputs.influxdb_v2]]
urls = ["$INFLUX_URL"]
token = "$INFLUX_TOKEN"
organization = "$INFLUX_ORGANIZATION"
bucket = "$INFLUX_BUCKET"
[[processors.defaults]]
[processors.defaults.fields]
hostname = "$RUNNER_NAME"
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[inputs.mem]]
[[inputs.tail]]
name_override = "jqf"
path_tag = ""
files = ["fuzz-results/plot_data"]
data_format = "csv"
csv_timestamp_column = "# unix_time"
csv_timestamp_format = "unix"
csv_header_row_count = 1
csv_trim_space = true
from_beginning = true
[[inputs.tail]]
name_override = "knarr-memory"
files = ["fuzz-results/knarr-memory.csv"]
data_format = "csv"
csv_timestamp_column = "# unix_time"
csv_timestamp_format = "unix_ms"
csv_header_row_count = 1
csv_trim_space = true
from_beginning = true
path_tag = ""
[[inputs.tail]]
name_override = "confetti-central-memory"
files = ["fuzz-results/confetti-central-memory.csv"]
data_format = "csv"
path_tag = ""
csv_timestamp_column = "# unix_time"
csv_timestamp_format = "unix_ms"
csv_header_row_count = 1
csv_trim_space = true
from_beginning = true
- name: Start Telegraf
env:
EXPERIMENT: ${{ github.workflow }}
FUZZER_NAME: ${{ inputs.fuzzer_to_invoke }}
BENCHMARK: ${{ matrix.config.id }}
TRIAL: ${{ matrix.config.runNumber }}
INFLUX_URL: ${{ inputs.INFLUX_URL }}
INFLUX_TOKEN: ${{ secrets.INFLUX_TOKEN }}
INFLUX_ORGANIZATION: ${{ inputs.INFLUX_ORGANIZATION }}
INFLUX_BUCKET: ${{ inputs.INFLUX_BUCKET }}
run: |
if [ ! -z "$INFLUX_TOKEN" ]
then
telegraf --config telegraf.conf --pidfile telegraf.pid &
fi
- name: Build JQF
run: mvn -B -DskipTests install
- name: Run Fuzzer
run: timeout 25h bash -c "${{ inputs.fuzzer_to_invoke }} -c $(scripts/examples_classpath.sh) ${{ matrix.config.class }} ${{ matrix.config.method }} fuzz-results"
- name: Stop Telegraf
run: |
if [ ! -z "$INFLUX_TOKEN" ]
then
kill $(cat telegraf.pid) || true
fi
- name: Collect Results
run: |
mkdir -p fuzz-logs
if [ -f "fuzz-results/fuzz.log" ]; then
mv fuzz-results/fuzz.log fuzz-logs
fi
mv fuzz-logs ${{ matrix.config.id }}_${{ matrix.config.runNumber }}_fuzz_logs
mv fuzz-results/corpus ${{ matrix.config.id }}_corpus_${{ matrix.config.runNumber }}
tar czf ${{ matrix.config.id }}_corpus_${{ matrix.config.runNumber }}.tgz ${{ matrix.config.id }}_corpus_${{ matrix.config.runNumber }}
mv fuzz-results/failures ${{ matrix.config.id }}_failures_${{ matrix.config.runNumber }}
tar czf ${{ matrix.config.id }}_failures_${{ matrix.config.runNumber }}.tgz ${{ matrix.config.id }}_failures_${{ matrix.config.runNumber }}
mv fuzz-results/plot_data ${{ matrix.config.id }}_plot_data_${{ matrix.config.runNumber }}
mkdir -p "$RESULTS_DIR"
cp ${{ matrix.config.id }}_corpus_${{ matrix.config.runNumber }}.tgz "$RESULTS_DIR/"
cp ${{ matrix.config.id }}_failures_${{ matrix.config.runNumber }}.tgz "$RESULTS_DIR/"
cp ${{ matrix.config.id }}_plot_data_${{ matrix.config.runNumber }} "$RESULTS_DIR/"
cp -r ${{ matrix.config.id }}_${{ matrix.config.runNumber }}_fuzz_logs "$RESULTS_DIR/"
# Also save any debug log files locally
find fuzz-results -maxdepth 1 -type f \( -iname \*.csv -o -iname \*.log \) -exec sh -c 'cp {} "$RESULTS_DIR/${{ matrix.config.id }}_$(basename {})_${{ matrix.config.runNumber }}"' \;
- name: Archive Fuzz Logs
uses: actions/upload-artifact@v2
with:
path: ${{ matrix.config.id }}_${{ matrix.config.runNumber }}_fuzz_logs
name: ${{ matrix.config.id }}_${{ matrix.config.runNumber }}_fuzz_logs
- name: Archive Corpus
uses: actions/upload-artifact@v2
with:
path: ${{ matrix.config.id }}_corpus_${{ matrix.config.runNumber }}.tgz
name: archive_${{ matrix.config.id }}_corpus_${{ matrix.config.runNumber }}.tgz
- name: Archive Failures
uses: actions/upload-artifact@v2
with:
path: ${{ matrix.config.id }}_failures_${{ matrix.config.runNumber }}.tgz
name: archive_${{ matrix.config.id }}_failures_${{ matrix.config.runNumber }}.tgz
- name: Archive Plot Data
uses: actions/upload-artifact@v2
with:
path: ${{ matrix.config.id }}_plot_data_${{ matrix.config.runNumber }}
name: ${{ matrix.config.id }}_plot_data_${{ matrix.config.runNumber }}
repro-jacoco:
runs-on: self-hosted
needs: [run-fuzzer, build-matrix]
env:
RESULTS_DIR: /ci-logs/public/${{ github.repository }}/${{ github.sha }}/${{ github.workflow }}/${{ github.run_id }}/${{ github.run_attempt }}
TARGETS: ${{ needs.build-matrix.outputs.matrix-analyze }}
BASE_URL: ${{ needs.build-matrix.outputs.base-url }}
TRIALS: ${{ inputs.trials }}
DURATION: ${{ inputs.duration }}
JAVA_HOME: ${{ inputs.java_home }}
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- id: repro
name: Repro
run: |
mvn -B -q -DskipTests install
pwd
JACOCO_SUMMARY='{'
for k in $(jq '.config | keys | .[]' <<< "$TARGETS"); do
value=$(jq -c -r ".config[$k]" <<< $TARGETS)
method=$(jq -r ".method" <<< $value)
class=$(jq -r ".class" <<< $value)
id=$(jq -r ".id" <<< $value)
coveragePackages=$(jq -r ".coveragePackages" <<< $value)
echo $id
echo $coveragePackages
find . -maxdepth 2 -type f -name "${id}_corpus_*" -exec mv {} . \;
find . -maxdepth 1 -type f -name "${id}_corpus_*.tgz" -exec tar xzf {} \;
find . -maxdepth 1 -name "*${id}_*.tgz" -exec rm -rf {} \;
rm -f jacoco.exec
bash scripts/experiments/reproWithJacoco.sh $class $method jacoco.exec "$coveragePackages" "${id}_corpus_*"
bash scripts/experiments/get_coverage.sh jacoco.exec "$coveragePackages" jacoco-$id
JACOCO_SUMMARY+="\"${id}\": $(cat jacoco_summary.json),"
mv jacoco_summary.json "$RESULTS_DIR/artifacts/${id}_jacoco_summary.json"
cp -r jacoco-$id "$RESULTS_DIR/"
done
JACOCO_SUMMARY+='"site_url":"$BASE_URL"}'
echo "::set-output name=jacoco-summary::$JACOCO_SUMMARY"
mv "$RESULTS_DIR"/jacoco* "$RESULTS_DIR/artifacts/"
build-site:
runs-on: self-hosted
needs: [ repro-jacoco ]
env:
RENV_PATHS_ROOT: /ci-logs/renv
PROFILE_HEAP: ${{ inputs.PROFILE_HEAP }}
steps:
- uses: actions/checkout@v2
with:
repository: 'jon-bell/fuzzing-build-site-action'
ref: 'main'
- name: Fetch workflow runs to compare to
id: fetch-compare
uses: jon-bell/list-workflow-runs-by-branch-action@main
with:
include_branches: ${{ inputs.report_on_branches}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build site
uses: jon-bell/fuzzing-build-site-action@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
comparisons: ${{ steps.fetch-compare.outputs.workflow_runs }}