Skip to content

Commit 34b11c4

Browse files
jhrotkondeloof
authored andcommitted
Add test summary for test jobs in ci
Signed-off-by: Joana Hrotko <[email protected]>
1 parent a7acf5f commit 34b11c4

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

.github/workflows/ci.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ jobs:
129129
name: coverage-data-unit
130130
path: bin/coverage/unit/
131131
if-no-files-found: error
132-
132+
-
133+
name: Unit Test Summary
134+
uses: test-summary/action@v2
135+
with:
136+
paths: bin/coverage/unit/report.xml
137+
if: always()
133138
e2e:
134139
runs-on: ubuntu-latest
135140
strategy:
@@ -202,7 +207,12 @@ jobs:
202207
rm -f /usr/local/bin/docker-compose
203208
cp bin/build/docker-compose /usr/local/bin
204209
make e2e-compose-standalone
205-
210+
-
211+
name: e2e Test Summary
212+
uses: test-summary/action@v2
213+
with:
214+
paths: /tmp/report/report.xml
215+
if: always()
206216
coverage:
207217
runs-on: ubuntu-22.04
208218
needs:

Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,14 @@ RUN --mount=type=bind,target=. \
106106
--mount=type=cache,target=/go/pkg/mod \
107107
rm -rf /tmp/coverage && \
108108
mkdir -p /tmp/coverage && \
109-
go test -tags "$BUILD_TAGS" -v -cover -covermode=atomic $(go list $(TAGS) ./... | grep -vE 'e2e') -args -test.gocoverdir="/tmp/coverage" && \
109+
rm -rf /tmp/report && \
110+
mkdir -p /tmp/report && \
111+
go run gotest.tools/gotestsum@latest --format testname --junitfile "/tmp/report/report.xml" -- -tags "$BUILD_TAGS" -v -cover -covermode=atomic $(go list $(TAGS) ./... | grep -vE 'e2e') -args -test.gocoverdir="/tmp/coverage" && \
110112
go tool covdata percent -i=/tmp/coverage
111113

112114
FROM scratch AS test-coverage
113115
COPY --from=test --link /tmp/coverage /
116+
COPY --from=test --link /tmp/report /
114117

115118
FROM base AS license-set
116119
ARG LICENSE_FILES

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ install: binary
7575

7676
.PHONY: e2e-compose
7777
e2e-compose: ## Run end to end local tests in plugin mode. Set E2E_TEST=TestName to run a single test
78-
go test -v $(TEST_FLAGS) -count=1 ./pkg/e2e
78+
go run gotest.tools/gotestsum@latest --format testname --junitfile "/tmp/report/report.xml" -- -v $(TEST_FLAGS) -count=1 ./pkg/e2e
7979

8080
.PHONY: e2e-compose-standalone
8181
e2e-compose-standalone: ## Run End to end local tests in standalone mode. Set E2E_TEST=TestName to run a single test
82-
go test $(TEST_FLAGS) -v -count=1 -parallel=1 --tags=standalone ./pkg/e2e
82+
go run gotest.tools/gotestsum@latest --format testname --junitfile "/tmp/report/report.xml" -- $(TEST_FLAGS) -v -count=1 -parallel=1 --tags=standalone ./pkg/e2e
8383

8484
.PHONY: build-and-e2e-compose
8585
build-and-e2e-compose: build e2e-compose ## Compile the compose cli-plugin and run end to end local tests in plugin mode. Set E2E_TEST=TestName to run a single test

0 commit comments

Comments
 (0)