| name: Code Coverage |
| on: |
| push: |
| branches: |
| - develop |
| - rc/* |
| paths-ignore: |
| - 'docs/**' |
| pull_request: |
| branches: |
| - develop |
| - rc/* |
| paths-ignore: |
| - 'docs/**' |
| |
| jobs: |
| codecov: |
| runs-on: ubuntu-22.04 |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'apache/tsfile' || github.event_name == 'push' |
| |
| steps: |
| - uses: actions/checkout@v5 |
| - name: Cache Maven packages |
| uses: actions/cache@v4 |
| with: |
| path: ~/.m2 |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} |
| restore-keys: ${{ runner.os }}-m2- |
| - name: Generate code coverage reports |
| run: | |
| sudo apt-get install lcov |
| ./mvnw -B -P with-java,with-cpp,with-code-coverage clean verify -Dspotless.skip=true |
| lcov --capture --directory cpp/target/build/test --output-file cpp/target/build/test/coverage.info |
| lcov --remove cpp/target/build/test/coverage.info '*/tsfile/cpp/test/*' --output-file cpp/target/build/test/coverage_filtered.info |
| genhtml cpp/target/build/test/coverage_filtered.info --output-directory cpp/target/build/test/coverage_report |
| rm -rf cpp/target/build/test/CMakeFiles/TsFile_Test.dir |
| rm -rf cpp/target/build/test/coverage.info |
| - name: Upload coverage reports to codecov |
| uses: codecov/codecov-action@v5 |
| with: |
| token: ${{ secrets.CODECOV_TOKEN }} |
| files: java/tsfile/target/jacoco-merged-reports/jacoco.xml,cpp/target/build/test/coverage_report/index.html |