Skip to content

Commit 32f31a9

Browse files
authoredMar 12, 2025··
Fix/test coverage (gofr-dev#1570)
1 parent 51e8223 commit 32f31a9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

‎.github/workflows/go.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ jobs:
9999
export APP_ENV=test
100100
# Run tests for the examples directory with coverage
101101
go test gofr.dev/examples/... -v -short -coverprofile packageWithpbgo.cov -coverpkg=gofr.dev/examples/...
102-
# Filter out generated protobuf files from coverage report
103-
grep -vE '^gofr\.dev\/.*\.pb\.go' packageWithpbgo.cov > profile.cov
102+
# Filter out auto-generated files by protobuf and gofr framework from coverage report
103+
grep -vE '^gofr\.dev\/.*(\.pb\.go|hello\.proto|hello_grpc\.pb\.go|health_client\.go|hello_client\.go|hello_gofr\.go|health_gofr\.go)' packageWithpbgo.cov > profile.cov
104104
# Display coverage statistics
105105
go tool cover -func profile.cov
106106
@@ -147,11 +147,13 @@ jobs:
147147
command: |
148148
export APP_ENV=test
149149
# Run tests for the pkg directory with coverage
150-
go test gofr.dev/pkg/... -v -short -coverprofile package.cov -coverpkg=gofr.dev/pkg/...
150+
cd pkg
151+
go test ./... -v -short -coverprofile package.cov -coverpkg=./...
151152
# Filter out mock files from coverage report
152153
grep -v '/mock_' package.cov > profile.cov
154+
mv profile.cov ../profile.cov
153155
# Display coverage statistics
154-
go tool cover -func profile.cov
156+
go tool cover -func ../profile.cov
155157
156158
# Upload coverage report for the 1.24 Go version only
157159
- name: Upload Test Coverage

0 commit comments

Comments
 (0)
Please sign in to comment.