Skip to content

Commit

Permalink
[ci]test coverage (#585)
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos authored Jan 30, 2024
1 parent d768e13 commit f27793b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
-DUSE_CCACHE=${{env.ccache}} -DCMAKE_C_COMPILER=clang-17 -DCMAKE_CXX_COMPILER=clang++-17
- name: Build with ${{ matrix.compiler }}
run: cmake --build ${{github.workspace}}/build --config Debug
run: cmake --build ${{github.workspace}}/build --config Debug -- -j

- name: Test
working-directory: ${{github.workspace}}/build
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/linux_llvm_cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
run: |
sudo apt-get install openssl
sudo apt-get install libssl-dev
sudo apt-get install llvm
- name: Install newer Clang
run: |
Expand All @@ -35,28 +36,33 @@ jobs:
make -j
export LLVM_PROFILE_FILE="test_ylt-%m.profraw"
cd output
./tests/coro_io_test ./tests/coro_rpc_test ./tests/easylog_test ./tests/struct_pack_test ./tests/struct_pack_test_with_optimize
cd tests
./coro_io_test
./coro_rpc_test
./easylog_test
./struct_pack_test
./struct_pack_test_with_optimize
llvm-profdata merge -sparse test_ylt-*.profraw -o test_ylt.profdata
llvm-cov show ./tests/coro_io_test ./tests/coro_rpc_test ./tests/easylog_test ./tests/struct_pack_test ./tests/struct_pack_test_with_optimize -instr-profile=test_ylt.profdata -format=html -output-dir=../.coverage_llvm_cov -ignore-filename-regex="thirdparty|asio" -show-instantiations=false
llvm-cov show coro_io_test coro_rpc_test easylog_test struct_pack_test struct_pack_test_with_optimize -instr-profile=test_ylt.profdata -format=html -output-dir=../../.coverage_llvm_cov -ignore-filename-regex="thirdparty|asio" -show-instantiations=false
echo "Done!"
- name: Upload Coverage Results
uses: actions/upload-artifact@v3
with:
name: llvm-cov
path: ${{ github.workspace }}/.coverage_llvm_cov
path: ${{ github.workspace }}/build/.coverage_llvm_cov

- name: Create Code Coverage Report
working-directory: ${{github.workspace}}/build
working-directory: ${{github.workspace}}/build/output/tests
run: |
echo "Code Coverage Report" > tmp.log
echo "for detail, [goto summary](https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/actions/runs/${{github.run_id}}) download Artifacts `llvm-cov`" >> tmp.log
echo "\`\`\`" >> tmp.log
llvm-cov report ./tests/coro_io_test ./tests/coro_rpc_test ./tests/easylog_test ./tests/struct_pack_test ./tests/struct_pack_test_with_optimize -instr-profile=test_ylt.profdata -ignore-filename-regex="thirdparty|asio" -show-region-summary=false >> tmp.log
llvm-cov report coro_io_test coro_rpc_test easylog_test struct_pack_test struct_pack_test_with_optimize -instr-profile=test_ylt.profdata -ignore-filename-regex="thirdparty|asio" -show-region-summary=false >> tmp.log
echo "\`\`\`" >> tmp.log
- name: Create Comment
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
body-file: '${{github.workspace}}/build/tmp.log'
body-file: '${{github.workspace}}/build/output/tests/tmp.log'

0 comments on commit f27793b

Please sign in to comment.