From 175a4fd50a78356339c49abd852cff686f05e49f Mon Sep 17 00:00:00 2001 From: Jens Fischer Date: Fri, 15 Mar 2024 09:18:11 +0100 Subject: [PATCH] Add coverage report and badge generation to go-test.yml workflow --- .github/workflows/go-test.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index ece2591..4bdbee2 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -35,4 +35,23 @@ jobs: MONGO_HOST: localhost:27017 MONGO_IMAGE: mongo MONGO_TAG: 7.0.5-rc0 - run: go test -v ./... \ No newline at end of file + run: go test -v ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./... + + - name: Prepare Archive + run: mkdir -p ./out/reports ./out/badges + + - name: Generate coverage report + run: go tool cover -html=cover.out -o=./out/reports/coverage-report.html + + - name: Check test coverage + uses: vladopajic/go-test-coverage@v2 + with: + profile: cover.out + local-prefix: github.com/telekom/pubsub-horizon-vortex + badge-file-name: ./out/badges/coverage.svg + + - name: Archive production artifacts + uses: actions/upload-artifact@v4 + with: + name: artifacts + path: ./out/** \ No newline at end of file