go-ethereum/.github/workflows/go.yml
Arran Schlosberg b0332b5168
chore(ci): add merge_group trigger to required workflows (#160)
## Why this should be merged

Allows ruleset-required workflows to be triggered by a merge queue, not
just the PR for the merge. Although `main` isn't a particularly "busy"
branch, a merge queue will ensure that CI passes on the exact version of
code that is about to be merged; i.e. (from the [docs]):

> The merge queue provides the same benefits as the **Require branches
to be up to date before merging** branch protection, but does not
require a pull request author to update their pull request branch and
wait for status checks to finish before trying to merge.

[docs]:
https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue#about-merge-queues

## How this works

Adds `merge_group` workflow trigger with [recommended
type](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#merge_group).

## How this was tested

N/A (worst-case it has to be reverted and another PR is temporarily
blocked).
2025-03-11 13:57:57 +00:00

90 lines
2.5 KiB
YAML

name: Go
on:
push:
branches: [main, "release/**"]
pull_request:
branches: [main, "release/**"]
merge_group:
types: [checks_requested]
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
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:
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