mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-21 14:14:30 +00:00
## Why this should be merged The release-branch CI job tests branch properties of the `git` DAG but GitHub's `actions/checkout` by default creates a speculative merge commit against which PR CI is run. Running against this hypothetical situation makes the tests fail. ## How this works [`actions/checkout` uses PR tip](https://github.com/actions/checkout?tab=readme-ov-file#checkout-pull-request-head-commit-instead-of-merge-commit) ## How this was tested Future run against a release branch. --------- Signed-off-by: Quentin McGaw <quentin.mcgaw@gmail.com>
93 lines
2.8 KiB
YAML
93 lines
2.8 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
|
|
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
|