Skip to content

Commit

Permalink
ci(coverage): separate coverage test and coverage report (#3740)
Browse files Browse the repository at this point in the history
- upload/download logic allow local diagnose and more lightweight retry
  • Loading branch information
aceforeverd authored Jan 31, 2024
1 parent 397f496 commit 6f2e511
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 28 deletions.
34 changes: 27 additions & 7 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ jobs:
BUILD_SHARED_LIBS: ON
TESTING_ENABLE_STRIP: ON
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- name: download lcov
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: linux-test-project/lcov
ref: v1.16
Expand All @@ -73,18 +73,38 @@ jobs:
- name: debug
if: always()
run: |
run: |
du -d 1 -h build
df -h
- name: upload coverage
uses: actions/upload-artifact@v3
with:
# include the generated html report in build/coverage, great for local diagnose
name: coverage-cpp-${{ github.sha }}
path: |
build/coverage.*
build/coverage/
retention-days: 3

coverage-publish:
needs: ["coverage"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: coverage-cpp-${{ github.sha }}
path: build

- name: Upload Coverage Report
uses: codecov/codecov-action@v3
with:
files: build/coverage.info
name: coverage-cpp
fail_ci_if_error: true
verbose: true

- name: stop service
run: |
./steps/ut_zookeeper.sh stop
74 changes: 53 additions & 21 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,14 @@ jobs:
./mvnw --batch-mode prepare-package
./mvnw --batch-mode scoverage:report
- name: upload maven coverage
uses: codecov/codecov-action@v3
- name: upload coverage
uses: actions/upload-artifact@v3
with:
files: java/**/target/site/jacoco/jacoco.xml,java/**/target/scoverage.xml
name: coverage-java
fail_ci_if_error: true
verbose: true
name: coverage-java-report-${{ github.sha }}
path: |
java/**/target/site/jacoco/jacoco.xml
java/**/target/scoverage.xml
retention-days: 3

- name: stop services
run: |
Expand Down Expand Up @@ -283,13 +284,14 @@ jobs:
python/openmldb_sdk/tests/pytest.xml
python/openmldb_tool/tests/pytest.xml
- name: upload python coverage to codecov
uses: codecov/codecov-action@v3
- name: upload coverage
uses: actions/upload-artifact@v3
with:
name: coverage-python
files: python/openmldb_sdk/tests/coverage.xml,python/openmldb_tool/tests/coverage.xml
fail_ci_if_error: true
verbose: true
name: coverage-python-report-${{ github.sha }}
path: |
python/openmldb_sdk/tests/coverage.xml
python/openmldb_tool/tests/coverage.xml
retention-days: 3

- name: upload to pypi
if: >
Expand Down Expand Up @@ -388,16 +390,12 @@ jobs:
working-directory: go
run: go test ./... -race -covermode=atomic -coverprofile=coverage.out

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
- name: upload coverage
uses: actions/upload-artifact@v3
with:
name: coverage-go
files: go/coverage.out
fail_ci_if_error: true
verbose: true

- name: stop server
run: ./openmldb/sbin/stop-all.sh
name: coverage-go-report-${{ github.sha }}
path: go/coverage.out
retention-days: 3

publish-test-results:
needs: ["java-sdk", "python-sdk", "go-sdk"]
Expand All @@ -414,3 +412,37 @@ jobs:
mac-ut-result-*/**/*.xml
check_name: SDK Test Report
comment_title: SDK Test Report

publish-coverage-results:
needs: ["java-sdk", "python-sdk", "go-sdk"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Download Artifacts (java)
uses: actions/download-artifact@v3
with:
name: coverage-java-report-${{ github.sha }}
path: java

- name: Download Artifacts (python)
uses: actions/download-artifact@v3
with:
name: coverage-python-report-${{ github.sha }}
path: python

- name: Download Artifacts (go)
uses: actions/download-artifact@v3
with:
name: coverage-go-report-${{ github.sha }}
path: go

- name: Upload Coverage Report
uses: codecov/codecov-action@v3
with:
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
name: coverage-sdk
fail_ci_if_error: true
verbose: true

0 comments on commit 6f2e511

Please sign in to comment.