Skip to content

Commit

Permalink
infra: drop codacy, use cov (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
primalmotion authored Dec 12, 2022
1 parent d0ef560 commit 8f8f5fb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 34 deletions.
3 changes: 0 additions & 3 deletions .codacy.yaml

This file was deleted.

34 changes: 8 additions & 26 deletions .github/workflows/build-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,27 @@ 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/[email protected]
- name: setup-for-newer-go
if: ${{ matrix.go > 1.17 }}
run: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- name: build
run: |
make
# note: uncertain how gracefully this handles the matrix
- name: coverage
uses: codacy/codacy-coverage-reporter-action@v1
- uses: PaloAltoNetworks/[email protected]
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"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ midgardctl/midgardctl
testresults.xml
vendor
*.lock
*.cov
unit_coverage.out
artifacts
dist
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ lint:
golangci-lint run \
--disable-all \
--exclude-use-default=false \
--exclude=package-comments \
--enable=errcheck \
--enable=goimports \
--enable=ineffassign \
Expand All @@ -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 ./...

0 comments on commit 8f8f5fb

Please sign in to comment.