Skip to content

Commit

Permalink
adding coverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
grundprinzip committed Aug 11, 2024
1 parent 2a6d6b4 commit 1efbc55
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ jobs:
run: |
# make integration
make gen && make && make integration
- name: Run Code Coverage
run: |
make coverage
- uses: PaloAltoNetworks/cov@3.0.0
with:
cov_mode: coverage
main_branch: master
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ internal/generated.out

# Ignore Coverage Files
coverage*
cov.report

# Ignore IDE files
.idea/
Expand All @@ -31,4 +32,4 @@ cmd/spark-connect-example-spark-session/spark-connect-example-spark-session
target
lib

deps
deps
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ This requires the following tools to be present in your PATH:
2. `gofumpt` for formatting Go code
3. `golangci-lint` for linting Go code

### Running Tests

To run the tests locally, you can run:

```bash
make test
```

This will run the unit tests. If you want to run the integration tests, you can run:

```bash
make integration
```

Lastly, if you want to run all tests and generate the coverage analysis, you can run:

```bash
make fulltest
```

The output of the coverage analysis will be in the `coverage.out` file. An HTML version of
the coverage report is generated and accessible at `coverage.html`.

### How to write tests

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ test: $(BUILD_OUTPUT)
@echo -n " ";\
$(GO) test -v -run '(Test|Example)' $(BUILDFLAGS) $(TESTFLAGS) $(pkg) || exit 1)

fulltest: $(BUILD_OUTPUT)
coverage: $(BUILD_OUTPUT)
@echo ">> TEST, \"coverage\""
@$(GO) test -cover -coverprofile=coverage.out -covermode=atomic -coverpkg=./spark/...,./internal/tests/... ./spark/... ./internal/tests/...
@$(GO) tool cover -html=coverage.out -o coverage-all.html
@$(GO) tool cover -html=coverage.out -o coverage.html

integration: $(BUILD_OUTPUT)
@echo ">> TEST, \"integration\""
Expand Down

0 comments on commit 1efbc55

Please sign in to comment.