From cd3d471d28359d069d1fa224fc874f60cb8de6f3 Mon Sep 17 00:00:00 2001 From: Claudio d'Angelis Date: Fri, 27 Dec 2024 16:15:24 +0100 Subject: [PATCH] chore(ci): add linter (#346) * chore(ci): add linter * fix(ci): use proper job name * fix(ci): syntax * chore(ci): fix ubuntu version * chore(ci): fix ubuntu version * fix(ci): use proper pipeline condition --- .github/workflows/main.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5c12fa0..45beedc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,15 +1,33 @@ name: CI on: push: + branches: [ main ] + pull_request: +permissions: + contents: read +env: + GOLANG_VERSION: 1.21.x jobs: + lint: + name: lint + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GOLANG_VERSION }} + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.60 test: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: Setup Go uses: actions/setup-go@v4 with: - go-version: '1.21.x' + go-version: ${{ env.GOLANG_VERSION }} - name: Install dependencies run: go get . - name: Build @@ -17,8 +35,8 @@ jobs: - name: Test with the Go CLI run: go test ./... release: - runs-on: ubuntu-latest - needs: test + runs-on: ubuntu-24.04 + needs: [ lint, test ] if: startsWith(github.event.ref, 'refs/tags/') steps: - uses: actions/checkout@v2 @@ -29,7 +47,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v1 with: - go-version: 1.21.x + go-version: ${{ env.GOLANG_VERSION }} # Runs the goreleaser - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5