-
-
Notifications
You must be signed in to change notification settings - Fork 1
401 lines (341 loc) · 10.3 KB
/
ci.yml
File metadata and controls
401 lines (341 loc) · 10.3 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
env:
DOCKER_BUILDKIT: 1
jobs:
# Matrix build with different compilers in containers
build-and-test:
name: Build & Test (${{ matrix.compiler }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler:
- gcc
- clang
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build test container
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.test
push: false
load: true
tags: liblpm-test:ci
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run tests with ${{ matrix.compiler }}
run: |
docker run --rm \
-e CC=${{ matrix.compiler == 'gcc' && 'gcc' || 'clang' }} \
-e CXX=${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }} \
liblpm-test:ci
- name: Upload test results
if: always()
uses: actions/upload-artifact@v6
with:
name: test-results-${{ matrix.compiler }}
path: test-results/
if-no-files-found: ignore
# C++ bindings test
test-cpp-bindings:
name: Test C++ Bindings
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build C++ container
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.cpp
push: false
load: true
tags: liblpm-cpp:ci
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run C++ tests
run: |
docker run --rm liblpm-cpp:ci
# Go bindings test
test-go-bindings:
name: Test Go Bindings
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Go container
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.go
push: false
load: true
tags: liblpm-go:ci
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run Go tests
run: |
docker run --rm liblpm-go:ci
# Java bindings test
test-java-bindings:
name: Test Java Bindings
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Java container
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.java
push: false
load: true
tags: liblpm-java:ci
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run Java tests
run: |
docker run --rm liblpm-java:ci
# C# bindings test
test-csharp-bindings:
name: Test C# Bindings
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build C# container
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.csharp
push: false
load: true
tags: liblpm-csharp:ci
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run C# tests
run: |
docker run --rm liblpm-csharp:ci
# Lua bindings test
test-lua-bindings:
name: Test Lua Bindings
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Lua container
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.lua
push: false
load: true
tags: liblpm-lua:ci
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run Lua tests
run: |
docker run --rm liblpm-lua:ci
# Perl bindings test
test-perl-bindings:
name: Test Perl Bindings
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Perl container
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.perl
push: false
load: true
tags: liblpm-perl:ci
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run Perl tests
run: |
docker run --rm liblpm-perl:ci
# PHP bindings test
test-php-bindings:
name: Test PHP Bindings
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build PHP container
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.php
push: false
load: true
tags: liblpm-php:ci
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run PHP tests
run: |
docker run --rm liblpm-php:ci
# Python bindings test
test-python-bindings:
name: Test Python Bindings
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
python -m pip install --upgrade pip
python -m pip install cython pytest pytest-cov scikit-build-core
- name: Build liblpm
run: |
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DLPM_TS_RESOLVERS=ON
make -j$(nproc)
sudo make install
sudo ldconfig
- name: Build Python bindings
working-directory: bindings/python
run: |
pip install -e ".[dev]"
- name: Run Python tests
working-directory: bindings/python
env:
# Workaround for IFUNC/dlopen incompatibility
LD_PRELOAD: /usr/local/lib/liblpm.so.1
run: |
pytest tests/ -v --cov=liblpm --cov-report=xml
- name: Upload coverage
if: matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
file: bindings/python/coverage.xml
flags: python
fail_ci_if_error: false
# Code quality checks
code-quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build dev container
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.dev
push: false
load: true
tags: liblpm-dev:ci
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run cppcheck
run: |
docker run --rm liblpm-dev:ci bash -c "
cppcheck \
--enable=all \
--suppress=missingIncludeSystem \
--suppress=unusedFunction \
--inline-suppr \
--error-exitcode=1 \
-I include \
-I external/libdynemit/include \
src/
"
continue-on-error: true
- name: Check formatting (clang-format)
run: |
docker run --rm liblpm-dev:ci bash -c "
find src include -name '*.c' -o -name '*.h' | \
xargs clang-format --dry-run --Werror
"
continue-on-error: true
# CI Summary
ci-summary:
name: CI Summary
runs-on: ubuntu-latest
needs: [build-and-test, test-cpp-bindings, test-go-bindings, test-java-bindings, test-csharp-bindings, test-lua-bindings, test-perl-bindings, test-php-bindings, test-python-bindings, code-quality]
if: always()
steps:
- name: Check CI status
run: |
echo "CI workflow completed"
echo "Build and test: ${{ needs.build-and-test.result }}"
echo "C++ bindings: ${{ needs.test-cpp-bindings.result }}"
echo "Go bindings: ${{ needs.test-go-bindings.result }}"
echo "Java bindings: ${{ needs.test-java-bindings.result }}"
echo "C# bindings: ${{ needs.test-csharp-bindings.result }}"
echo "Lua bindings: ${{ needs.test-lua-bindings.result }}"
echo "Perl bindings: ${{ needs.test-perl-bindings.result }}"
echo "PHP bindings: ${{ needs.test-php-bindings.result }}"
echo "Python bindings: ${{ needs.test-python-bindings.result }}"
echo "Code quality: ${{ needs.code-quality.result }}"
# Fail if any required job failed
if [[ "${{ needs.build-and-test.result }}" == "failure" ]] || \
[[ "${{ needs.test-cpp-bindings.result }}" == "failure" ]] || \
[[ "${{ needs.test-go-bindings.result }}" == "failure" ]] || \
[[ "${{ needs.test-java-bindings.result }}" == "failure" ]] || \
[[ "${{ needs.test-csharp-bindings.result }}" == "failure" ]] || \
[[ "${{ needs.test-lua-bindings.result }}" == "failure" ]] || \
[[ "${{ needs.test-perl-bindings.result }}" == "failure" ]] || \
[[ "${{ needs.test-php-bindings.result }}" == "failure" ]] || \
[[ "${{ needs.test-python-bindings.result }}" == "failure" ]]; then
echo "One or more required jobs failed"
exit 1
fi