go-ethereum/.github/workflows/go.yml
Arran Schlosberg 0ed61356ed
refactor(params): make LibEVMVersion a constant (#162)
> [!NOTE]
> This will be merged into `main` once the current target branch has
been merged.

## Why this should be merged

My original implementation was back to front and it's been bugging me.

## How this works

Originally `params.LibEVMVersion` was a `var` (because it needed to be
computed) and the test used a `const`. This change simply inverts the
two and moves some code around without any change in logic.

I bumped the minor version to 2 (a no-op when not on a release branch)
to bring it in line with the latest release candidate and to avoid
forgetting to do so when performing an actual release.

## How this was tested

Unit test of version-string constant.
2025-03-17 19:29:16 +00:00

91 lines
2.6 KiB
YAML

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:
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
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- 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
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "./libevm/tooling/go.mod"
- run: 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