Repository navigation
114 lines (92 loc) · 3.31 KB
/
Copy pathci.yml
File metadata and controls
114 lines (92 loc) · 3.31 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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
compiler: [gcc, clang]
preset: [release-strict, debug-sanitizers]
exclude:
- os: macos-latest
compiler: gcc
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Conan
run: pipx install conan
- name: Configure Conan profile
run: conan profile detect --force
- name: Install dependencies
run: |
BUILD_TYPE=$(echo "${{ matrix.preset }}" | grep -q "release" && echo "Release" || echo "Debug")
conan install . --build=missing -s build_type=$BUILD_TYPE -s compiler.cppstd=23
- name: Configure CMake
run: cmake --preset ${{ matrix.preset }}
env:
CC: ${{ matrix.compiler == 'gcc' && 'gcc' || 'clang' }}
CXX: ${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }}
- name: Verify C++23 standard
run: |
echo "=== Compiler Information ==="
${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }} --version
echo ""
echo "=== Checking C++ standard in compile commands ==="
if [ -f "build/${{ matrix.preset }}/compile_commands.json" ]; then
# Extract and display C++ standard flags
grep -o '\-std=[^ " ]*' "build/${{ matrix.preset }}/compile_commands.json" | sort -u || echo "No -std flag found"
# Verify C++23 is being used
if grep -q '\-std=c++2[3b]' "build/${{ matrix.preset }}/compile_commands.json"; then
echo "✓ C++23 standard verified"
else
echo "✗ C++23 standard NOT found in compile commands"
exit 1
fi
else
echo "Warning: compile_commands.json not found"
fi
- name: Build
run: cmake --build --preset ${{ matrix.preset }}
- name: Test
run: ctest --preset ${{ matrix.preset }} --output-on-failure
coverage:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Conan
run: pipx install conan
- name: Install lcov
run: sudo apt-get install -y lcov
- name: Configure Conan profile
run: conan profile detect --force
- name: Install dependencies
run: conan install . --build=missing -s build_type=Debug -s compiler.cppstd=23
- name: Configure CMake
run: cmake --preset debug-coverage
env:
CC: gcc
CXX: g++
- name: Build
run: |
find build -name "*.gcda" -delete 2>/dev/null || true
find build -name "*.gcno" -delete 2>/dev/null || true
cmake --build --preset debug-coverage
- name: Test
run: ctest --preset debug-coverage --output-on-failure
- name: Generate coverage report
run: cmake --build --preset debug-coverage --target coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./build/debug-coverage/coverage/coverage_filtered.info
fail_ci_if_error: true
verbose: true