From a61a6d57ad95b9905badabc4fdaa60b8fe426c72 Mon Sep 17 00:00:00 2001 From: Corduroy Bera Date: Thu, 19 Oct 2023 17:36:09 -0400 Subject: [PATCH] feat(actions): fuzz testing --- .github/workflows/e2e.yml | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index ae61d8acb8..70b1a07f88 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -180,3 +180,52 @@ jobs: run: make test-${{ matrix.namespace }} env: GOPATH: /home/runner/go + + fuzz: + needs: build-localnet + strategy: + matrix: + os: [polaris-linux-latest] + go-version: [1.21.3] + base-image: [localnet] + runs-on: ${{ matrix.os }} + steps: + - name: Setup Golang + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go-version }} + - name: Download image artifact + uses: actions/download-artifact@v2 + with: + name: ${{ matrix.base-image }} + - name: Load image + run: docker load -i ${{ matrix.base-image }}.tar + - name: Checkout tx-fuzz + uses: actions/checkout@v3 + with: + repository: corduroybera/tx-fuzz + path: txfuzz + token: ${{ secrets.CORDUROY_PAT }} + ref: master + - name: Start Node + shell: bash {0} + continue-on-error: true + run: | + nohup make start < /dev/null & + sleep 10 + cd txfuzz/cmd/livefuzzer + go build + timeout 180s ./livefuzzer spam --sk=${{secrets.SECRET_KEY}} --txtimeout=6 --blocktime=1 + + if [ $? -eq 124 ]; then + echo "Fuzz successful." + echo "FUZZ_SUCCESS=true" >> $GITHUB_ENV + else + echo "Error occurred while fuzzing." + echo "FUZZ_SUCCESS=false" >> $GITHUB_ENV + fi + - name: Check success + run: | + if [ "$FUZZ_SUCCESS" == "false" ]; then + exit 1 + fi