go-ethereum/.github/workflows/go.yml
Arran Schlosberg bc42e5f29c
chore(ci): consolidate linters (#139)
## Why this should be merged

Branch-protection rules only require the Go linter (erroneously called
`lint`) by mistake. All linters are now dependencies of a single `lint`
job that remains as a PR gate. New linters will now be enforced by
default.

Closes #138 

## How this works

GitHub Actions `need` configuration. The path limitation of running
`yamllint` is removed because it's such a cheap job so is ok to always
run.

## How this was tested

Inspection of CI run and PR's required jobs:


![image](https://github.com/user-attachments/assets/9454ca35-8a7f-4393-bdd8-5029cfaaf7e6)


![image](https://github.com/user-attachments/assets/e92b964d-5a64-415d-b8a3-1e9c84af3060)
2025-02-14 11:48:55 -05:00

88 lines
2.4 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:
go_test_short:
env:
FLAKY_REGEX: "ava-labs/libevm/(triedb/pathdb|eth|eth/tracers/js|eth/tracers/logger|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
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: 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_matrix:
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
go_tidy:
# Each matrix instance runs as a different name, which doesn't play nicely
# with branch-protection rules. We instead require this job.
needs: go_tidy_matrix
runs-on: ubuntu-latest
steps:
- run: echo "Dependencies successful"