From b95b2f918a7721ba0abf0e2b8f450ec744e40c01 Mon Sep 17 00:00:00 2001 From: Mike Johanson Date: Wed, 7 Feb 2024 13:45:31 -0700 Subject: [PATCH] ci: add linter --- .github/workflows/main.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f3153e49..b4e9e454 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,6 @@ on: push: branches: [ main ] pull_request: - branches: [ main ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -42,14 +41,21 @@ jobs: run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi - name: Run go vet run: go vet ./... + - name: Run go lint + if: ${{ matrix.os == 'ubuntu-20.04' }} + uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0 + with: + version: latest - name: Install Test Converter and run tests if: ${{ matrix.os == 'ubuntu-20.04' }} run: | export GOPATH="$HOME/go/" export PATH=$PATH:$GOPATH/bin go install github.com/jstemmer/go-junit-report/v2@latest - go test -v 2>&1 ./... | go-junit-report -set-exit-code > rpc-go-unit.xml - + go test -covermode=atomic -coverprofile=coverage.out -race -v ./... > test_output.txt 2>&1 || true + cat test_output.txt + cat test_output.txt | go-junit-report -set-exit-code > junit.xml + if grep -q "FAIL" test_output.txt; then exit 1; fi - name: run the tests with coverage run: go test ./... -coverprofile=coverage.out -covermode=atomic