Skip to content

Commit

Permalink
Move fuzzing to it's own workflow (#455)
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Co-authored-by: Alan Jowett <alan.jowett@microsoft.com>
  • Loading branch information
Alan-Jowett and Alan Jowett committed May 9, 2024
1 parent e8de891 commit 0f32ea7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 34 deletions.
43 changes: 17 additions & 26 deletions .github/workflows/fuzzing.yml
Expand Up @@ -4,38 +4,29 @@
name: Fuzzing

permissions:
contents: read
contents: write

on:
workflow_call:
inputs:
arch:
description: 'Architecture'
required: true
type: string
schedule: # Run every day at 21:00 UTC
- cron: '00 21 * * *'
workflow_dispatch: # Run manually

platform:
required: true
type: string
env:
platform: ubuntu-latest
arch: x86_64

jobs:
build:
runs-on: ${{ inputs.platform }}
runs-on: ${{ env.platform }}

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Initialize CodeQL
if: inputs.build_codeql == true
uses: github/codeql-action/init@d39d31e687223d841ef683f52467bd88e9b21c14
with:
languages: 'cpp'

- name: Generate the cache key
id: cache_key
run: echo "VALUE=platform-${{ inputs.platform }}_arch=${{ inputs.arch }}_type=fuzzing" >> $GITHUB_OUTPUT
run: echo "VALUE=platform-${{ env.platform }}_arch=${{ env.arch }}_type=fuzzing" >> $GITHUB_OUTPUT

- name: Update the cache (ccache)
uses: actions/cache@v4.0.2
Expand All @@ -49,7 +40,7 @@ jobs:
ccache
- name: Install system dependencies (Linux)
if: inputs.platform == 'ubuntu-latest'
if: env.platform == 'ubuntu-latest'
run: |
sudo apt-get update
Expand All @@ -63,25 +54,25 @@ jobs:
libboost-filesystem-dev \
libelf-dev
if [[ "${{ inputs.scan_build }}" == "true" ]] ; then
if [[ "${{ env.scan_build }}" == "true" ]] ; then
sudo apt-get install -y \
clang-tools
fi
if [[ "${{ inputs.arch }}" == "arm64" ]] ; then
if [[ "${{ env.arch }}" == "arm64" ]] ; then
sudo apt install -y \
g++-aarch64-linux-gnu \
gcc-aarch64-linux-gnu \
qemu-user
fi
- name: Build/install libbpf From Source
if: inputs.platform == 'ubuntu-latest'
if: env.platform == 'ubuntu-latest'
run: ./.github/scripts/build-libbpf.sh
shell: bash

- name: Install system dependencies (macOS)
if: inputs.platform == 'macos-11'
if: env.platform == 'macos-11'
run: |
brew install \
cmake \
Expand All @@ -98,7 +89,7 @@ jobs:
-G Ninja \
-S . \
-B build \
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \
-DCMAKE_BUILD_TYPE=${{ env.build_type }} \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DUBPF_ENABLE_LIBFUZZER=1 \
Expand All @@ -109,7 +100,7 @@ jobs:
run: |
export CCACHE_DIR="$(pwd)/ccache"
if [[ "${{ inputs.scan_build }}" == "true" ]] ; then
if [[ "${{ env.scan_build }}" == "true" ]] ; then
command_prefix="scan-build -o scan_build_report"
fi
Expand Down Expand Up @@ -152,7 +143,7 @@ jobs:
git config --global user.email 'ubpf@users.noreply.github.com'
git config --global user.name 'Github Action'
git commit -sm "Update fuzzing corpus"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/iovisor/ubpf.git
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{github.repository}}.git
git push
- name: Upload artifacts
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/main.yml
Expand Up @@ -310,14 +310,6 @@ jobs:
enable_sanitizers: true
disable_retpolines: true

# Run fuzzing on scheduled task only.
linux_fuzzing:
if: github.event_name == 'schedule'
uses: ./.github/workflows/fuzzing.yml
with:
arch: x86_64
platform: ubuntu-latest

# Disabled until https://github.com/iovisor/ubpf/issues/155 is resolved.
# linux_debug_arm64_sanitizers:
# uses: ./.github/workflows/posix.yml
Expand Down

0 comments on commit 0f32ea7

Please sign in to comment.