From bc42e5f29c8d677cbdcc31860a30a10d4a31a415 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg <519948+ARR4N@users.noreply.github.com> Date: Fri, 14 Feb 2025 16:48:55 +0000 Subject: [PATCH] chore(ci): consolidate linters (#139) ## Why this should be merged Branch-protection rules only require the Go linter (erroneously called `lint`) by mistake. All linters are now dependencies of a single `lint` job that remains as a PR gate. New linters will now be enforced by default. Closes #138 ## How this works GitHub Actions `need` configuration. The path limitation of running `yamllint` is removed because it's such a cheap job so is ok to always run. ## How this was tested Inspection of CI run and PR's required jobs: ![image](https://github.com/user-attachments/assets/9454ca35-8a7f-4393-bdd8-5029cfaaf7e6) ![image](https://github.com/user-attachments/assets/e92b964d-5a64-415d-b8a3-1e9c84af3060) --- .github/workflows/go.yml | 2 +- .../workflows/{golangci-lint.yml => lint.yml} | 29 +++++++++++++++++-- .github/workflows/shellcheck.yml | 22 -------------- .github/workflows/yml.yml | 22 -------------- 4 files changed, 27 insertions(+), 48 deletions(-) rename .github/workflows/{golangci-lint.yml => lint.yml} (68%) delete mode 100644 .github/workflows/shellcheck.yml delete mode 100644 .github/workflows/yml.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 1a1d51fa28..ad55ba2469 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -85,4 +85,4 @@ jobs: needs: go_tidy_matrix runs-on: ubuntu-latest steps: - - run: echo "I'm a no-op" + - run: echo "Dependencies successful" diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/lint.yml similarity index 68% rename from .github/workflows/golangci-lint.yml rename to .github/workflows/lint.yml index d06bad71d7..6dbaf7a08e 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,7 @@ -name: golangci-lint +name: lint + +# If adding a new linter: (a) create a new job; and (b) add it to the `needs` +# list of the `lint` job as this is what gates PRs. on: push: @@ -18,8 +21,13 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: - golangci: - name: lint + lint: + runs-on: ubuntu-latest + needs: [golangci-lint, yamllint, shellcheck] + steps: + - run: echo "Dependencies successful" + + golangci-lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -40,3 +48,18 @@ jobs: uses: golangci/golangci-lint-action@v6 with: version: v1.60 + + yamllint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: yamllint -c .yamllint.yml . + + shellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@2.0.0 + with: + scandir: './libevm' diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml deleted file mode 100644 index 8e91378eb0..0000000000 --- a/.github/workflows/shellcheck.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: shellcheck - -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: - shellcheck: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run ShellCheck - uses: ludeeus/action-shellcheck@2.0.0 - with: - scandir: './libevm' diff --git a/.github/workflows/yml.yml b/.github/workflows/yml.yml deleted file mode 100644 index ece1d12573..0000000000 --- a/.github/workflows/yml.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: YAML check - -on: - pull_request: - branches: [main] - paths: - - "**/*.yml" - - "**/*.yaml" - - ".github/workflows/yml.yml" - - ".github/yamllint.yml" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} - -jobs: - yaml-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Validate YAML files - run: yamllint -c .yamllint.yml .