63 lines
2.4 KiB
YAML
63 lines
2.4 KiB
YAML
name: Ubuntu 22.04 (llvm cov)
|
|
|
|
on:
|
|
pull_request_target:
|
|
branches:
|
|
- main
|
|
- fix_coverage
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
sudo apt-get install openssl
|
|
sudo apt-get install libssl-dev
|
|
|
|
- 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-17 CXX=clang++-17 cmake .. -DCOVERAGE_TEST=ON -DENABLE_SSL=ON
|
|
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
|
|
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
|
|
echo "Done!"
|
|
|
|
- name: Upload Coverage Results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: llvm-cov
|
|
path: ${{ github.workspace }}/.coverage_llvm_cov
|
|
|
|
- name: Create Code Coverage Report
|
|
working-directory: ${{github.workspace}}/build
|
|
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
|
|
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'
|