diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml new file mode 100644 index 0000000000..036bf46538 --- /dev/null +++ b/.github/workflows/release-ci.yml @@ -0,0 +1,27 @@ +name: Release CI +run-name: Release CI triggered from @${{ github.actor }} of ${{ github.head_ref }} + +on: + workflow_dispatch: + +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- diff --git a/Dockerfile b/Dockerfile index b23c7f0736..de054843cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/scripts/fuzz.bash b/scripts/fuzz.bash index d236f90ce8..6271b917b6 100755 --- a/scripts/fuzz.bash +++ b/scripts/fuzz.bash @@ -7,12 +7,14 @@ cd "$mydir" function printusage { echo Usage: $0 --build \[--binary-path PATH\] - echo " " $0 \ \[--binary-path PATH\] \[--fuzzcache-path PATH\] \[--nitro-path PATH\] + echo " " $0 \ \[--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 @@ -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) @@ -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 @@ -83,6 +95,11 @@ 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 @@ -90,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."