Skip to content

Commit

Permalink
Revert "Add test coverage changes as comment on PRs (#225)" (#239)
Browse files Browse the repository at this point in the history
This reverts commit e2b3221.
  • Loading branch information
akoserwal authored Nov 14, 2024
1 parent e2b3221 commit 74e01f4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 35 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: CI Build and Test

on:
workflow_call:
push:
branches: ['main']
pull_request:
branches: ['main']

Expand All @@ -29,28 +27,3 @@ jobs:
run: go build -tags release -v ./...
- name: Test
run: make test
- name: Store coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.out

code-coverage:
name: "test coverage change report"
continue-on-error: true
if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main
runs-on: ubuntu-latest
needs: build-and-test # Depends on the artifact uploaded by the "build-and-test" job
permissions:
contents: read
actions: read # to download code coverage results from "test" job
pull-requests: write # write permission needed to comment on PR
steps:
# this will fail if the target branch does not already have a coverage.out file uploaded as an artifact
- uses: fgrosse/[email protected]
with:
coverage-artifact-name: "coverage-report"
coverage-file-name: "coverage.out"
# below options used to make coverage work across forks
trim: github.com/project-kessel/inventory-api
root-package: ""
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# HTML test coverage report produce with `go tool cover`
coverage.html

# Dependency directories (remove the comment below to include it)
vendor/
Expand Down
7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,7 @@ test:
@$(GO) test ./... -count=1 -coverprofile=coverage.out -skip 'TestInventoryAPIGRPC_*|TestInventoryAPIHTTP_*|Test_ACMKafkaConsumer'
@echo "Overall test coverage:"
@$(GO) tool cover -func=coverage.out | grep total: | awk '{print $$3}'

.PHONY: test-coverage
# run all tests and create html coverage report, this takes a couple extra seconds
test-coverage: test
@$(GO) tool cover -html=coverage.out -o coverage.html
@echo "coverage report written to coverage.html"
@rm coverage.out


.PHONY: generate
Expand Down

0 comments on commit 74e01f4

Please sign in to comment.