Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Release CI workflow, implement timeout in fuzzing script and add it to release ci workflow #2103

Merged
merged 11 commits into from
Jan 30, 2024
Merged
39 changes: 39 additions & 0 deletions .github/workflows/release-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release CI
run-name: Release CI triggered from @${{ github.actor }} of ${{ github.head_ref }}

on:
workflow_dispatch:
merge_group:
pull_request:
push:
branches:
- master
- develop
jobs:
build_and_run:
runs-on: ubuntu-8

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('Dockerfile') }}
restore-keys: ${{ runner.os }}-buildx-


- name: Check PR Label For Release label
if: ${{ !contains(github.event.*.labels.*.name, 'release') }}
run: |
echo "Not a release candidate. Skipping workflow."
exit 0
23 changes: 21 additions & 2 deletions scripts/fuzz.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ cd "$mydir"

function printusage {
echo Usage: $0 --build \[--binary-path PATH\]
echo " " $0 \<fuzzer-name\> \[--binary-path PATH\] \[--fuzzcache-path PATH\] \[--nitro-path PATH\]
echo " " $0 \<fuzzer-name\> \[--binary-path PATH\] \[--fuzzcache-path PATH\] \[--nitro-path PATH\] \[--duration DURATION\]
echo
echo fuzzer names:
echo " " FuzzPrecompiles
echo " " FuzzInboxMultiplexer
echo " " FuzzStateTransition
echo
echo " " duration in minutes
}

if [[ $# -eq 0 ]]; then
Expand All @@ -26,6 +28,7 @@ fuzzcachepath=../target/var/fuzz-cache
nitropath=../
run_build=false
test_group=""
duration=60
while [[ $# -gt 0 ]]; do
case $1 in
--nitro-path)
Expand Down Expand Up @@ -55,6 +58,15 @@ while [[ $# -gt 0 ]]; do
shift
shift
;;
--duration)
anodar marked this conversation as resolved.
Show resolved Hide resolved
duration="$2"
if ! [[ "$duration" =~ ^[0-9]+$ ]]; then
echo "Invalid timeout duration. Please specify positive integer (in minutes)"
exit 1
fi
shift
shift
;;
--build)
run_build=true
shift
Expand Down Expand Up @@ -95,5 +107,12 @@ if $run_build; then
fi

if [[ ! -z $test_group ]]; then
"$binpath"/${test_group}.fuzz -test.run "^$" -test.fuzzcachedir "$fuzzcachepath" -test.fuzz $test_name
timeout "$((60 * duration))" "$binpath"/${test_group}.fuzz -test.run "^$" -test.fuzzcachedir "$fuzzcachepath" -test.fuzz $test_name || exit_status=$?
fi

if [ -n "$exit_status" ] && [ $exit_status -ne 0 ] && [ $exit_status -ne 124 ]; then
echo "Fuzzing failed."
exit $exit_status
fi

echo "Fuzzing succeeded."
Loading