From d32575c1ea3b2d2171436683c5ef60bc0b34f13e Mon Sep 17 00:00:00 2001 From: knbr13 Date: Mon, 19 Feb 2024 20:35:09 +0200 Subject: [PATCH 1/4] add code coverage --- .github/workflows/test.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 41b0886..67053b9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,6 +4,7 @@ on: pull_request: branches: - main + workflow_dispatch: jobs: test: @@ -27,3 +28,9 @@ jobs: - name: Run tests run: go test ./... + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + env: + token: ${{ secrets.CODECOV_TOKEN }} + slug: knbr13/gitcs From 6fbf8d4d735b7a9b2c24ffd4c718bad8658e6ee7 Mon Sep 17 00:00:00 2001 From: knbr13 Date: Mon, 19 Feb 2024 21:50:44 +0200 Subject: [PATCH 2/4] update coverage --- .github/workflows/test.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 67053b9..f31efb4 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -32,5 +32,7 @@ jobs: - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4.0.1 env: + fail_ci_if_error: true + files: ./coverage.txt token: ${{ secrets.CODECOV_TOKEN }} - slug: knbr13/gitcs + verbose: trueslug: knbr13/gitcs From 96bfe89c1c960cfa529338aeee5443d4ab733868 Mon Sep 17 00:00:00 2001 From: knbr13 Date: Tue, 20 Feb 2024 07:04:11 +0200 Subject: [PATCH 3/4] update token --- .github/workflows/test.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f31efb4..3496a2c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -33,6 +33,5 @@ jobs: uses: codecov/codecov-action@v4.0.1 env: fail_ci_if_error: true - files: ./coverage.txt - token: ${{ secrets.CODECOV_TOKEN }} - verbose: trueslug: knbr13/gitcs + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + slug: knbr13/gitcs From 1eebb25bd7aca823917bcf034cfb6f70e1d2e556 Mon Sep 17 00:00:00 2001 From: knbr13 Date: Tue, 20 Feb 2024 07:15:04 +0200 Subject: [PATCH 4/4] update token --- .github/workflows/test.yaml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3496a2c..d0d8b90 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -26,12 +26,19 @@ jobs: - name: setup tests run: ./setup-test.sh - - name: Run tests - run: go test ./... + - name: Run tests and generate coverage report + run: | + go test -coverprofile=coverage.out ./... + go tool cover -func=coverage.out -o coverage.txt + go tool cover -html=coverage.out -o coverage.html - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.0.1 - env: + uses: codecov/codecov-action@v4 + with: + verbose: true + name: codecov-umbrella + file: coverage.txt fail_ci_if_error: true - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} slug: knbr13/gitcs + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}