-
Notifications
You must be signed in to change notification settings - Fork 98
87 lines (85 loc) · 3.79 KB
/
fuzzing.yml
File metadata and controls
87 lines (85 loc) · 3.79 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
name: Celix Fuzzing
on:
push:
pull_request:
schedule:
- cron: '0 3 * * *'
jobs:
fuzz-utils:
runs-on: ubuntu-22.04
permissions:
actions: read
timeout-minutes: 30
steps:
- name: Checkout source code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3.3.0
- name: Set up Python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c #v4.9.1
with:
python-version: '3.x'
- name: Set Compiler Environment Variables
run: |
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
- name: Install Conan
run: pip install conan
- name: Cache Conan
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 #v4.3.0
with:
path: ~/.conan2/p
key: ${{ runner.os }}-conan-${{ hashFiles('conanfile.py', 'libs/utils/**') }}
restore-keys: |
${{ runner.os }}-conan-
- name: Setup Conan Profile
run: |
conan profile detect
- name: Conan install
run: conan install . --output-folder=build --build=missing -o "celix/*:build_utils=True" -o "celix/*:enable_fuzzing=True" -o "celix/*:enable_address_sanitizer=True" -o "celix/*:enable_undefined_sanitizer=True"
- name: Conan build
run: conan build . --output-folder=build -o "celix/*:build_utils=True" -o "celix/*:enable_fuzzing=True" -o "celix/*:enable_address_sanitizer=True" -o "celix/*:enable_undefined_sanitizer=True" -o "celix/*:celix_err_buffer_size=5120"
- name: Restore previous fuzzing corpora artifact
continue-on-error: true #can fail if no previous fuzzing-corpora-artifact exists
env:
GH_TOKEN: ${{ github.token }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: |
#retrieve lastest master / Celix Fuzzing run id
RUN_ID=$(gh run list --branch "${BRANCH_NAME}" --workflow "${{ github.workflow }}" --json databaseId --jq '.[0].databaseId')
gh run download "$RUN_ID" --name fuzzing-corpora-artifact
mkdir -p build/libs/utils/fuzzing
tar -xzf fuzzing-corpora-artifact.tar.gz -C fuzzing-previous
- name: Set fuzzer run time
id: set-runtime
run: |
if [[ "${{ github.event_name }}" == "schedule" ]]; then
echo "FUZZ_TIME=600" >> ${GITHUB_ENV}
else
echo "FUZZ_TIME=30" >> ${GITHUB_ENV}
fi
- name: Run properties fuzzer
run: |
source build/conanrun.sh
./build/libs/utils/fuzzing/celix_properties_fuzzer -max_total_time=$FUZZ_TIME ./build/libs/utils/fuzzing/properties_corpus
- name: Run version fuzzer
run: |
source build/conanrun.sh
./build/libs/utils/fuzzing/celix_version_fuzzer -max_total_time=$FUZZ_TIME ./build/libs/utils/fuzzing/version_corpus
- name: Run filter fuzzer
run: |
source build/conanrun.sh
./build/libs/utils/fuzzing/celix_filter_fuzzer -max_total_time=$FUZZ_TIME ./build/libs/utils/fuzzing/filter_corpus
- name: Package fuzzing corpora artifacts
if: always() #Always package & upload updated fuzzing corpora artifacts
run: |
mkdir -p fuzzing-artifact
for path in build/libs/utils/fuzzing/*_corpus; do
cp -a "$path" fuzzing-artifact/
done
tar -czf fuzzing-corpora-artifact.tar.gz -C fuzzing-artifact .
- name: Upload fuzzing artifacts
#Always package & upload updated fuzzing corpora artifact on the master branch
if: always() && github.ref == 'refs/heads/master'
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 #v4.3.1
with:
name: fuzzing-corpora-artifact
path: fuzzing-corpora-artifact.tar.gz