Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix coverage #582

Merged
merged 7 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading