Repository navigation
244 lines (234 loc) · 9.09 KB
/
Copy pathpythonapp.yml
File metadata and controls
244 lines (234 loc) · 9.09 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
name: Basix CI
# This workflow will install Python dependencies, run tests and lint
# with a single version of Python For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
on:
push:
tags:
- "v*"
pull_request:
branches:
- main
merge_group:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint code
runs-on: ubuntu-26.04
steps:
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.13"
- uses: actions/checkout@v7
- name: Load environment variables
run: cat .github/workflows/fenicsx-refs.env >> $GITHUB_ENV
- name: Ruff check
run: |
pip install ruff
ruff check .
ruff format --check .
- name: Gersemi check
run: |
pip install gersemi
gersemi --check .
build:
name: Build and test
runs-on: ${{ matrix.os }}
needs: [lint]
strategy:
matrix:
os: [ubuntu-26.04]
python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
steps:
- uses: actions/checkout@v7
- name: Load environment variables
run: cat .github/workflows/fenicsx-refs.env >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y doxygen graphviz libopenblas-dev liblapack-dev ninja-build
- name: Install UFL
run: pip -v install git+https://github.com/${{ env.ufl_repository }}.git@${{ env.ufl_ref }}
- name: Install Basix
run: pip -v install -Ccmake.build-type="Developer" --group ci .
# One leg only: the result does not vary with the Python version, and
# checking needs the package actually built and installed (unlike
# ruff/gersemi in the lint job) to resolve basix's own types.
- name: Pyrefly check
if: ${{ matrix.python-version == '3.13' }}
run: pyrefly check --error-stale-baseline
- name: Run units tests
run: pytest -n auto --durations 20 test/
- name: Run simple CMake integration test
run: |
cd test/test_cmake
cmake -DCMAKE_BUILD_TYPE=Debug -DPython3_EXECUTABLE=python3 -G Ninja -B build-dir -S .
cmake --build build-dir/
build-dir/a.out
- name: Run Python demos
run: pytest demo/python/test.py
- name: Run C++ demos
run: pytest demo/cpp/test.py
- name: Build C++ documentation
run: |
export BASIX_VERSION=`python3 -c "import basix; print(basix.__version__)"`
cd doc/cpp
doxygen
- name: Build Python documentation
run: |
export BASIX_VERSION=`python3 -c "import basix; print(basix.__version__)"`
cd doc/python
python -m sphinx -W -b html source build/html
- name: Upload C++ documentation artifact
uses: actions/upload-artifact@v7
with:
name: doc-cpp-${{ matrix.python-version }}
path: |
doc/cpp/html
retention-days: 2
if-no-files-found: error
- name: Upload Python documentation artifact
uses: actions/upload-artifact@v7
with:
name: doc-python-${{ matrix.python-version }}
path: |
doc/python/build/html
retention-days: 2
if-no-files-found: error
- name: Set version name
if: ${{ github.repository == 'FEniCS/basix' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) && matrix.python-version == '3.13' }}
run: |
echo "VERSION_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Checkout FEniCS/docs
if: ${{ github.repository == 'FEniCS/basix' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) && matrix.python-version == '3.13' }}
uses: actions/checkout@v7
with:
repository: "FEniCS/docs"
path: "docs"
ssh-key: "${{ secrets.SSH_GITHUB_DOCS_PRIVATE_KEY }}"
- name: Copy documentation into repository
if: ${{ github.repository == 'FEniCS/basix' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) && matrix.python-version == '3.13' }}
run: |
cd docs
git rm -r --ignore-unmatch basix/${{ env.VERSION_NAME }}
mkdir -p basix/${{ env.VERSION_NAME }}
cp -r ../doc/cpp/html basix/${{ env.VERSION_NAME }}/cpp
cp -r ../doc/python/build/html basix/${{ env.VERSION_NAME }}/python
- name: Commit and push documentation to FEniCS/docs
if: ${{ github.repository == 'FEniCS/basix' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) && matrix.python-version == '3.13' }}
run: |
cd docs
git config --global user.email "fenics@github.com"
git config --global user.name "FEniCS GitHub Actions"
git add --all
git commit --allow-empty -m "Update Basix docs FEniCS/basix@${{ github.sha }}"
git push
no-isolation-python-build:
name: Build Python using '--no-build-isolation'
runs-on: ubuntu-26.04
needs: [lint]
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.13"
- name: Install dependencies
run: sudo apt-get install -y libopenblas-dev liblapack-dev ninja-build
- name: Install Python dependencies
run: pip install nanobind scikit-build-core[pyproject]
- name: Install Basix
run: |
pip install scikit-build-core
python -m scikit_build_core.build requires | python -c "import sys, json; print(' '.join(json.load(sys.stdin)))" | xargs pip install
pip install --no-build-isolation .
build-separately:
name: Build C++ and Python parts separately and run tests
runs-on: ubuntu-26.04
needs: [lint]
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.13"
- name: Install dependencies
run: sudo apt-get install -y libopenblas-dev liblapack-dev
- name: Install Basix C++ library
run: |
cd cpp
cmake -DCMAKE_BUILD_TYPE=Developer -B build-dir -S . # Use make (not ninja)
cmake --build build-dir
sudo cmake --install build-dir
- name: Load environment variables
run: cat .github/workflows/fenicsx-refs.env >> "$GITHUB_ENV"
- name: Install UFL
run: pip -v install git+https://github.com/${{ env.ufl_repository }}.git@${{ env.ufl_ref }}
- name: Install Basix Python wrapper
run: |
cd python
pip install --group test .
- name: Run units tests
run: |
pip install pytest-xdist # in ci group, but most not needed.
pytest -n auto --durations 20 test/
- name: Run Python demos
run: pytest demo/python/test.py
- name: Run C++ demos
run: pytest demo/cpp/test.py
build-cpp-only:
name: Build C++ part only and run tests and demos
runs-on: ubuntu-26.04
needs: [lint]
steps:
- uses: actions/checkout@v7
- name: Install dependencies
run: sudo apt-get install -y catch2 libopenblas-dev liblapack-dev ninja-build
- name: Install Basix
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build-dir -S cpp
cmake --build build-dir
sudo cmake --install build-dir
- name: Run C++ unit tests
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build-dir-test -S cpp/test
cmake --build build-dir-test
ctest --test-dir build-dir-test --output-on-failure
- name: Run pkg-config integration test
run: |
cd test/test_pkgconfig
make run-shared
# A static build puts BLAS/LAPACK in Libs.private, since a static
# consumer (unlike a shared one) must link them itself; installed to
# its own prefix so it doesn't clobber the shared install above.
- name: Install Basix (static)
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=$PWD/static-install -B build-dir-static -S cpp
cmake --build build-dir-static
cmake --install build-dir-static
test -n "$(find static-install -name libbasix.a -print -quit)"
- name: Run pkg-config integration test (static)
run: |
cd test/test_pkgconfig
make clean
export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/static-install/lib/pkgconfig:$PKG_CONFIG_PATH
make run-static
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.13"
- name: Run tests
run: |
pip install pytest
pytest demo/cpp/test.py