Skip to content

use larger runner for fuzzer binary builder #6

use larger runner for fuzzer binary builder

use larger runner for fuzzer binary builder #6

name: Build on demand fuzz targets
on:
# Run when a new release or rc is created
release:
types: [released, prereleased]
# Run on-demand
workflow_dispatch:
inputs:
branch_type:
type: choice
required: true
options:
- master
- release
- rc
description: Type of branch to build fuzz targets
branch_ref:
type: string
required: true
description: Branch name or tag to build from
jobs:
build_fuzzers:
runs-on: "ubuntu-20.04"
permissions:
contents: "read"
id-token: "write"
steps:
- id: "auth"
uses: "google-github-actions/auth@v1"
with:
workload_identity_provider: "projects/968400232856/locations/global/workloadIdentityPools/project-identity-pool/providers/github-provider"
service_account: "near-fuzzer-service-account@near-fuzzer.iam.gserviceaccount.com"
- name: Installing nightly rust
run: |
rustup install nightly
rustup default nightly
- name: Set swap to 10G
shell: bash
run: |
export SWAP_FILE=$(swapon --show=NAME | tail -n 1)
sudo swapoff $SWAP_FILE
sudo rm $SWAP_FILE
sudo fallocate -l 10G $SWAP_FILE
sudo chmod 600 $SWAP_FILE
sudo mkswap $SWAP_FILE
sudo swapon $SWAP_FILE
- uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941
with:
crate: cargo-bolero
- run: rustup target add --toolchain nightly wasm32-unknown-unknown
- name: "Set up GCP SDK"
uses: "google-github-actions/setup-gcloud@v1"
- name: Checkout Release/RC branch
if: contains(fromJSON('["released", "prereleased"]'), github.event.action)
uses: actions/checkout@master
- name: Checkout ${{ github.event.inputs.branch_ref }} branch
if: ${{ github.event_name == 'workflow_dispatch'}}
uses: actions/checkout@master
with:
ref: ${{ github.event.inputs.branch_ref }}
- name: Build Release branch fuzz targets
if: ${{ github.event.action == 'released'}}
run: echo "branch_type=release" >> "$GITHUB_ENV"
- name: Build RC branch fuzz targets
if: ${{ github.event.action == 'prereleased'}}
run: echo "branch_type=rc" >> "$GITHUB_ENV"
- name: Build fuzz targets from ${{ github.event.inputs.branch_ref }}" branch
if: ${{ github.event_name == 'workflow_dispatch'}}
run: echo "branch_type=${{ github.event.inputs.branch_type }}" >> "$GITHUB_ENV"
- name: "Compile fuzzers and upload to GCS"
- run: |
NAME="nearcore-$branch_type-$(env TZ=Etc/UTC date +"%Y%m%d%H%M%S")"
cargo +nightly bolero build-clusterfuzz --all-features --profile fuzz
gsutil cp -Z target/fuzz/clusterfuzz.tar "gs://fuzzer_targets/$branch_type/$NAME.tar.gz"