-
Notifications
You must be signed in to change notification settings - Fork 4
119 lines (102 loc) · 3.63 KB
/
Copy pathci.yml
File metadata and controls
119 lines (102 loc) · 3.63 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: patternia CI
on:
push:
branches: [main]
paths-ignore:
- "README.md"
- "CONTRIBUTING.md"
- "docs/**"
- "LICENSE"
- ".github/ISSUE_TEMPLATE/**"
pull_request:
branches: [main]
# NOTE: no paths-ignore here on purpose. Branch protection
# requires the build-and-test/coverage checks from this
# workflow; skipping docs-only PRs would leave those checks
# unreported and block the merge (see PR #45).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure CMake
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DPTN_BUILD_TESTS=ON \
-DPTN_BUILD_BENCHMARKS=OFF \
-DPTN_SKIP_COMPILER_CHECK=ON
- name: Build
run: cmake --build build --parallel
- name: Run Tests
run: ctest --test-dir build --output-on-failure
- name: Upload test log (on failure)
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-log
path: build/Testing/Temporary/LastTest.log
coverage:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install LLVM tools
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository -y 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main'
sudo apt-get update -qq
sudo apt-get install -y -qq llvm-18 clang-18
- name: Configure (Clang + source-based coverage)
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=clang-18 \
-DCMAKE_CXX_COMPILER=clang++-18 \
-DCMAKE_CXX_FLAGS="-fprofile-instr-generate -fcoverage-mapping -O0" \
-DCMAKE_EXE_LINKER_FLAGS="-fprofile-instr-generate" \
-DPTN_BUILD_TESTS=ON \
-DPTN_BUILD_BENCHMARKS=OFF \
-DPTN_SKIP_COMPILER_CHECK=ON
- name: Build
run: cmake --build build --parallel
- name: Run Tests
env:
# Give each test process its own raw profile file.
# %p = PID, %m = binary module name → avoids overwrites across
# the 150+ gtest_discover_tests processes.
LLVM_PROFILE_FILE: ${{ github.workspace }}/build/profile/%p-%m.profraw
run: |
mkdir -p build/profile
ctest --test-dir build --output-on-failure
- name: Capture coverage
run: |
# Merge raw profiles from all test processes.
find build/profile -name '*.profraw' > profraw_list.txt
echo "Found $(wc -l < profraw_list.txt) raw profiles"
llvm-profdata-18 merge \
-input-files profraw_list.txt \
-output coverage.profdata \
-sparse
# Export lcov-format text for Codecov.
llvm-cov-18 export \
-format=lcov \
-instr-profile=coverage.profdata \
-ignore-filename-regex='(_deps|/usr/|tests/)' \
build/tests/ptn_tests \
> coverage.info
# Summary for the CI log.
llvm-cov-18 report \
-instr-profile=coverage.profdata \
-use-color \
-ignore-filename-regex='(_deps|/usr/|tests/)' \
build/tests/ptn_tests
- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.info
fail_ci_if_error: false