From 1eed54511a932777565233900b41093fab3d8219 Mon Sep 17 00:00:00 2001 From: primalmotion <208711+primalmotion@users.noreply.github.com> Date: Mon, 12 Dec 2022 10:54:13 -0800 Subject: [PATCH] infra: drop codacy, use cov (#103) --- .codacy.yaml | 3 --- .github/workflows/build-go.yaml | 34 ++++++++------------------------- .gitignore | 2 +- Makefile | 4 ++-- 4 files changed, 11 insertions(+), 32 deletions(-) delete mode 100644 .codacy.yaml diff --git a/.codacy.yaml b/.codacy.yaml deleted file mode 100644 index 9deb8ad..0000000 --- a/.codacy.yaml +++ /dev/null @@ -1,3 +0,0 @@ -exclude_paths: - - "**/integ/*" - - "**_test.go" diff --git a/.github/workflows/build-go.yaml b/.github/workflows/build-go.yaml index 2f5dcc9..6e44dd9 100644 --- a/.github/workflows/build-go.yaml +++ b/.github/workflows/build-go.yaml @@ -19,33 +19,17 @@ jobs: fail-fast: false matrix: go: - - 1.17 - 1.18 - 1.19 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: go-version: ${{ matrix.go }} + cache: true - name: setup - run: | - go version - go install github.com/securego/gosec/cmd/gosec@latest - #go install golang.org/x/tools/cmd/cover@latest - go install github.com/axw/gocov/gocov@master - go install github.com/AlekSi/gocov-xml@latest - - - name: setup-for-older-go - if: ${{ matrix.go <= 1.17 }} - run: | - # stay on an older version of golangci-lint which still builds against 1.17 - # This is due to the introduction of generics. - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.3 - - - name: setup-for-newer-go - if: ${{ matrix.go > 1.17 }} run: | go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest @@ -53,11 +37,9 @@ jobs: run: | make - # note: uncertain how gracefully this handles the matrix - - name: coverage - uses: codacy/codacy-coverage-reporter-action@v1 + - uses: PaloAltoNetworks/cov@1.0.0 + if: ${{matrix.go == 1.19}} with: - project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - - # a comma-separated list - coverage-reports: "./coverage.xml" + main_branch: master + cov_file: unit_coverage.out + cov_threshold: "80" diff --git a/.gitignore b/.gitignore index 710fc16..8cc450c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ testresults.xml .DS_Store *.lock vendor -*.cov +unit_coverage.out .idea artifacts profile.out diff --git a/Makefile b/Makefile index 58dbf5a..4d9dc1f 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ lint: golangci-lint run \ --disable-all \ --exclude-use-default=false \ + --exclude=package-comments \ --enable=errcheck \ --enable=goimports \ --enable=ineffassign \ @@ -26,8 +27,7 @@ lint: ./... test: - go test ./... -race -cover -covermode=atomic -coverprofile=unit_coverage.cov - gocov convert ./unit_coverage.cov | gocov-xml > ./coverage.xml + go test ./... -race -cover -covermode=atomic -coverprofile=unit_coverage.out sec: gosec -quiet ./...