name: Go on: push: branches: [main, "release/**"] pull_request: branches: [main, "release/**"] workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} 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_short, go_test_tooling, go_generate, go_tidy] steps: - run: echo "Dependencies successful" go_test_short: env: # See build/checksums.txt for the latest version and checksum EXECUTION_SPEC_TESTS_VERSION: v2.1.0 EXECUTION_SPEC_TESTS_FILE: fixtures_develop.tar.gz FLAKY_REGEX: "ava-labs/libevm/(triedb/pathdb|eth|eth/tracers/js|eth/tracers/logger|eth/tracers/internal/tracetest|accounts/abi/bind|accounts/keystore|eth/downloader|miner|ethclient|ethclient/gethclient|eth/catalyst)$" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: recursive - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: "go.mod" - name: Download spec tests run: curl -o "${EXECUTION_SPEC_TESTS_FILE}" -L "https://github.com/ethereum/execution-spec-tests/releases/download/${EXECUTION_SPEC_TESTS_VERSION}/${EXECUTION_SPEC_TESTS_FILE}" - name: Verify spec tests run: | sha256sum --ignore-missing --check build/checksums.txt | grep "${EXECUTION_SPEC_TESTS_FILE}: OK" - name: Extract spec tests run: mkdir -p tests/spec-tests && tar -xz -f "${EXECUTION_SPEC_TESTS_FILE}" -C tests/spec-tests - name: Run flaky tests sequentially run: | # Upstream flakes are race conditions exacerbated by concurrent tests go list ./... | grep -P "${FLAKY_REGEX}" | xargs -n 1 go test -short; - name: Run non-flaky tests concurrently run: | go test -short $(go list ./... | grep -Pv "${FLAKY_REGEX}"); go_test_tooling: runs-on: ubuntu-latest defaults: run: working-directory: ./libevm/tooling env: TARGET_BRANCH: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # everything ref: ${{ github.event.pull_request.head.sha }} - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: "./libevm/tooling/go.mod" - name: Create local `main` if non-existent run: git show-ref --quiet --verify refs/heads/main || git branch main origin/main - run: go test -v ./... --target_branch="${{ env.TARGET_BRANCH }}" 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 strategy: matrix: dir: ["./", "./libevm/tooling"] defaults: run: working-directory: ${{ matrix.dir }} steps: - uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: "${{ matrix.dir }}/go.mod" - run: go mod tidy - run: git diff --exit-code