-
Notifications
You must be signed in to change notification settings - Fork 25
189 lines (166 loc) · 7.34 KB
/
Copy pathtests.yml
File metadata and controls
189 lines (166 loc) · 7.34 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Run Tests
on:
push:
branches: [master, staging]
pull_request:
branches: [master, staging]
workflow_dispatch:
# A new push to the same branch/PR cancels the still-running previous run.
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true
env:
# Cap apt timeouts so an unreachable Azure mirror costs seconds, not 20 minutes.
APT_OPTS: -o Acquire::Retries=2 -o Acquire::http::Timeout=10
jobs:
# ──────────────────────────────────────────────
# Core matrix: OS/arch × SQLite. Builds the library,
# the tests, and the sample on every cell.
# ──────────────────────────────────────────────
tests:
name: ${{ matrix.os }} sqlite=${{ matrix.sqlite }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, macos-15, windows-2022, windows-2025]
sqlite: [OFF, ON]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install dependencies (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get $APT_OPTS update
sudo apt-get $APT_OPTS install -y --no-install-recommends \
libcurl4-openssl-dev libssl-dev
- name: Configure
run: cmake -DCOUNTLY_BUILD_TESTS=1 -DCOUNTLY_BUILD_SAMPLE=ON -DCOUNTLY_USE_SQLITE=${{ matrix.sqlite }} -B build .
- name: Build
run: cmake --build build --config Release -j 4
- name: Run tests
shell: bash
run: |
if [ -f build/Release/countly-tests.exe ]; then
./build/Release/countly-tests.exe
else
./build/countly-tests
fi
# ──────────────────────────────────────────────
# Build-option flavors and toolchains (Linux).
# One job per flavor via matrix include.
# ──────────────────────────────────────────────
flavors:
name: ${{ matrix.name }}
runs-on: ubuntu-24.04
timeout-minutes: 45
# TSAN detects known threading issues tracked for future refactor.
# It runs for visibility but does not block the pipeline.
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
include:
- name: sanitizer-asan
flags: -DCOUNTLY_USE_SQLITE=ON -DCMAKE_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address" -DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=address"
- name: sanitizer-ubsan
flags: -DCOUNTLY_USE_SQLITE=ON -DCMAKE_CXX_FLAGS="-fsanitize=undefined -fno-sanitize-recover=all" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=undefined" -DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=undefined"
- name: sanitizer-tsan
flags: -DCOUNTLY_USE_SQLITE=ON -DCMAKE_CXX_FLAGS="-fsanitize=thread" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread" -DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=thread"
experimental: true
- name: static-custom-http
flags: -DCOUNTLY_USE_SQLITE=ON -DBUILD_SHARED_LIBS=OFF -DCOUNTLY_USE_CUSTOM_HTTP=ON
- name: custom-sha256
flags: -DCOUNTLY_USE_SQLITE=ON -DCOUNTLY_USE_CUSTOM_SHA256=ON
- name: system-sqlite
flags: -DCOUNTLY_USE_SQLITE=ON -DCOUNTLY_USE_SYSTEM_SQLITE=ON
apt: libsqlite3-dev
- name: cpp17
flags: -DCOUNTLY_USE_SQLITE=ON -DCMAKE_CXX_STANDARD=17
- name: cpp20
flags: -DCOUNTLY_USE_SQLITE=ON -DCMAKE_CXX_STANDARD=20
- name: clang
flags: -DCOUNTLY_USE_SQLITE=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
apt: clang
env:
ASAN_OPTIONS: "detect_leaks=1"
UBSAN_OPTIONS: "print_stacktrace=1"
TSAN_OPTIONS: "second_deadlock_stack=1"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install dependencies
run: |
sudo apt-get $APT_OPTS update
sudo apt-get $APT_OPTS install -y --no-install-recommends \
libcurl4-openssl-dev libssl-dev ${{ matrix.apt }}
- name: Configure
run: cmake ${{ matrix.flags }} -DCOUNTLY_BUILD_TESTS=1 -B build .
- name: Build
run: cmake --build build -j 4
- name: Run tests
run: ./build/countly-tests
# ──────────────────────────────────────────────
# Oldest supported CMake (3.13, as documented).
# Catches accidental use of newer CMake features.
# ──────────────────────────────────────────────
min-cmake:
name: cmake-3.13
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install dependencies
run: |
sudo apt-get $APT_OPTS update
sudo apt-get $APT_OPTS install -y --no-install-recommends \
libcurl4-openssl-dev libssl-dev
- name: Install CMake 3.13
run: |
curl -sSL -o cmake.tar.gz https://cmake.org/files/v3.13/cmake-3.13.5-Linux-x86_64.tar.gz
tar -xzf cmake.tar.gz
echo "$PWD/cmake-3.13.5-Linux-x86_64/bin" >> "$GITHUB_PATH"
- name: Configure and build with CMake 3.13
run: |
cmake --version
cmake -DCOUNTLY_BUILD_TESTS=1 -DCOUNTLY_BUILD_SAMPLE=ON -DCOUNTLY_USE_SQLITE=ON -B build .
cmake --build build -j 4
- name: Run tests
run: ./build/countly-tests
# ──────────────────────────────────────────────
# Release tooling smoke test: the SBOM generator must
# not be discovered broken on release day.
# ──────────────────────────────────────────────
sbom-check:
name: sbom-generator
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Generate and validate SBOM
run: |
python3 scripts/generate_sbom.py
python3 - << 'EOF'
import glob, json, sys
path = glob.glob("countly-sdk-cpp-*.cdx.json")[0]
doc = json.load(open(path))
assert doc["bomFormat"] == "CycloneDX", "not a CycloneDX document"
assert doc["components"], "no components"
refs = {c["bom-ref"] for c in doc["components"]}
refs.add(doc["metadata"]["component"]["bom-ref"])
for dep in doc["dependencies"]:
missing = [r for r in [dep["ref"], *dep["dependsOn"]] if r not in refs]
assert not missing, f"dangling bom-refs: {missing}"
print(f"ok: {path} with {len(doc['components'])} components")
EOF