Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

chore(ci): add yaml linter workflow and fix yaml formatting #98

Merged
merged 8 commits into from
Jan 12, 2025
Merged
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
13 changes: 7 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ name: Go

on:
push:
branches: [ main, 'release/**' ]
branches: [main, "release/**"]
pull_request:
branches: [ main, 'release/**' ]
branches: [main, "release/**"]
workflow_dispatch:

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)$'
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
Expand All @@ -19,15 +19,16 @@ jobs:
with:
go-version: 1.21.4
- name: Run flaky tests sequentially
run: | # Upstream flakes are race conditions exacerbated by concurrent tests
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_generate:
env:
EXCLUDE_REGEX: 'ava-labs/libevm/(accounts/usbwallet/trezor)$'
EXCLUDE_REGEX: "ava-labs/libevm/(accounts/usbwallet/trezor)$"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: golangci-lint

on:
push:
branches: [ main, 'release/**' ]
branches: [main, "release/**"]
pull_request:
branches: [ main, 'release/**' ]
branches: [main, "release/**"]
workflow_dispatch:

permissions:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/libevm-delta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: libevm delta

on:
push:
branches: [ main, 'release/**' ]
branches: [main, "release/**"]
pull_request:
branches: [ main, 'release/**' ]
branches: [main, "release/**"]
workflow_dispatch:

jobs:
Expand All @@ -18,9 +18,10 @@ jobs:
with:
fetch-depth: 0 # everything
fetch-tags: true

- name: Color-blindness a11y
run: | # https://davidmathlogic.com/colorblind/#%23D81B60-%231E88E5-%23FFC107-%23004D40:~:text=8%20pairs%20of%20contrasting%20colors
run:
| # https://davidmathlogic.com/colorblind/#%23D81B60-%231E88E5-%23FFC107-%23004D40:~:text=8%20pairs%20of%20contrasting%20colors
git config color.diff.old "#DC3220";
git config color.diff.new "#005AB5";

Expand All @@ -31,7 +32,7 @@ jobs:
':(exclude).golangci.yml' \
':(exclude).github/**' \
':(exclude)README.md';

- name: git diff {LIBEVM_BASE}..main
run: |
git checkout main --;
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/rename-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
workflow_dispatch:
inputs:
source_commit:
description: 'Upstream commit on which to base module renaming'
description: "Upstream commit on which to base module renaming"
required: true
type: string
default: '2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1'
default: "2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1"

jobs:
rename-module:
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
find . -type f | \
xargs grep -In github.com/ethereum/go-ethereum | \
grep -v "https://github.com/ethereum/go-ethereum"

- name: Set up Go
uses: actions/setup-go@v5
with:
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/yml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: YAML check

on:
pull_request:
branches: [main]
paths:
- "**/*.yml"
- "**/*.yaml"
- ".github/workflows/yml.yml"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Out of interest, why are these two explicitly required?

Copy link
Collaborator Author

@qdm12 qdm12 Jan 12, 2025

Choose a reason for hiding this comment

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

Just so the (non required) workflow only triggers when modifying .yml/.yaml files. I suppose the workflow is yml too, so no need to specify it, but I really added it out of habit without thinking this through 😄 Although thinking about it, it might be worth leaving it in case someone copies the workflow (i.e. to make a markdown one) so he/she doesn't forget to have a trigger file path on the workflow file itself.

- ".github/yamllint.yml"

jobs:
yaml-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate YAML files
run: yamllint -c .yamllint.yml .
5 changes: 4 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,19 @@ linters-settings:
- dot
- blank
goheader:
values:
template-path: .libevm-header

gomodguard:
blocked:
modules:
- github.com/ethereum/go-ethereum:
reason: "Original, forked repo"
- github.com/ava-labs/avalanchego:
reason: "Avoid dependency loop"
- github.com/ava-labs/coreth:
reason: "Avoid dependency loop"
- github.com/ava-labs/subnet-evm:
reason: "Avoid dependency loop"
revive:
rules:
- name: unused-parameter
Expand Down
13 changes: 13 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extends: default

rules:
document-start: disable
line-length: disable
comments:
min-spaces-from-content: 1
truthy:
check-keys: false
ignore:
# Upstream geth files that we don't want to modify unnecessarily.
- .travis.yml
- crypto/secp256k1/libsecp256k1/.travis.yml
Loading