From 416604d40aa96295e81a1469d4ca473f380c4866 Mon Sep 17 00:00:00 2001 From: Brandur Date: Sat, 24 Feb 2024 22:22:15 -0800 Subject: [PATCH] Consolidate lint steps in GitHub Actions Like with running Go tests, the lints for each separate Go module must be running separately. This is currently being accomplished in CI by giving each Go module its own lint job using golangci-lint's GitHub Action. Unfortunately, this is really not working out well. Although the lints themselves are all very fast to run (just a couple seconds), the post run step where it saves it cache is quite slow, about two minutes, and that's happening for each of the lint steps, making the entire lint job take almost _ten minutes_ to run. Here, try to hack around the problem by having the main lint job fetch golangci-lint, but then only run `--help`, and then do the real linting as a separate step (one that doesn't use the GitHub Action) that calls into our `make lint` target to run lints for each Go module. A downside is that it may not annotate lint problems on the GitHub PR, which is something that theoretically happened before, although it never seemed to work for me. This might not be that bad though because it could as a side effect improve the log output, which is terrible for the GitHub Action step because it doesn't include files or line numbers. [1] https://github.com/golangci/golangci-lint-action/issues/271 --- .github/workflows/ci.yml | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 068d76b8..f05420ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -164,37 +164,9 @@ jobs: uses: golangci/golangci-lint-action@v4 with: version: ${{ env.GOLANGCI_LINT_VERSION }} - working-directory: . - - name: Lint cmd/river - uses: golangci/golangci-lint-action@v4 - with: - version: ${{ env.GOLANGCI_LINT_VERSION }} - working-directory: ./cmd/river - - - name: Lint riverdriver - uses: golangci/golangci-lint-action@v4 - with: - version: ${{ env.GOLANGCI_LINT_VERSION }} - working-directory: ./riverdriver - - - name: Lint riverdriver/riverdatabasesql - uses: golangci/golangci-lint-action@v4 - with: - version: ${{ env.GOLANGCI_LINT_VERSION }} - working-directory: ./riverdriver/riverdatabasesql - - - name: Lint riverdriver/riverpgxv5 - uses: golangci/golangci-lint-action@v4 - with: - version: ${{ env.GOLANGCI_LINT_VERSION }} - working-directory: ./riverdriver/riverpgxv5 - - - name: Lint rivertype - uses: golangci/golangci-lint-action@v3 - with: - version: ${{ env.GOLANGCI_LINT_VERSION }} - working-directory: ./rivertype + - name: Run lint + run: make lint producer_sample: runs-on: ubuntu-latest