Skip to content

Commit 6f2e511

Browse files
authored
ci(coverage): separate coverage test and coverage report (#3740)
- upload/download logic allow local diagnose and more lightweight retry
1 parent 397f496 commit 6f2e511

File tree

2 files changed

+80
-28
lines changed

2 files changed

+80
-28
lines changed

.github/workflows/coverage.yml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ jobs:
4343
BUILD_SHARED_LIBS: ON
4444
TESTING_ENABLE_STRIP: ON
4545
steps:
46-
- uses: actions/checkout@v3
46+
- uses: actions/checkout@v4
4747
with:
4848
submodules: true
4949

5050
- name: download lcov
51-
uses: actions/checkout@v3
51+
uses: actions/checkout@v4
5252
with:
5353
repository: linux-test-project/lcov
5454
ref: v1.16
@@ -73,18 +73,38 @@ jobs:
7373
7474
- name: debug
7575
if: always()
76-
run: |
76+
run: |
7777
du -d 1 -h build
7878
df -h
7979
80+
- name: upload coverage
81+
uses: actions/upload-artifact@v3
82+
with:
83+
# include the generated html report in build/coverage, great for local diagnose
84+
name: coverage-cpp-${{ github.sha }}
85+
path: |
86+
build/coverage.*
87+
build/coverage/
88+
retention-days: 3
89+
90+
coverage-publish:
91+
needs: ["coverage"]
92+
runs-on: ubuntu-latest
93+
steps:
94+
- uses: actions/checkout@v4
95+
with:
96+
submodules: true
97+
98+
- name: Download Artifacts
99+
uses: actions/download-artifact@v3
100+
with:
101+
name: coverage-cpp-${{ github.sha }}
102+
path: build
103+
80104
- name: Upload Coverage Report
81105
uses: codecov/codecov-action@v3
82106
with:
83107
files: build/coverage.info
84108
name: coverage-cpp
85109
fail_ci_if_error: true
86110
verbose: true
87-
88-
- name: stop service
89-
run: |
90-
./steps/ut_zookeeper.sh stop

.github/workflows/sdk.yml

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,14 @@ jobs:
133133
./mvnw --batch-mode prepare-package
134134
./mvnw --batch-mode scoverage:report
135135
136-
- name: upload maven coverage
137-
uses: codecov/codecov-action@v3
136+
- name: upload coverage
137+
uses: actions/upload-artifact@v3
138138
with:
139-
files: java/**/target/site/jacoco/jacoco.xml,java/**/target/scoverage.xml
140-
name: coverage-java
141-
fail_ci_if_error: true
142-
verbose: true
139+
name: coverage-java-report-${{ github.sha }}
140+
path: |
141+
java/**/target/site/jacoco/jacoco.xml
142+
java/**/target/scoverage.xml
143+
retention-days: 3
143144

144145
- name: stop services
145146
run: |
@@ -283,13 +284,14 @@ jobs:
283284
python/openmldb_sdk/tests/pytest.xml
284285
python/openmldb_tool/tests/pytest.xml
285286
286-
- name: upload python coverage to codecov
287-
uses: codecov/codecov-action@v3
287+
- name: upload coverage
288+
uses: actions/upload-artifact@v3
288289
with:
289-
name: coverage-python
290-
files: python/openmldb_sdk/tests/coverage.xml,python/openmldb_tool/tests/coverage.xml
291-
fail_ci_if_error: true
292-
verbose: true
290+
name: coverage-python-report-${{ github.sha }}
291+
path: |
292+
python/openmldb_sdk/tests/coverage.xml
293+
python/openmldb_tool/tests/coverage.xml
294+
retention-days: 3
293295

294296
- name: upload to pypi
295297
if: >
@@ -388,16 +390,12 @@ jobs:
388390
working-directory: go
389391
run: go test ./... -race -covermode=atomic -coverprofile=coverage.out
390392

391-
- name: Upload coverage to Codecov
392-
uses: codecov/codecov-action@v3
393+
- name: upload coverage
394+
uses: actions/upload-artifact@v3
393395
with:
394-
name: coverage-go
395-
files: go/coverage.out
396-
fail_ci_if_error: true
397-
verbose: true
398-
399-
- name: stop server
400-
run: ./openmldb/sbin/stop-all.sh
396+
name: coverage-go-report-${{ github.sha }}
397+
path: go/coverage.out
398+
retention-days: 3
401399

402400
publish-test-results:
403401
needs: ["java-sdk", "python-sdk", "go-sdk"]
@@ -414,3 +412,37 @@ jobs:
414412
mac-ut-result-*/**/*.xml
415413
check_name: SDK Test Report
416414
comment_title: SDK Test Report
415+
416+
publish-coverage-results:
417+
needs: ["java-sdk", "python-sdk", "go-sdk"]
418+
runs-on: ubuntu-latest
419+
steps:
420+
- uses: actions/checkout@v4
421+
with:
422+
submodules: true
423+
424+
- name: Download Artifacts (java)
425+
uses: actions/download-artifact@v3
426+
with:
427+
name: coverage-java-report-${{ github.sha }}
428+
path: java
429+
430+
- name: Download Artifacts (python)
431+
uses: actions/download-artifact@v3
432+
with:
433+
name: coverage-python-report-${{ github.sha }}
434+
path: python
435+
436+
- name: Download Artifacts (go)
437+
uses: actions/download-artifact@v3
438+
with:
439+
name: coverage-go-report-${{ github.sha }}
440+
path: go
441+
442+
- name: Upload Coverage Report
443+
uses: codecov/codecov-action@v3
444+
with:
445+
files: go/coverage.out,python/openmldb_sdk/tests/coverage.xml,python/openmldb_tool/tests/coverage.xml,java/**/target/site/jacoco/jacoco.xml,java/**/target/scoverage.xml
446+
name: coverage-sdk
447+
fail_ci_if_error: true
448+
verbose: true

0 commit comments

Comments
 (0)