Skip to content

Commit

Permalink
ci: Use golangci-lint-action
Browse files Browse the repository at this point in the history
Instead of downloading and installing golangci-lint manually,
use the golangci-lint-action.

Besides caching Go-specific files,
this also caches information computed by golangci-lint
so lint checks should run faster.

For this change, I've left the version of golangci-lint
the same as what we were using previously.
  • Loading branch information
abhinav committed Aug 1, 2023
1 parent 56e26fe commit 5a8bac4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/stage-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ permissions: read-all

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOLANGCI_LINT_VERSION: v1.53

jobs:
lint:
container: golangci/golangci-lint:latest
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
Expand All @@ -19,17 +19,20 @@ jobs:
uses: actions/setup-go@v4
with:
go-version: 1.20.x
# golangci-lint-action handles all the caching for Go.
cache: false
- run: go mod tidy -go=1.19
- name: Fail if god mod not tidy
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "::error go.mod not tidy"
exit 1
fi
- name: Lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.3
make lint-golang || true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}

check-copyright:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 5a8bac4

Please sign in to comment.