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

Fix fuzzer.bash script and entrypoint in docker file #2102

Merged
merged 22 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ec2541b
Fix nitro-fuzzer entrypoint argument
anodar Jan 25, 2024
4445f93
Fix script to complain when neither build nor fuzzer name is specified
anodar Jan 25, 2024
2e5832e
Add flag to fuzz script for timeout
anodar Jan 25, 2024
601681a
Add workflow for release ci that is triggered with PR tag, run nitro …
anodar Jan 25, 2024
86cf5ca
Trigger workflow from label instead of PR title
anodar Jan 25, 2024
32ea163
Update workflow triggering conditions
anodar Jan 25, 2024
991f055
Fix workflow syntax
anodar Jan 25, 2024
e71ca4b
Yet another attempt to fix workflow syntax
anodar Jan 25, 2024
ee8cc8d
Checout submodules recursively in the workflow, cache docker layers
anodar Jan 25, 2024
14fb850
Ignore timeout error, and error out only if the fuzzing binary errors…
anodar Jan 26, 2024
c65ecb4
Merge branch 'master' into fix-fuzzer-entrypoint
anodar Jan 29, 2024
e8e1fb3
Merge branch 'fix-fuzzer-entrypoint' into release-testing
anodar Jan 29, 2024
e5757b8
Merge branch 'master' into fix-fuzzer-entrypoint
anodar Jan 30, 2024
254de23
Revert running fuzzer in release-ci
anodar Jan 30, 2024
444eae3
Merge branch 'release-testing' of github.com:OffchainLabs/nitro into …
anodar Jan 30, 2024
208119b
Merge pull request #2103 from OffchainLabs/release-testing
anodar Jan 30, 2024
2770f81
Merge branch 'master' into fix-fuzzer-entrypoint
anodar Jan 30, 2024
d08507c
Merge branch 'master' into fix-fuzzer-entrypoint
anodar Jan 31, 2024
07c74c7
Change release workflow trigger condition
anodar Jan 31, 2024
5969a11
Change trigger to workflow_dispatch only
anodar Feb 1, 2024
b127b8a
Merge branch 'master' into fix-fuzzer-entrypoint
anodar Feb 2, 2024
f4810cc
Merge branch 'master' into fix-fuzzer-entrypoint
joshuacolvin0 Feb 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make since to use

on:
  release:
    types: [created, published]

instead? That way you don't need to check for release label either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to that.

My reasoning behind having label that triggers it was for the case where one makes big changes and wants to run more exhaustive testing without creating a release.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you said actually makes more sense rather than triggering on actual release. What do you think about just having it trigger on workflow_dispatch for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SG, changed to that.

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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ FROM debian:bookworm-slim as nitro-fuzzer
COPY --from=fuzz-builder /workspace/fuzzers/*.fuzz /usr/local/bin/
COPY ./scripts/fuzz.bash /usr/local/bin
RUN mkdir /fuzzcache
ENTRYPOINT [ "/usr/local/bin/fuzz.bash", "--binary-path", "/usr/local/bin/", "--fuzzcache-path", "/fuzzcache" ]
ENTRYPOINT [ "/usr/local/bin/fuzz.bash", "FuzzStateTransition", "--binary-path", "/usr/local/bin/", "--fuzzcache-path", "/fuzzcache" ]

FROM debian:bookworm-slim as nitro-node-slim
WORKDIR /home/user
Expand Down
28 changes: 26 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)
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 @@ -83,12 +95,24 @@ while [[ $# -gt 0 ]]; do
esac
done

if [[ "$run_build" == "false" && -z "$test_group" ]]; then
echo you must specify either --build flag or fuzzer-name
printusage
fi

if $run_build; then
for build_group in system_tests arbstate; do
go test -c ${nitropath}/${build_group} -fuzz Fuzz -o "$binpath"/${build_group}.fuzz
done
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