-
Notifications
You must be signed in to change notification settings - Fork 1
198 lines (173 loc) · 5.11 KB
/
linux.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
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
name: Linux
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-24.04
container: sergiud/hogpp:lint-18
defaults:
run:
shell: bash -e -o pipefail {0}
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v4
- name: Check code style
run: |
fdfind -g '*.[ch]pp' -x clang-format-18 --dry-run --Werror
build-native:
name: ${{matrix.os}}-GCC-${{matrix.build_type}}
runs-on: ${{matrix.os}}
defaults:
run:
shell: bash
strategy:
fail-fast: true
matrix:
build_type:
- Release
- Debug
os:
- ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Setup Dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get install -y \
--no-install-recommends --no-install-suggests \
cmake \
furo \
g++ \
gcovr \
libboost-test-dev \
libeigen3-dev \
libfmt-dev \
libopencv-dev \
mold \
ninja-build \
python3-dev \
python3-numpy \
python3-pillow \
python3-pybind11 \
python3-pytest \
python3-pytest-xdist \
python3-sphinx \
python3-sphinx-copybutton \
python3-sphinxcontrib.bibtex
- name: Setup Debug Environment
if: ${{matrix.build_type == 'Debug'}}
run: |
echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV
- name: Configure
env:
CXXFLAGS: -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Wundef -Wfloat-equal -Wno-attributes -Werror ${{env.CXXFLAGS}}
Python_ROOT: ${{env.pythonLocation}}
run: |
cmake -S . -B build/ \
-DCMAKE_REQUIRE_FIND_PACKAGE_pybind11=ON \
-DCMAKE_REQUIRE_FIND_PACKAGE_Python=ON \
-DCMAKE_REQUIRE_FIND_PACKAGE_Sphinx=ON \
-G Ninja
- name: Build
run: |
cmake --build build/ \
--config ${{matrix.build_type}}
- name: Test
run: |
ctest --test-dir build/ \
--build-config ${{matrix.build_type}} \
-j$(nproc) \
--output-on-failure
- name: Generate Documentation
run: |
cmake --build build/ \
--config ${{matrix.build_type}} \
--target sphinx
- name: Generate Coverage
if: matrix.build_type == 'Debug'
run: |
cd build/
gcovr -r .. . -s --cobertura coverage.xml
- name: Upload Coverage to Codecov
if: ${{matrix.build_type == 'Debug'}}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: build/coverage.xml
fail_ci_if_error: true
verbose: true
build-wheel:
name: Python-${{matrix.python}}-${{matrix.build_type}}-wheel
runs-on: ubuntu-24.04
defaults:
run:
shell: bash
strategy:
fail-fast: true
matrix:
build_type:
- Release
- Debug
python:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- 'pypy3.10'
steps:
- uses: actions/checkout@v4
- name: Setup Dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get install -y \
--no-install-recommends --no-install-suggests \
cmake \
g++ \
libeigen3-dev \
libfmt-dev \
mold \
ninja-build
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python}}
cache: 'pip'
cache-dependency-path: requirements.txt
- name: Setup Dependencies
run: |
pip install -r requirements.txt
- name: Setup Environment
run: |
echo 'CXXFLAGS=-fuse-ld=mold' >> $GITHUB_ENV
echo "pybind11_ROOT=$(pybind11-config --cmakedir)" >> $GITHUB_ENV
- name: Build
env:
CXXFLAGS: -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Wundef -Wfloat-equal -Wno-attributes -Werror ${{env.CXXFLAGS}}
run: |
pip install --no-build-isolation \
--config-settings build-dir=build/ \
--config-settings cmake.build-type=${{matrix.build_type}} \
--verbose \
--editable .
- name: Test
run: |
coverage run -m pytest --junit-xml=report.xml
- name: Generate Documentation
run: |
sphinx-build -M html docs/ docs/_build -W --keep-going
- name: Generate Coverage
run: |
coverage report
coverage xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
fail_ci_if_error: true
verbose: true