-
-
Notifications
You must be signed in to change notification settings - Fork 1
151 lines (147 loc) · 5.45 KB
/
ci.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
name: ufl4rom CI
on:
push:
branches:
- "**"
pull_request:
branches:
- main
schedule:
- cron: "0 21 * * SAT"
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- backend: none
container: debian:testing
setup_git: |
export DEBIAN_FRONTEND="noninteractive"
apt update -y -q
apt install -y -qq git
setup_container: |
export DEBIAN_FRONTEND="noninteractive"
apt update -y -q
apt install -y -qq python3-mpi4py python3-pip
rm /usr/lib/python3.*/EXTERNALLY-MANAGED
python3 -m pip -q install git+https://github.com/FEniCS/ufl.git
- backend: dolfinx-real
container: ghcr.io/fenics/dolfinx/dolfinx:nightly
setup_git: ""
setup_container: |
. /usr/local/bin/dolfinx-real-mode
echo "PETSC_ARCH=$PETSC_ARCH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
- backend: dolfinx-complex
container: ghcr.io/fenics/dolfinx/dolfinx:nightly
setup_git: ""
setup_container: |
. /usr/local/bin/dolfinx-complex-mode
echo "PETSC_ARCH=$PETSC_ARCH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
- backend: firedrake-real
container: firedrakeproject/firedrake
setup_git: ""
setup_container: |
echo "/home/firedrake/firedrake/bin" >> $GITHUB_PATH
- backend: firedrake-complex
container: firedrakeproject/firedrake-complex
setup_git: ""
setup_container: |
echo "/home/firedrake/firedrake/bin" >> $GITHUB_PATH
fail-fast: false
container:
image: ${{ matrix.container }}
options: --user root
steps:
- name: Setup git
run: ${{ matrix.setup_git }}
- uses: actions/checkout@v4
- name: Setup container
run: ${{ matrix.setup_container }}
- name: Install ufl4rom
run: |
BACKEND=${{ matrix.backend }}
BACKEND=backend_${BACKEND%-*}
python3 -m pip install .[${BACKEND},docs,lint,tests]
shell: bash
- name: Clean build files
run: |
git config --global --add safe.directory $PWD
git clean -xdf
- name: Update mypy configuration
run: |
if [[ "${{ matrix.backend }}" == "dolfinx-"* ]]; then
:
elif [[ "${{ matrix.backend }}" == "firedrake-"* || "${{ matrix.backend }}" == "none" ]]; then
sed -i 's@ # "dolfinx",@ "dolfinx",@g' pyproject.toml
sed -i 's@ # "dolfinx.*",@ "dolfinx.*",@g' pyproject.toml
else
echo "Invalid backend"
exit 1
fi
shell: bash
- name: Run ruff
run: |
python3 -m ruff check .
- name: Run isort
run: |
python3 -m isort --check --diff .
- name: Run mypy
run: |
python3 -m mypy .
- name: Run yamllint
run: |
python3 -m yamllint -d "{extends: default, rules: {document-start: {present: false}, line-length: disable, truthy: {check-keys: false}}}" .
- name: Run documentation generation
run: |
cd docs && python3 -m sphinx -W -b html . build/html
- name: Run unit tests
run: |
COVERAGE_FILE=.coverage_unit python3 -m coverage run --source=ufl4rom -m pytest --random-order tests/unit
- name: Run integration tests
run: |
COVERAGE_FILE=.coverage_integration python3 -m coverage run --source=ufl4rom -m pytest --random-order tests/integration
- name: Upload coverage report as an artifact
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.backend }}
path: .coverage*
include-hidden-files: true
retention-days: 1
combine_coverage_reports:
runs-on: ubuntu-latest
container: debian:testing
needs: [test]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
export DEBIAN_FRONTEND="noninteractive"
apt update -y -q
apt install -y -qq python3-pip
rm /usr/lib/python3.*/EXTERNALLY-MANAGED
python3 -m pip -q install coverage
- name: Download coverage reports from artifacts
uses: actions/download-artifact@v4
- name: Combine coverage reports
run: |
python3 -m coverage combine coverage-*/.coverage*
python3 -m coverage report --fail-under=100 --show-missing --skip-covered
warn:
runs-on: ubuntu-latest
if: github.repository == 'RBniCS/ufl4rom' && github.ref == 'refs/heads/main' && github.event_name == 'schedule'
steps:
- name: Warn if scheduled workflow is about to be disabled
uses: fem-on-colab/warn-workflow-about-to-be-disabled-action@main
with:
workflow-filename: ci.yml
days-elapsed: 50