Skip to content

Commit e07c323

Browse files
committed
Set up continuous fuzzing with CI Sense
1 parent 40c1dde commit e07c323

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

.github/workflows/main.yaml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: CI Fuzz
2+
# Set an action secret called "CI_FUZZ_API_TOKEN" with an API token
3+
# generated in CI Fuzz web interface.
4+
5+
on:
6+
workflow_dispatch:
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
env:
13+
# CI Sense gRPC URL.
14+
FUZZING_SERVER_ADDRESS: grpc.code-intelligence.com:443
15+
# CI Sense HTTP URL.
16+
WEB_APP_ADDRESS: https://app.code-intelligence.com
17+
# Directory in which the repository will be cloned.
18+
CHECKOUT_DIR: checkout-dir/
19+
CIFUZZ_DOWNLOAD_URL: "https://github.com/CodeIntelligenceTesting/cifuzz/releases/latest/download/cifuzz_installer_linux_amd64"
20+
CIFUZZ_INSTALL_DIR: ./cifuzz
21+
FUZZING_ARTIFACT: fuzzing-artifact.tar.gz
22+
jobs:
23+
fuzz_tests:
24+
runs-on: ubuntu-latest
25+
container: cifuzz/builder-zint:llvm-13
26+
steps:
27+
- id: checkout
28+
name: Checkout Repository
29+
uses: actions/checkout@v2
30+
with:
31+
path: ${{ env.CHECKOUT_DIR }}
32+
- id: install-cifuzz
33+
name: Install cifuzz
34+
run: |
35+
curl --fail --silent --show-error --location -o cifuzz_installer "$CIFUZZ_DOWNLOAD_URL"
36+
chmod u+x cifuzz_installer
37+
./cifuzz_installer --install-dir $CIFUZZ_INSTALL_DIR
38+
- id: install-depdendencies
39+
name: Install Dependencies
40+
run: |
41+
apt-get update && apt-get install -y libssl-dev
42+
- id: build-fuzzers
43+
name: Build Fuzzers
44+
run: |
45+
export cifuzz_DIR="$GITHUB_WORKSPACE/$CIFUZZ_INSTALL_DIR/share/cmake"
46+
cd $CHECKOUT_DIR/
47+
$GITHUB_WORKSPACE/$CIFUZZ_INSTALL_DIR/bin/cifuzz bundle \
48+
--commit $GITHUB_SHA \
49+
--branch $GITHUB_REF_NAME \
50+
--output $GITHUB_WORKSPACE/$CHECKOUT_DIR/$FUZZING_ARTIFACT
51+
shell: "bash"
52+
- id: start-fuzzing
53+
name: Start Fuzzing
54+
uses: CodeIntelligenceTesting/github-actions/start-fuzzing@v5
55+
with:
56+
ci_fuzz_api_token: ${{ secrets.CI_FUZZ_API_TOKEN }}
57+
fuzzing_server_address: ${{ env.FUZZING_SERVER_ADDRESS }}
58+
fuzzing_artifact: ${{ env.CHECKOUT_DIR }}/${{ env.FUZZING_ARTIFACT }}
59+
checkout_directory: ${{ env.CHECKOUT_DIR }}
60+
project: "projects/prj-ho58fmjYVGuQ"
61+
- id: monitor-fuzzing
62+
name: Fuzzing
63+
uses: CodeIntelligenceTesting/github-actions/monitor-fuzzing@v5
64+
with:
65+
ci_fuzz_api_token: ${{ secrets.CI_FUZZ_API_TOKEN }}
66+
test_collection_run: ${{ steps.start-fuzzing.outputs.test_collection_run }}
67+
fuzzing_server_address: ${{ env.FUZZING_SERVER_ADDRESS }}
68+
dashboard_address: ${{ env.WEB_APP_ADDRESS }}
69+
- id: save-results
70+
name: Save Fuzz Test Results
71+
uses: CodeIntelligenceTesting/github-actions/save-results@v5
72+
if: ${{ success() || failure() }}
73+
with:
74+
ci_fuzz_api_token: ${{ secrets.CI_FUZZ_API_TOKEN }}
75+
test_collection_run: ${{ steps.start-fuzzing.outputs.test_collection_run }}
76+
fuzzing_server_address: ${{ env.FUZZING_SERVER_ADDRESS }}
77+
dashboard_address: ${{ env.WEB_APP_ADDRESS }}
78+
- id: upload-artifact
79+
uses: actions/upload-artifact@v2
80+
if: ${{ (success() || failure()) }}
81+
with:
82+
name: ci_fuzz_results
83+
path: |
84+
findings.json
85+
coverage.json
86+
web_app_address.txt

0 commit comments

Comments
 (0)