Skip to content

chore(ci): merge go and lint workflows and jobs together #144

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 46 additions & 46 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,78 +11,78 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

permissions:
# Required: allow read access to the content for analysis.
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` linter option.
pull-requests: read

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]
needs: [libevm, tooling]
steps:
- run: echo "Dependencies successful"

go_test_short:
libevm:
runs-on: ubuntu-latest
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

- run: yamllint -c .yamllint.yml .

- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
go-version-file: go.mod

- run: go mod tidy
- name: Run `go generate`
run: go list ./... | grep -Pv "${EXCLUDE_REGEX}" | xargs go generate;
- run: git diff --exit-code

- name: goheader
if: ${{ github.event_name == 'pull_request' }}
# The goheader linter is only enabled in the CI so that it runs only on modified or new files
# (see only-new-issues: true). It is disabled in .golangci.yml because
# golangci-lint running locally is not aware of new/modified files compared to the base
# commit of a pull request, and we want to avoid reporting invalid goheader errors.
uses: golangci/golangci-lint-action@v6
with:
version: v1.60
only-new-issues: true
args: --enable-only goheader

- uses: golangci/golangci-lint-action@v6
with:
version: v1.60

- 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}");
run: go test -short $(go list ./... | grep -Pv "${FLAKY_REGEX}");

go_test_tooling:
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
- uses: ludeeus/action-shellcheck@2.0.0
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
scandir: "./libevm"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be

Suggested change
scandir: "./libevm"
scandir: "./libevm/tooling"

?


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
- uses: actions/setup-go@v5
with:
go-version-file: "${{ matrix.dir }}/go.mod"
go-version-file: ./libevm/tooling/go.mod

- run: go mod tidy
- run: go generate ./...
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this was added, in case we add //go:generate commands in code in the future.

- run: git diff --exit-code

- run: go test ./...
65 changes: 0 additions & 65 deletions .github/workflows/lint.yml

This file was deleted.

Loading