Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/callable-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
unit-test-go-build-${{ runner.os }}-${{ matrix.go-version-alias }}-

- name: Run unit tests with coverage
run: make unittest-json
run: make test/unit/json

- name: Publish unit test results
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3.0.0
Expand All @@ -67,7 +67,7 @@ jobs:
if: always()
run: |
if [ -f build/coverage.out ]; then
make coverage-report | grep "^### Code Coverage:" >> "$GITHUB_STEP_SUMMARY" || true
make coverage/report | grep "^### Code Coverage:" >> "$GITHUB_STEP_SUMMARY" || true
fi

- name: Upload coverage report
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-scanning.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
govulncheck-go-build-${{ runner.os }}-

- name: Run vulnerability scan
run: make vulncheck-sarif
run: make static-analysis/vulncheck/sarif

- name: Upload vulnerability SARIF
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
go mod download -modfile tools/go.mod

- name: Install golangci-lint
run: make install-lint
run: make install/lint

- name: Warm up govulncheck
run: go tool -modfile tools/go.mod govulncheck -version
34 changes: 22 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
GOPATH ?= $(shell go env GOPATH)
GOBIN ?= $(GOPATH)/bin

unittest-json:
@mkdir -p build
@go test -v -json -coverprofile=build/coverage.out -covermode=atomic ./... -timeout 20s -failfast > build/unit-test-output.json

coverage-report:
@go tool cover -html=build/coverage.out -o build/coverage.html
@echo "### Code Coverage: $$(go tool cover -func=build/coverage.out | awk '/^total:/{print $$3}')"
build:
@go build ./...

coverage:
@go tool cover -html=build/coverage.out -o build/coverage.html
@go tool cover -func=build/coverage.out | awk 'END {print $$3}'

vulncheck-sarif:
coverage/report:
@go tool cover -html=build/coverage.out -o build/coverage.html
@echo "### Code Coverage: $$(go tool cover -func=build/coverage.out | awk '/^total:/{print $$3}')"

install/lint:
curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $(GOBIN) v2.12.2

static-analysis/lint:
golangci-lint run --fix

static-analysis/vulncheck:
@go tool -modfile=./tools/go.mod govulncheck ./...

static-analysis/vulncheck/sarif:
@mkdir -p build
@go tool -modfile=./tools/go.mod govulncheck -format sarif ./... > build/govulncheck-report.sarif

install-lint:
curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $(GOBIN) v2.12.2
test/unit:
@mkdir -p build
@go test -v ./... -timeout 20s -failfast -coverprofile=build/coverage.out -covermode=atomic

build:
@go build ./...
test/unit/json:
@mkdir -p build
@go test -v -json -coverprofile=build/coverage.out -covermode=atomic ./... -timeout 20s -failfast > build/unit-test-output.json