From 4dc993c18e651ce3064da8265c4c5507d554a1f5 Mon Sep 17 00:00:00 2001 From: Brent Graveland Date: Thu, 25 Apr 2024 08:10:46 -0600 Subject: [PATCH] Update CI to use golangci-lint --- .github/workflows/go.yml | 55 ++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f5c03ed..dc895ad 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -2,30 +2,53 @@ name: Go on: push: - branches: [ master ] + branches: [ "**" ] pull_request: - branches: [ master ] + branches: [ "**" ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + pull-requests: read + checks: write + jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version: 1.22 + cache: false + + - name: lint + uses: golangci/golangci-lint-action@v5 + with: + version: latest + build: strategy: - matrix: + fail-fast: false + matrix: go-versions: [1.16.x, 1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x] + runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v2 + - uses: actions/checkout@v4 + + - name: Setup go + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-versions }} - - name: Install - run: GO111MODULE=off go get golang.org/x/lint/golint - - name: Run gofmt - run: diff -u <(echo -n) <(gofmt -d *.go) - - name: Run golint - run: diff -u <(echo -n) <(golint $(go list -e ./... | grep -v /goyaml) | grep -v YAMLToJSON) - - name: Run go vet - run: GO111MODULE=on go vet . + cache: false + - name: Run go test run: GO111MODULE=on go test -v -race ./... - - name: Check diff - run: git diff --exit-code