Skip to content

Commit a11c922

Browse files
janiszmtodor
andauthored
setup junit output (#7)
Signed-off-by: Tomasz Janiszewski <[email protected]> Co-authored-by: Mladen Todorovic <[email protected]>
1 parent fe67e29 commit a11c922

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ jobs:
3030
run: go mod download
3131

3232
- name: Run tests with coverage
33-
run: make test
33+
run: make test-coverage-and-junit
34+
35+
- name: Upload test results to Codecov
36+
uses: codecov/test-results-action@v1
37+
with:
38+
token: ${{ secrets.CODECOV_TOKEN }}
3439

3540
- name: Upload coverage to Codecov
3641
uses: codecov/codecov-action@v5

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
# Claude Code
77
.claude/
88

9-
# Test coverage output
9+
# Test output
1010
/*.out
11+
/*junit.xml
1112

1213
# Build output
1314
/stackrox-mcp

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ LDFLAGS=-ldflags "-X github.com/stackrox/stackrox-mcp/internal/server.version=$(
2020
# Coverage files
2121
COVERAGE_OUT=coverage.out
2222

23+
# JUnit files
24+
JUNIT_OUT=junit.xml
25+
2326
# Lint files
2427
LINT_OUT=report.xml
2528

@@ -33,8 +36,13 @@ build: ## Build the binary
3336
$(GOBUILD) $(LDFLAGS) -o $(BINARY_NAME) ./cmd/stackrox-mcp
3437

3538
.PHONY: test
36-
test: ## Run unit tests with coverage
37-
$(GOTEST) -v -cover -coverprofile=$(COVERAGE_OUT) ./...
39+
test: ## Run unit tests
40+
$(GOTEST) -v ./...
41+
42+
.PHONY: test-coverage-and-junit
43+
test-coverage-and-junit: ## Run unit tests with coverage and junit output
44+
go install github.com/jstemmer/go-junit-report/[email protected]
45+
$(GOTEST) -v -cover -race -coverprofile=$(COVERAGE_OUT) ./... -json 2>&1 | go-junit-report -parser gojson > $(JUNIT_OUT)
3846

3947
.PHONY: coverage-html
4048
coverage-html: test ## Generate and open HTML coverage report

0 commit comments

Comments
 (0)