-
-
Notifications
You must be signed in to change notification settings - Fork 183
214 lines (195 loc) · 7.98 KB
/
ccpp.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: DOLFINx CI
on:
push:
branches:
- "**"
tags:
- "v*"
pull_request:
branches:
- main
merge_group:
branches:
- main
workflow_dispatch:
inputs:
ffcx_ref:
description: "FFCx branch or tag"
default: "main"
type: string
basix_ref:
description: "Basix branch or tag"
default: "main"
type: string
ufl_ref:
description: "UFL branch or tag"
default: "main"
type: string
jobs:
build:
if: "!(contains(github.event.head_commit.message, '[ci skip]') || contains(github.event.head_commit.message, '[skip ci]'))"
runs-on: ubuntu-latest
container: ghcr.io/fenics/test-env:current-openmpi
env:
PETSC_ARCH: ${{ matrix.petsc_arch }}
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
strategy:
matrix:
petsc_arch: [linux-gnu-real32-32, linux-gnu-real64-32, linux-gnu-complex64-32, linux-gnu-complex128-32, linux-gnu-real64-64, linux-gnu-complex128-64]
name: Build and test (${{ matrix.petsc_arch }})
steps:
- uses: actions/checkout@v4
- name: Install FEniCS Python components (default branches/tags)
if: github.event_name != 'workflow_dispatch'
run: |
python3 -m pip install git+https://github.com/FEniCS/ufl.git
python3 -m pip install git+https://github.com/FEniCS/basix.git
python3 -m pip install git+https://github.com/FEniCS/ffcx.git
- name: Install FEniCS Python components
if: github.event_name == 'workflow_dispatch'
run: |
python3 -m pip install git+https://github.com/FEniCS/ufl.git@${{ github.event.inputs.ufl_ref }}
python3 -m pip install git+https://github.com/FEniCS/basix.git@${{ github.event.inputs.basix_ref }}
python3 -m pip install git+https://github.com/FEniCS/ffcx.git@${{ github.event.inputs.ffcx_ref }}
- name: Flake8 checks
run: |
cd cpp/
python3 -m flake8 cmake
python3 -m flake8 demo
python3 -m flake8 test
cd ..
cd python/
python3 -m flake8 dolfinx
python3 -m flake8 demo
python3 -m flake8 test
- name: isort checks (non-blocking)
continue-on-error: true
run: |
cd cpp/
python3 -m isort --check .
cd ..
cd python/
python3 -m isort --check .
- name: mypy checks
run: |
cd python/
mypy dolfinx
mypy demo
mypy test
- name: clang-format C++ checks (non-blocking)
continue-on-error: true
run: |
cd cpp
clang-format --version
find . -type f \( -name "*.cpp" -o -name "*.h" \) ! -name "loguru.cpp" | xargs clang-format --dry-run --Werror
- name: clang-format Python binding checks (non-blocking)
continue-on-error: true
run: |
cd python/dolfinx/wrappers
clang-format --version
find . -type f \( -name "*.cpp" -o -name "*.h" \) | xargs clang-format --dry-run --Werror
- name: cmake-format (non-blocking)
continue-on-error: true
run: |
find . -type f \( -name "*.cmake" -o -name "*.cmake.in" -o -name "CMakeLists.txt" \) | xargs cmake-format --check
- name: Configure C++
run: cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build -S cpp/
- name: Build and install C++ library
run: |
cmake --build build
cmake --install build
- name: Build C++ interface documentation
run: |
export DOLFINX_VERSION=`cmake -L build | grep DOXYGEN_DOLFINX_VERSION | cut -f2 -d "="`
echo $DOLFINX_VERSION
cd cpp/doc
doxygen Doxyfile
make html
- name: Build C++ unit tests
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build/test/ -S cpp/test/
cmake --build build/test --parallel 3
- name: Run C++ unit tests (serial)
run: |
cd build/test
ctest -V --output-on-failure -R unittests
- name: Run C++ unit tests (MPI)
run: |
cd build/test
mpiexec -np 2 ctest -V --output-on-failure -R unittests
- name: Build and run C++ regression tests (serial and MPI (np=2))
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build/demo/ -S cpp/demo/
cmake --build build/demo --parallel 3
cd build/demo
ctest -V -R demo -R serial
ctest -V -R demo -R mpi_2
- name: Build Python interface
run: |
python3 -m pip -v install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Debug" python/
- name: Build Python interface documentation
run: |
cd python/doc
python3 -m sphinx -W -b html source/ build/html/
- name: Set default DOLFINx JIT options
run: |
mkdir -p ~/.config/dolfinx
echo '{ "cffi_extra_compile_args": ["-g0", "-O0" ] }' > ~/.config/dolfinx/dolfinx_jit_options.json
- name: Run demos (Python, serial)
run: python3 -m pytest -n=2 -m serial --durations=10 python/demo/test.py
- name: Run demos (Python, MPI (np=2))
run: python3 -m pytest -m mpi --num-proc=2 python/demo/test.py
- name: Run Python unit tests (serial)
run: python3 -m pytest -n=auto --durations=50 python/test/unit/
- name: Run Python unit tests (MPI, np=2)
run: mpirun -np 2 python3 -m pytest python/test/unit/
- name: Upload C++ documentation artifact
uses: actions/upload-artifact@v3
with:
name: doc-cpp-${{ matrix.petsc_arch }}
path: |
cpp/doc/html/
cpp/doc/build/
retention-days: 2
if-no-files-found: error
- name: Upload Python documentation artifact
uses: actions/upload-artifact@v3
with:
name: doc-python-${{ matrix.petsc_arch }}
path: |
python/doc/build/html/
retention-days: 2
if-no-files-found: error
- name: Checkout FEniCS/docs
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) && runner.os == 'Linux' }}
uses: actions/checkout@v4
with:
repository: "FEniCS/docs"
path: "docs"
ssh-key: "${{ secrets.SSH_GITHUB_DOCS_PRIVATE_KEY }}"
- name: Set version name
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) && runner.os == 'Linux' }}
run: |
echo "VERSION_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Copy documentation into repository
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) && runner.os == 'Linux' }}
run: |
cd docs
git rm -r --ignore-unmatch dolfinx/${{ env.VERSION_NAME }}/cpp
git rm -r --ignore-unmatch dolfinx/${{ env.VERSION_NAME }}/python
mkdir -p dolfinx/${{ env.VERSION_NAME }}/cpp
mkdir -p dolfinx/${{ env.VERSION_NAME }}/cpp/doxygen
mkdir -p dolfinx/${{ env.VERSION_NAME }}/python
cp -r ../cpp/doc/build/html/* dolfinx/${{ env.VERSION_NAME }}/cpp/
cp -r ../cpp/doc/html/* dolfinx/${{ env.VERSION_NAME }}/cpp/doxygen
cp -r ../python/doc/build/html/* dolfinx/${{ env.VERSION_NAME }}/python
- name: Commit and push documentation to FEniCS/docs
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) && runner.os == 'Linux' && matrix.petsc_arch == 'linux-gnu-real64-32' }}
run: |
cd docs
git config --global user.email "[email protected]"
git config --global user.name "FEniCS GitHub Actions"
git add --all
git commit --allow-empty -m "C++ FEniCS/dolfinx@${{ github.sha }}"
git push