forked from unicode-rs/unicode-normalization
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d5d794
commit 38db9c3
Showing
5 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Mayhem | ||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build: | ||
name: 'build mayhem fuzzing container' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
file: mayhem/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
outputs: | ||
image: ${{ steps.meta.outputs.tags }} | ||
|
||
mayhem: | ||
needs: build | ||
name: 'fuzz ${{ matrix.mayhemfile }}' | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
mayhemfile: | ||
- mayhem/unicode-normalization.mayhemfile | ||
- mayhem/streaming.mayhemfile | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Start analysis for ${{ matrix.mayhemfile }} | ||
uses: ForAllSecure/mcode-action@v1 | ||
with: | ||
mayhem-token: ${{ secrets.MAYHEM_TOKEN }} | ||
args: --image ${{ needs.build.outputs.image }} --file ${{ matrix.mayhemfile }} --duration 300 | ||
sarif-output: sarif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/target | ||
.git | ||
mayhem/Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Build Stage | ||
FROM ghcr.io/evanrichter/cargo-fuzz:latest as builder | ||
|
||
## Add source code to the build stage. | ||
ADD . /src | ||
WORKDIR /src | ||
|
||
RUN echo building instrumented harnesses && \ | ||
bash -c "pushd fuzz && cargo +nightly -Z sparse-registry fuzz build && popd" && \ | ||
mv fuzz/target/x86_64-unknown-linux-gnu/release/unicode-normalization /unicode-normalization && \ | ||
mv fuzz/target/x86_64-unknown-linux-gnu/release/streaming /streaming && \ | ||
echo done | ||
|
||
RUN echo building non-instrumented harnesses && \ | ||
export RUSTFLAGS="--cfg fuzzing -Clink-dead-code -Cdebug-assertions -C codegen-units=1" && \ | ||
bash -c "pushd fuzz && cargo +nightly -Z sparse-registry build --release && popd" && \ | ||
mv fuzz/target/release/unicode-normalization /unicode-normalization_no_inst && \ | ||
mv fuzz/target/release/streaming /streaming_no_inst && \ | ||
echo done | ||
|
||
# Package Stage | ||
FROM rustlang/rust:nightly | ||
|
||
COPY --from=builder /unicode-normalization /unicode-normalization_no_inst / | ||
COPY --from=builder /streaming /streaming_no_inst / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
project: unicode-normalization | ||
target: streaming | ||
|
||
cmds: | ||
- cmd: /streaming | ||
- cmd: /streaming_no_inst @@ | ||
libfuzzer: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
project: unicode-normalization | ||
target: unicode-normalization | ||
|
||
cmds: | ||
- cmd: /unicode-normalization | ||
- cmd: /unicode-normalization_no_inst @@ | ||
libfuzzer: false |