feat(sae): Add RPC backend for Header #587
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Go | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| # If adding a new job, add it to the `needs` list of the `go` job as this is | |
| # what gates PRs. | |
| go: | |
| runs-on: ubuntu-latest | |
| needs: [go_test, go_generate, go_tidy, require_fuzz_corpus] | |
| # TODO(arr4n) investigate why setup-go wasn't properly caching fuzz corpora | |
| # and then reinstate a go_fuzz job that extends them. | |
| steps: | |
| - run: echo "Dependencies successful" | |
| go_test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: "go.mod" | |
| - run: go test ./... | |
| go_generate: | |
| env: | |
| EXCLUDE_REGEX: "ava-labs/libevm/(accounts/usbwallet/trezor)$" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: "go.mod" | |
| - name: Run `go generate` | |
| run: go list ./... | grep -Pv "${EXCLUDE_REGEX}" | xargs go generate; | |
| - name: git diff | |
| run: git diff --exit-code | |
| go_tidy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: "go.mod" | |
| - run: go mod tidy | |
| - run: git diff --exit-code | |
| find_fuzz_targets: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| targets: ${{ steps.find.outputs.targets }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: find | |
| run: | | |
| echo "targets=$(grep --recursive --include '**_test.go' -oP "^func \KFuzz[^(]+" | xargs jq -c -n '$ARGS.positional' --args)" >> $GITHUB_OUTPUT | |
| require_fuzz_corpus: | |
| needs: [find_fuzz_targets] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: ${{fromJSON(needs.find_fuzz_targets.outputs.targets)}} | |
| env: | |
| # The actual corpus size is dependent on the test in question and how many | |
| # "interesting" cases can be found. This is an arbitrary lower bound, | |
| # chosen as approximately half the size of the very basic | |
| # `FuzzEffectiveGasTip`. | |
| MIN_CORPUS_SIZE: 20 | |
| steps: | |
| - run: | | |
| echo "${{ matrix.target }}" | awk -F: '{print $1}' | xargs dirname | xargs -i echo "PACKAGE={}" >> "$GITHUB_ENV" | |
| - run: | | |
| echo "${{ matrix.target }}" | awk -F: '{print $2}' | xargs -i echo "FUNCTION={}" >> "$GITHUB_ENV" | |
| - run: | | |
| echo "CORPUS_DIR=./${PACKAGE}/testdata/fuzz/${FUNCTION}" >> "$GITHUB_ENV" | |
| - uses: actions/checkout@v4 | |
| - name: Require existing corpus of at least ${MIN_CORPUS_SIZE} | |
| run: | # Raw `go test` will be meaningful, and `-fuzz` won't start from nowhere | |
| [ -d "${CORPUS_DIR}" ] && [ $(ls "${CORPUS_DIR}" | wc -l) -gt ${MIN_CORPUS_SIZE} ] |