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

- New workflow triggering only on yaml file changes using the built-in `yamllint`
- `.yamllint.yml` configuration added at the root of the project
- Fix existing yml files to satisfy ymllint
- Ignore go-ethereum original yml files
This commit is contained in:
Quentin McGaw 2025-01-12 14:56:08 +01:00 committed by GitHub
parent ce2cde5662
commit c996175b46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 53 additions and 17 deletions

View file

@ -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
@ -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

View file

@ -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:

View file

@ -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:
@ -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";
@ -31,7 +32,7 @@ jobs:
':(exclude).golangci.yml' \
':(exclude).github/**' \
':(exclude)README.md';
- name: git diff {LIBEVM_BASE}..main
run: |
git checkout main --;

View file

@ -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:
@ -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:

18
.github/workflows/yml.yml vendored Normal file
View file

@ -0,0 +1,18 @@
name: YAML check
on:
pull_request:
branches: [main]
paths:
- "**/*.yml"
- "**/*.yaml"
- ".github/workflows/yml.yml"
- ".github/yamllint.yml"
jobs:
yaml-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate YAML files
run: yamllint -c .yamllint.yml .

View file

@ -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

13
.yamllint.yml Normal file
View file

@ -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