Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use codecov config and only send merged coverage file #3751

Merged
merged 15 commits into from
Jul 29, 2024
19 changes: 16 additions & 3 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: coverage-output-unit
path: coverage-output-unit/coverage.out
path: coverage-output-unit

test-e2e:
strategy:
Expand Down Expand Up @@ -123,8 +123,17 @@ jobs:
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true'}}
- name: Run e2e tests
run: make test-e2e
run: |
make test-e2e
if: ${{ !(github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true') }}
- name: Stop e2e tests controller
run: |
pgrep -f go-build -a
pkill -f go-build
sleep 5
echo "done stopping process"
ls -lah coverage-output-e2e/
if: ${{ !(github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' && matrix.kubernetes.latest)}}
- name: Output Rerun Overview
run: |
[[ -f rerunreport.txt ]] && cat rerunreport.txt || echo "No rerun report found"
Expand Down Expand Up @@ -160,6 +169,7 @@ jobs:
with:
go-version: ${{ env.GOLANG_VERSION }}
id: go
- uses: actions/checkout@v4
- name: Get e2e code coverage
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
Expand All @@ -172,11 +182,14 @@ jobs:
path: coverage-output-unit
- name: combine-go-coverage
run: |
go tool covdata percent -i=coverage-output-unit/,coverage-output-e2e/ -o full-coverage.out
go tool covdata textfmt -i=coverage-output-unit/,coverage-output-e2e/ -o full-coverage.out
- name: Upload code coverage information to codecov.io
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
file: full-coverage.out
fail_ci_if_error: false
codecov_yml_path: .codecov.yml
disable_search: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ test-e2e: install-devtools-local
.PHONY: test-unit
test-unit: install-devtools-local ## run unit tests
mkdir -p coverage-output-unit
${DIST_DIR}/gotestsum --junitfile=junit-unit-test.xml --format=testname -- -covermode=count -coverprofile=coverage-output-unit/coverage.out `go list ./... | grep -v ./test/cmd/metrics-plugin-sample`
${DIST_DIR}/gotestsum --junitfile=junit-unit-test.xml --format=testname -- `go list ./... | grep -v ./test/cmd/metrics-plugin-sample` -cover -test.gocoverdir=$(CURDIR)/coverage-output-unit


.PHONY: coverage
Expand Down
Loading