Skip to content

Commit

Permalink
fix coverage (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos authored Jan 30, 2024
1 parent 383ba03 commit 638c4b2
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 6 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Upload CodeCov Report

on: [ push, pull_request ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Install newer Clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh 17
- name: Configure
run: |
cmake -B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=${{matrix.mode}} -DBUILD_WITH_LIBCXX=OFF -DENABLE_SSL=ON \
-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

- name: Test
working-directory: ${{github.workspace}}/build
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: ctest -C ${{ matrix.configuration }} -j 1 -V

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
18 changes: 12 additions & 6 deletions .github/workflows/linux_llvm_cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: Ubuntu 22.04 (llvm cov)

on:
pull_request_target:
branches: [ doc ]
workflow_dispatch:
branches:
- main
- fix_coverage

jobs:
build:
Expand All @@ -17,20 +18,25 @@ jobs:
run: |
sudo apt-get install openssl
sudo apt-get install libssl-dev
sudo apt-get install llvm
- name: Install newer Clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh 17
- name: Run Coverage
run: |
ls
cp -r src/coro_rpc/tests/openssl_files .
ls
mkdir build && cd build
CC=clang CXX=clang++ cmake .. -DCOVERAGE_TEST=ON -DENABLE_SSL=ON
CC=clang-17 CXX=clang++-17 cmake .. -DCOVERAGE_TEST=ON -DENABLE_SSL=ON
make -j test_rpc
export LLVM_PROFILE_FILE="test_rpc-%m.profraw"
./tests/test_rpc
llvm-profdata merge -sparse test_rpc-*.profraw -o test_rpc.profdata
llvm-cov show ./tests/test_rpc -instr-profile=test_rpc.profdata -format=html -output-dir=../.coverage_llvm_cov -ignore-filename-regex="async_simple|thirdparty|tests|asio|util|logging|struct_pack" -show-instantiations=false
llvm-cov show ./tests/test_rpc -instr-profile=test_rpc.profdata -format=html -output-dir=../.coverage_llvm_cov -ignore-filename-regex="thirdparty|asio" -show-instantiations=false
echo "Done!"
- name: Upload Coverage Results
Expand All @@ -45,7 +51,7 @@ jobs:
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/test_rpc -instr-profile=test_rpc.profdata -ignore-filename-regex="thirdparty|tests" -show-region-summary=false >> tmp.log
llvm-cov report ./tests/test_rpc -instr-profile=test_rpc.profdata -ignore-filename-regex="thirdparty|asio" -show-region-summary=false >> tmp.log
echo "\`\`\`" >> tmp.log
- name: Create Comment
Expand Down

0 comments on commit 638c4b2

Please sign in to comment.