diff --git a/.github/workflows/cargo_fuzz.yml b/.github/workflows/cargo_fuzz.yml new file mode 100644 index 0000000..b6867c8 --- /dev/null +++ b/.github/workflows/cargo_fuzz.yml @@ -0,0 +1,32 @@ +--- +name: Cargo fuzz build +on: + push: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build_fuzzing: + strategy: + matrix: + os: [ubuntu-18.04, macos-10.15] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + with: + submodules: "true" + - uses: actions-rs/toolchain@v1 + with: + target: thumbv7em-none-eabi + - uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install Python dependencies + run: python -m pip install --upgrade pip setuptools wheel + - name: Set up OpenSK + run: ./setup.sh + - name: Set up fuzzing + run: ./fuzzing_setup.sh + + - name: Cargo fuzz build + run: cargo fuzz build diff --git a/fuzzing_setup.sh b/fuzzing_setup.sh new file mode 100755 index 0000000..66edabb --- /dev/null +++ b/fuzzing_setup.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Ensure the script doesn't fail on Github workflows +export TERM=${TERM:-vt100} +done_text="$(tput bold)DONE.$(tput sgr0)" + +set -e + +# Install cargo-fuzz library. +cargo install cargo-fuzz