From 8f8f5fb53cca17974e1a06a0d4a759220a9c990d Mon Sep 17 00:00:00 2001 From: primalmotion <208711+primalmotion@users.noreply.github.com> Date: Mon, 12 Dec 2022 11:00:48 -0800 Subject: [PATCH] infra: drop codacy, use cov (#64) --- .codacy.yaml | 3 --- .github/workflows/build-go.yaml | 34 ++++++++------------------------- .gitignore | 2 +- Makefile | 6 ++---- 4 files changed, 11 insertions(+), 34 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..b8262b0 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: "85" diff --git a/.gitignore b/.gitignore index 07e4886..de3dabc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,6 @@ midgardctl/midgardctl testresults.xml vendor *.lock -*.cov +unit_coverage.out artifacts dist diff --git a/Makefile b/Makefile index 5618c3d..57793f7 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 \ @@ -27,10 +28,7 @@ lint: ./... test: - go test ./... -race -cover -covermode=atomic -coverprofile=unit_coverage.cov - - @ echo "Converting the coverage file..." - gocov convert ./unit_coverage.cov | gocov-xml > ./coverage.xml + go test ./... -race -cover -covermode=atomic -coverprofile=unit_coverage.out sec: gosec -quiet ./...