This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 198
697 lines (662 loc) · 26.2 KB
/
ci.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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
name: Build
on:
pull_request:
push:
branches:
- main
tags:
- "*"
workflow_dispatch:
# limit to one concurrent run per PR/branch,
# and cancel any previous runs still going
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
ACTIONS_CACHE_KEY_DATE: 2023-08-10
CI: true
jobs:
agent:
strategy:
matrix:
os:
- [
self-hosted,
"1ES.Pool=onefuzz-ci",
"1ES.ImageOverride=github-runner-image-windows-2019",
]
- [
self-hosted,
"1ES.Pool=onefuzz-ci",
"1ES.ImageOverride=github-runner-image-ubuntu-20.04",
]
- [
self-hosted,
"1ES.Pool=onefuzz-ci-arm64",
"1ES.ImageOverride=github-runner-image-ubuntu-20.04-arm64",
]
runs-on: "${{ matrix.os }}"
steps:
- uses: actions/checkout@v3
- name: Install specific Rust version
uses: dtolnay/rust-toolchain@55c7845fad90d0ae8b2e83715cb900e5e861e8cb # pinned latest master as of 2022-10-08
with:
toolchain: "1.71.1" # note: keep this in sync with .devcontainer/Dockerfile
components: clippy, rustfmt, llvm-tools-preview
- name: Setup Rust problem-matchers
uses: r7kamura/rust-problem-matchers@d58b70c4a13c4866d96436315da451d8106f8f08 # pinned to 1.3.0
- name: Get Rust version & build version
shell: bash
run: |
set -x
echo "RUST_VERSION=$(rustc --version)" >> $GITHUB_OUTPUT
VERSION=$(src/ci/get-version.sh)
# it's a release build if version doesn't have a plus in it
# NB: this should stay in sync with version generation in get-version.sh
IS_RELEASE_BUILD=$(if [[ "$VERSION" =~ '+' ]]; then echo 'false'; else echo 'true'; fi)
echo "RELEASE_BUILD=$IS_RELEASE_BUILD" >> $GITHUB_OUTPUT
id: rust-version
- name: Rust artifact cache
id: cache-agent-artifacts
# don't cache the rust agent for relase builds as the version number will be incorrect
# don't cache on builds on the main branch for deployment to canary/nightly
if: steps.rust-version.outputs.RELEASE_BUILD == 'false' && github.ref_name != 'main'
uses: actions/cache@v3
with:
# if nothing has changed inside src/agent, we can reuse the artifacts directory
path: artifacts
key: agent-artifacts|${{ join(matrix.os, ':') }}|${{steps.rust-version.outputs.RUST_VERSION}}|${{ env.ACTIONS_CACHE_KEY_DATE }}|${{ hashFiles('src/agent/**/*') }}|${{hashFiles('src/ci/agent.sh')}}
# note: also including the ACTIONS_CACHE_KEY_DATE to rebuild if the Prereq Cache is invalidated
- name: Rust build cache
id: rust-build-cache
uses: Swatinem/rust-cache@v2
if: steps.cache-agent-artifacts.outputs.cache-hit != 'true'
with:
key: ${{env.ACTIONS_CACHE_KEY_DATE}} # additional key for cache-busting
workspaces: src/agent
- name: Linux Prereqs
if: runner.os == 'Linux'
run: |
sudo apt-get -y update
sudo apt-get -y install libssl-dev libunwind-dev build-essential pkg-config clang
- name: Clone onefuzz-samples
run: git clone https://github.com/microsoft/onefuzz-samples
- name: Prepare for agent integration tests
shell: bash
working-directory: ./onefuzz-samples/examples/simple-libfuzzer
run: |
make
mkdir -p ../../../src/agent/onefuzz-task/tests/targets/simple
cp fuzz.exe ../../../src/agent/onefuzz-task/tests/targets/simple/fuzz.exe
cp *.pdb ../../../src/agent/onefuzz-task/tests/targets/simple/ 2>/dev/null || :
- name: Install Rust Prereqs
shell: bash
run: src/ci/rust-prereqs.sh
- run: src/ci/agent.sh
shell: bash
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
directory: artifacts
# aarch64 must be explicitly set; see: https://github.com/codecov/codecov-action/issues/650#issuecomment-1528860991
os: ${{ contains(join(matrix.os,':'), 'arm64') && 'aarch64' || '' }}
- uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: artifacts
azcopy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: src/ci/azcopy.sh
- uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: artifacts
check-pr:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: lint
shell: bash
run: src/ci/check-check-pr.sh
cli:
needs:
- onefuzztypes
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- run: src/ci/set-versions.sh
shell: bash
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: actions/download-artifact@v3
with:
name: artifact-onefuzztypes
path: artifacts
- name: Build
shell: bash
run: |
set -ex
ls artifacts
python -mvenv cli_venv
. cli_venv/Scripts/activate
cd src/cli
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip-licenses -uf json > onefuzz/data/licenses.json
python setup.py sdist bdist_wheel
pip install -r ./requirements.txt ../../artifacts/sdk/*.whl
pip install six
pyinstaller onefuzz/__main__.py --onefile --name onefuzz --additional-hooks-dir extra/pyinstaller --hidden-import='pkg_resources.py2_warn' --hidden-import='opentelemetry.baggage' --hidden-import='opentelemetry.baggage.propagation' --hidden-import='opentelemetry.context.contextvars_context' --copy-metadata opentelemetry-sdk --copy-metadata opentelemetry-api --exclude-module tkinter --exclude-module PySide2 --exclude-module PIL.ImageDraw --exclude-module Pillow --clean --add-data "onefuzz/data/privacy.txt;onefuzz/data" --add-data "onefuzz/data/licenses.json;onefuzz/data"
./dist/onefuzz.exe --version
./dist/onefuzz.exe privacy_statement
mkdir -p ${GITHUB_WORKSPACE}/artifacts/windows-cli/
mkdir -p ${GITHUB_WORKSPACE}/artifacts/sdk/
cp dist/*.tar.gz dist/*.whl ${GITHUB_WORKSPACE}/artifacts/sdk/
cp dist/onefuzz.exe ${GITHUB_WORKSPACE}/artifacts/windows-cli/
- uses: actions/upload-artifact@v3
with:
name: artifact-cli
path: artifacts
- name: lint
shell: bash
run: |
set -ex
. cli_venv/Scripts/activate
cd src/cli
pip install -r requirements-lint.txt
flake8 .
bandit -r ./onefuzz/
black onefuzz examples tests --check
isort --profile black ./onefuzz ./examples/ ./tests/ --check
pytest -v tests
../ci/disable-py-cache.sh
mypy --ignore-missing-imports --implicit-reexport --namespace-packages ./onefuzz ./examples ./tests
# set a minimum confidence to ignore known false positives
vulture --min-confidence 61 onefuzz
contrib-webhook-teams-service:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: lint
shell: bash
run: |
set -ex
cd contrib/webhook-teams-service
python -m pip install --upgrade pip isort click==8.0.4 black mypy==0.910 flake8
pip install -r requirements.txt
mypy webhook
black webhook --check
isort --profile black webhook
flake8 webhook
python-safety:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: lint
shell: bash
run: |
set -ex
cd contrib/deploy-onefuzz-via-azure-devops
python -m pip install --upgrade pip
python -m pip install tox pipenv
tox
onefuzztypes:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: src/ci/set-versions.sh
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: src/ci/onefuzztypes.sh
- uses: actions/upload-artifact@v3
with:
name: artifact-onefuzztypes
path: artifacts
proxy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Rust build cache
id: rust-build-cache
uses: Swatinem/rust-cache@v2
with:
key: ${{env.ACTIONS_CACHE_KEY_DATE}} # additional key for cache-busting
workspaces: src/proxy-manager
- name: Install Rust Prereqs
if: steps.rust-build-cache.outputs.cache-hit != 'true'
shell: bash
run: src/ci/rust-prereqs.sh
- run: src/ci/proxy.sh
- uses: actions/upload-artifact@v3
with:
name: artifact-proxy
path: artifacts
service:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
# use global.json to install the correct version
global-json-file: global.json
- name: Install dependencies
run: |
cd src/ApiService/
dotnet restore --locked-mode
dotnet tool restore
sudo npm install -g azurite
- name: Check Formatting
run: |
cd src/ApiService/
dotnet format --verify-no-changes --no-restore
# note that Test comes before Build:
# Test will build things in Debug mode, Build will build them in Release
# Build comes second in case Test would do something (unspecified) that
# would somehow alter the binaries that we want to package.
- name: Test & Collect coverage info
run: |
cd src/ApiService/
azurite --silent &
dotnet test --no-restore --collect:"XPlat Code Coverage" --filter 'Category!=Live'
kill %1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
- name: Build Service
run: |
set -x
version=$(./src/ci/get-version.sh)
cd src/ApiService/
# Store GitHub RunID and SHA to be read by the 'info' function
echo ${GITHUB_RUN_ID} | tee ApiService/onefuzzlib/build.id
echo ${GITHUB_SHA} | tee ApiService/onefuzzlib/git.version
# stamp the build with version
# note that version might have a suffix of '+{sha}' from get-version.sh
# NB: ensure this stays in sync with get-version.sh
if [[ "$version" =~ '+' ]]; then
# if it has a suffix, split it into two parts
dotnet build -warnaserror --configuration Release /p:VersionPrefix=${version%+*} /p:SourceRevisionId=${version#*+}
else
dotnet build -warnaserror --configuration Release /p:VersionPrefix=${version}
fi
- name: copy artifacts
run: |
./src/ci/get-version.sh > src/deployment/VERSION
cd src/ApiService/ApiService/
mv az-local.settings.json bin/Release/net7.0/local.settings.json
cd bin/Release/net7.0/
zip -r api-service.zip .
mkdir -p ${GITHUB_WORKSPACE}/artifacts/service
cp api-service.zip ${GITHUB_WORKSPACE}/artifacts/service
- uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: artifacts
afl:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cache-build
with:
key: afl|${{runner.os}}-${{runner.arch}}|${{ hashFiles('src/ci/afl.sh') }}
path: artifacts
- run: src/ci/afl.sh
if: steps.cache-build.outputs.cache-hit != 'true'
- uses: actions/upload-artifact@v3
with:
name: artifact-afl
path: artifacts
aflpp:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cache-build
with:
key: aflpp|${{runner.os}}-${{runner.arch}}|${{ hashFiles('src/ci/aflpp.sh') }}
path: artifacts
- run: src/ci/aflpp.sh
if: steps.cache-build.outputs.cache-hit != 'true'
- uses: actions/upload-artifact@v3
with:
name: artifact-aflpp
path: artifacts
bicep-check:
name: Check Bicep files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: azure/CLI@v1
with:
inlineScript: |
az config set bicep.use_binary_from_path=false
az bicep install
az bicep build --file src/deployment/azuredeploy.bicep --stdout > /dev/null
dotnet-fuzzing-tools-linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
# use global.json to install the correct version
global-json-file: global.json
- run: src/ci/dotnet-fuzzing-tools.sh
shell: bash
- uses: actions/upload-artifact@v3
with:
name: artifact-dotnet-fuzzing-tools-linux
path: artifacts
dotnet-fuzzing-tools-windows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
# use global.json to install the correct version
global-json-file: global.json
- name: install llVM
run: |
choco install llvm --version 16.0.6
shell: powershell
- run: src/ci/dotnet-fuzzing-tools.ps1
shell: pwsh
- uses: actions/upload-artifact@v3
with:
name: artifact-dotnet-fuzzing-tools-windows
path: artifacts
radamsa-linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cache-radamsa-build-linux
with:
# key on the shell script only: this script fixes the
# version to a particular commit, so if it changes we need to rebuild
key: radamsa|${{runner.os}}-${{runner.arch}}|${{ hashFiles('src/ci/radamsa-linux.sh') }}
path: artifacts
- run: src/ci/radamsa-linux.sh
if: steps.cache-radamsa-build-linux.outputs.cache-hit != 'true'
- uses: actions/upload-artifact@v3
with:
name: artifact-radamsa-linux
path: artifacts
radamsa-win64:
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cache-radamsa-build-windows
with:
# key on the shell script only: this script fixes the
# version to a particular commit, so if it changes we need to rebuild
key: radamsa|${{runner.os}}-${{runner.arch}}|${{ hashFiles('src/ci/radamsa-windows.sh') }}
path: artifacts
- run: c:\msys64\usr\bin\bash src/ci/radamsa-windows.sh
if: steps.cache-radamsa-build-windows.outputs.cache-hit != 'true'
- uses: actions/upload-artifact@v3
with:
name: artifact-radamsa-windows
path: artifacts
package:
needs:
- agent
- azcopy
- cli
- proxy
- service
- afl
- aflpp
- dotnet-fuzzing-tools-linux
- dotnet-fuzzing-tools-windows
- radamsa-linux
- radamsa-win64
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: build-artifacts
path: artifacts
- uses: actions/download-artifact@v3
with:
name: artifact-cli
path: artifacts
- uses: actions/download-artifact@v3
with:
name: artifact-proxy
path: artifacts
- uses: actions/download-artifact@v3
with:
name: artifact-radamsa-linux
path: artifacts
- uses: actions/download-artifact@v3
with:
name: artifact-radamsa-windows
path: artifacts
- uses: actions/download-artifact@v3
with:
name: artifact-afl
path: artifacts
- uses: actions/download-artifact@v3
with:
name: artifact-aflpp
path: artifacts
- uses: actions/download-artifact@v3
with:
name: artifact-dotnet-fuzzing-tools-linux
path: artifacts
- uses: actions/download-artifact@v3
with:
name: artifact-dotnet-fuzzing-tools-windows
path: artifacts
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Lint
shell: bash
run: |
set -ex
cd src/deployment
python -m pip install --upgrade pip
pip install mypy==0.910 isort click==8.0.4 black types-requests flake8
mypy .
isort --profile black . --check
black . --check
flake8 *.py
rm -r .mypy_cache
- name: Package Onefuzz
run: |
set -ex
find artifacts
mkdir release-artifacts
cp -r src/runtime-tools src/deployment/tools
if [ -f artifacts/azcopy/NOTICE.txt ]; then
cp artifacts/azcopy/azcopy artifacts/azcopy/NOTICE.txt src/deployment/tools/linux
cp artifacts/azcopy/azcopy.exe artifacts/azcopy/NOTICE.txt src/deployment/tools/win64
else
cp artifacts/azcopy/azcopy artifacts/azcopy/ThirdPartyNotice.txt src/deployment/tools/linux
cp artifacts/azcopy/azcopy.exe artifacts/azcopy/ThirdPartyNotice.txt src/deployment/tools/win64
fi
cp artifacts/agent-MINGW*/onefuzz-agent.exe src/deployment/tools/win64/
cp artifacts/agent-MINGW*/onefuzz-task.exe src/deployment/tools/win64/
cp artifacts/agent-MINGW*/onefuzz_agent.pdb src/deployment/tools/win64/
cp artifacts/agent-MINGW*/onefuzz_task.pdb src/deployment/tools/win64/
cp artifacts/agent-Linux-x86_64/onefuzz-agent src/deployment/tools/linux/
cp artifacts/agent-Linux-x86_64/onefuzz-task src/deployment/tools/linux/
# cp artifacts/agent-Linux-aarch64/onefuzz-agent src/deployment/tools/linux-aarch64/
# cp artifacts/agent-Linux-aarch64/onefuzz-task src/deployment/tools/linux-aarch64/
cp artifacts/proxy/onefuzz-proxy-manager src/deployment/tools/linux/
cp artifacts/service/api-service.zip src/deployment
cp -r artifacts/third-party src/deployment
echo $GITHUB_RUN_ID | tee src/deployment/.build.id
echo $GITHUB_SHA | tee src/deployment/.sha
./src/ci/get-version.sh > src/deployment/VERSION
(cd src/deployment ; zip -r onefuzz-deployment-$(cat VERSION).zip . )
cp src/deployment/onefuzz-deployment*zip release-artifacts
cp -r artifacts/sdk release-artifacts
cp -r artifacts/windows-cli/onefuzz.exe release-artifacts/onefuzz-cli-$(./src/ci/get-version.sh).exe
- uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: release-artifacts
build-integration-tests-linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Cache integration tests
id: cache-integration-tests
uses: actions/cache@v3
with:
path: src/integration-tests/artifacts
key: integration-tests|linux|${{ env.ACTIONS_CACHE_KEY_DATE }}|${{ hashFiles('src/integration-tests/**/*') }}
- name: Build integration tests
if: steps.cache-integration-tests.outputs.cache-hit != 'true'
run: |
set -ex
cd src/integration-tests
mkdir -p artifacts
cp integration-test.py artifacts/
mkdir -p artifacts/linux-libfuzzer
mkdir -p artifacts/linux-libfuzzer-with-options
mkdir -p artifacts/mariner-libfuzzer
(cd libfuzzer ; make )
cp -r libfuzzer/fuzz.exe libfuzzer/seeds artifacts/linux-libfuzzer
cp -r libfuzzer/fuzz.exe libfuzzer/seeds artifacts/linux-libfuzzer-with-options
cp -r libfuzzer/fuzz.exe libfuzzer/seeds artifacts/mariner-libfuzzer
mkdir -p artifacts/linux-libfuzzer-regression
(cd libfuzzer-regression ; make )
cp -r libfuzzer-regression/broken.exe libfuzzer-regression/fixed.exe libfuzzer-regression/seeds artifacts/linux-libfuzzer-regression
mkdir -p artifacts/linux-trivial-crash
(cd trivial-crash ; make )
cp -r trivial-crash/fuzz.exe trivial-crash/seeds artifacts/linux-trivial-crash
mkdir -p artifacts/linux-libfuzzer-dlopen
(cd libfuzzer-dlopen; make)
cp -r libfuzzer-dlopen/{fuzz.exe,*.so,seeds} artifacts/linux-libfuzzer-dlopen/
mkdir -p artifacts/linux-libfuzzer-linked-library
(cd libfuzzer-linked-library; make)
cp -r libfuzzer-linked-library/{fuzz.exe,*.so,seeds} artifacts/linux-libfuzzer-linked-library/
mkdir -p artifacts/linux-trivial-crash-asan
(cd trivial-crash ; make clean; make CFLAGS='-fsanitize=address -fno-omit-frame-pointer')
cp -r trivial-crash/fuzz.exe trivial-crash/seeds artifacts/linux-trivial-crash-asan
mkdir -p artifacts/linux-libfuzzer-rust
(cd libfuzzer-rust ; make )
cp -r libfuzzer-rust/fuzz/target/x86_64-unknown-linux-gnu/release/fuzz_target_1 artifacts/linux-libfuzzer-rust
# AFL v2.75b
mkdir -p artifacts/linux-trivial-crash-afl
git clone https://github.com/google/AFL
(cd AFL; git checkout 82b5e359463238d790cadbe2dd494d6a4928bff3; make afl-gcc afl-fuzz afl-as)
export AFL_CC_PATH=$PWD/AFL/afl-clang
(cd trivial-crash ; make clean; make CC=$AFL_CC_PATH)
cp -r trivial-crash/fuzz.exe trivial-crash/seeds artifacts/linux-trivial-crash-afl
# libfuzzer cross-compiled to aarch64
mkdir -p artifacts/linux-libfuzzer-aarch64-crosscompile
(cd libfuzzer-aarch64-crosscompile; make)
cp -r libfuzzer-aarch64-crosscompile/fuzz.exe libfuzzer-aarch64-crosscompile/inputs artifacts/linux-libfuzzer-aarch64-crosscompile
# C# target.
sudo apt-get install -y dotnet-sdk-7.0
(cd GoodBad; dotnet publish -c Release -o out)
mv GoodBad/out artifacts/GoodBadDotnet
- uses: actions/upload-artifact@v3
with:
# NB: this name is used by check-pr.py
name: artifact-integration-tests-linux
path: src/integration-tests/artifacts
build-integration-tests-windows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- name: Cache integration tests
id: cache-integration-tests
uses: actions/cache@v3
with:
path: src/integration-tests/artifacts
key: integration-tests|windows|${{ env.ACTIONS_CACHE_KEY_DATE }}|${{ hashFiles('src/integration-tests/**/*') }}
- name: Setup C/C++ environment
uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # pinned to v1.12.1
- name: Build integration tests
if: steps.cache-integration-tests.outputs.cache-hit != 'true'
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force
$ProgressPreference = 'SilentlyContinue'
Invoke-Expression (Invoke-RestMethod 'https://chocolatey.org/install.ps1')
choco install llvm
choco install make
$env:Path += ";C:\Program Files\LLVM\bin;C:\ProgramData\chocolatey\bin"
cd src/integration-tests
mkdir artifacts/windows-libfuzzer
cd libfuzzer
make
cp fuzz.exe,fuzz.pdb,seeds ../artifacts/windows-libfuzzer -Recurse
cd ../
mkdir artifacts/windows-trivial-crash
cd trivial-crash
make
cp fuzz.exe,fuzz.pdb,seeds ../artifacts/windows-trivial-crash -Recurse
cd ../
mkdir artifacts/windows-libfuzzer-linked-library
cd libfuzzer-linked-library
make -f Makefile.windows
cp fuzz.exe,fuzz.pdb,bad1.dll,bad1.pdb,bad2.dll,bad2.pdb,seeds ../artifacts/windows-libfuzzer-linked-library -Recurse
cd ../
mkdir artifacts/windows-libfuzzer-load-library
cd libfuzzer-load-library
make
cp fuzz.exe,fuzz.pdb,bad.dll,bad.pdb,seeds ../artifacts/windows-libfuzzer-load-library -Recurse
cd ../
mkdir artifacts/windows-trivial-crash-asan
cd trivial-crash
make clean
make CFLAGS='-fsanitize=address -fno-omit-frame-pointer'
cp fuzz.exe,fuzz.pdb,seeds ../artifacts/windows-trivial-crash-asan -Recurse
shell: powershell
- uses: actions/upload-artifact@v3
with:
# NB: this name is used by check-pr.py
name: artifact-integration-tests-windows
path: src/integration-tests/artifacts
integration-tests-linux:
runs-on: ubuntu-20.04
needs:
- build-integration-tests-linux
- dotnet-fuzzing-tools-linux
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: artifact-dotnet-fuzzing-tools-linux
path: dotnet-fuzzing-tools-linux
- uses: actions/download-artifact@v3
with:
name: artifact-integration-tests-linux
path: integration-tests-linux
- name: test
shell: bash
run: |
set -ex -o pipefail
# Must be absolute paths.
export GOODBAD_DOTNET="${GITHUB_WORKSPACE}/integration-tests-linux/GoodBadDotnet"
export LIBFUZZER_DOTNET="${GITHUB_WORKSPACE}/dotnet-fuzzing-tools-linux/third-party/dotnet-fuzzing-linux/libfuzzer-dotnet/libfuzzer-dotnet"
chmod +x $LIBFUZZER_DOTNET
export LIBFUZZER_DOTNET_LOADER="${GITHUB_WORKSPACE}/dotnet-fuzzing-tools-linux/third-party/dotnet-fuzzing-linux/LibFuzzerDotnetLoader/LibFuzzerDotnetLoader"
chmod +x $LIBFUZZER_DOTNET_LOADER
export SHARPFUZZ="${GITHUB_WORKSPACE}/dotnet-fuzzing-tools-linux/third-party/dotnet-fuzzing-linux/sharpfuzz/SharpFuzz.CommandLine"
chmod +x $SHARPFUZZ
./src/ci/test-libfuzzer-dotnet.sh