Skip to content

Commit

Permalink
Merge pull request #10 from robgonnella/fix-issue-with-coverage
Browse files Browse the repository at this point in the history
Fixes issue with generating coverage badge
  • Loading branch information
robgonnella authored Nov 17, 2023
2 parents 7e74739 + 4fb9dc4 commit da69b7c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Go Coverage Badge
uses: tj-actions/coverage-badge-go@v2
with:
filename: coverage/coverage.txt
filename: coverage/coverage.out

- name: Verify Changed files
uses: tj-actions/verify-changed-files@v16
Expand Down
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ darwin_objects = $(component_path)_darwin_$(arch)

#### Test Objects ####
test_output_dir = coverage
coverage_out = $(test_output_dir)/coverage.txt
coverage_profile = $(test_output_dir)/coverage.profile
coverage_out = $(test_output_dir)/coverage.out

#### Gather Objects ####

Expand Down Expand Up @@ -79,21 +80,25 @@ lint:

.PHONY: test
test:
rm -rf $(test_output_dir)
mkdir -p $(test_output_dir)
rm -rf $(coverage_out)
go test \
-v \
-coverprofile $(coverage_out) \
-coverprofile $(coverage_profile) \
-covermode=atomic \
./...

.PHONY: print-coverage
print-coverage:
go tool cover -func $(coverage_profile)

.PHONY: coverage
coverage:
go tool cover -func $(coverage_out)
go tool cover -func $(coverage_profile) -o=$(coverage_out)

.PHONY: test-report
test-report:
go tool cover -html=$(coverage_out)
go tool cover -html=$(coverage_profile)

.PHONY: deps
deps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# go-lanscan
![Coverage](https://img.shields.io/badge/Coverage-1-red)
![Coverage](https://img.shields.io/badge/Coverage-90.8%25-brightgreen)

A network cli and golang package that allows you to perform arp and syn
scanning on a local area network.
Expand Down

0 comments on commit da69b7c

Please sign in to comment.