-
Notifications
You must be signed in to change notification settings - Fork 376
75 lines (64 loc) · 2.75 KB
/
linux_llvm_cov.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Ubuntu 22.04 (llvm cov)
on:
pull_request_target:
branches:
- main
- master
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get install openssl
sudo apt-get install libssl-dev
sudo apt-get install llvm
- name: Install newer Clang
run: |
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh 17
- name: Run Coverage
run: |
mkdir build && cd build
mkdir .coverage_llvm_cov
CC=clang-17 CXX=clang++-17 cmake .. -DCOVERAGE_TEST=ON -DCINATRA_ENABLE_SSL=ON
make -j
export LLVM_PROFILE_FILE="test_cinatra-%m.profraw"
cd tests
./test_cinatra
./test_corofile
./test_http_parse
./test_time_util
./test_metric
llvm-profdata merge -sparse test_cinatra-*.profraw -o test_cinatra.profdata
llvm-cov show -object test_cinatra -object test_corofile -object test_time_util -object test_http_parse -object test_metric -instr-profile=test_cinatra.profdata -format=html -output-dir=../.coverage_llvm_cov -ignore-filename-regex="example|asio|cmdline|async_simple|tests" -show-instantiations=false
echo "Done!"
- name: List files in the repository
run: |
echo "workspace"
ls ${{ github.workspace }}
echo "workspace/build"
ls ${{ github.workspace }}/build
- name: Upload Coverage Results
uses: actions/[email protected]
with:
name: llvm-cov
path: ${{ github.workspace }}/build/.coverage_llvm_cov
- name: Create Code Coverage Report
working-directory: ${{github.workspace}}/build/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 -object test_cinatra -object test_corofile -object test_time_util -object test_http_parse -object test_metric -instr-profile=test_cinatra.profdata -ignore-filename-regex="example|asio|cmdline|async_simple|tests" -show-region-summary=false >> tmp.log
echo "\`\`\`" >> tmp.log
- name: Create Comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body-file: '${{github.workspace}}/build/tests/tmp.log'