multiphenicsx 0.3.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- multiphenicsx-0.3.8/.github/FUNDING.yml +1 -0
- multiphenicsx-0.3.8/.github/workflows/ci.yml +191 -0
- multiphenicsx-0.3.8/.github/workflows/ci_against_releases.yml +38 -0
- multiphenicsx-0.3.8/.github/workflows/fork_rebase.yml +41 -0
- multiphenicsx-0.3.8/.github/workflows/pypi.yml +143 -0
- multiphenicsx-0.3.8/.gitignore +13 -0
- multiphenicsx-0.3.8/AUTHORS +1 -0
- multiphenicsx-0.3.8/COPYING +165 -0
- multiphenicsx-0.3.8/PKG-INFO +229 -0
- multiphenicsx-0.3.8/README.md +10 -0
- multiphenicsx-0.3.8/docs/.gitignore +2 -0
- multiphenicsx-0.3.8/docs/api.rst +9 -0
- multiphenicsx-0.3.8/docs/conf.py +32 -0
- multiphenicsx-0.3.8/docs/index.rst +15 -0
- multiphenicsx-0.3.8/multiphenicsx/__init__.py +6 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/.gitignore +6 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/CMakeLists.txt +120 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/__init__.py +8 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.cpp +105 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.h +107 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/multiphenicsx/fem/petsc.h +286 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/multiphenicsx/fem/sparsitybuild.cpp +57 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/multiphenicsx/fem/sparsitybuild.h +38 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/multiphenicsx/fem/utils.h +122 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/multiphenicsx/la/petsc.cpp +548 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/multiphenicsx/la/petsc.h +178 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/multiphenicsx/wrappers/fem.cpp +227 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/multiphenicsx/wrappers/la.cpp +130 -0
- multiphenicsx-0.3.8/multiphenicsx/cpp/multiphenicsx/wrappers/multiphenicsx.cpp +33 -0
- multiphenicsx-0.3.8/multiphenicsx/fem/__init__.py +9 -0
- multiphenicsx-0.3.8/multiphenicsx/fem/dofmap_restriction.py +31 -0
- multiphenicsx-0.3.8/multiphenicsx/fem/petsc.py +1607 -0
- multiphenicsx-0.3.8/multiphenicsx/py.typed +0 -0
- multiphenicsx-0.3.8/pyproject.toml +142 -0
- multiphenicsx-0.3.8/tests/unit/conftest.py +11 -0
- multiphenicsx-0.3.8/tests/unit/fem/common.py +90 -0
- multiphenicsx-0.3.8/tests/unit/fem/test_assembler_restriction.py +817 -0
- multiphenicsx-0.3.8/tests/unit/fem/test_dofmap_restriction.py +142 -0
- multiphenicsx-0.3.8/tutorials/.gitignore +2 -0
- multiphenicsx-0.3.8/tutorials/01_block_poisson/tutorial_block_poisson.ipynb +367 -0
- multiphenicsx-0.3.8/tutorials/02_navier_stokes/tutorial_navier_stokes.ipynb +649 -0
- multiphenicsx-0.3.8/tutorials/03_lagrange_multipliers/tutorial_lagrange_multipliers_interface.ipynb +513 -0
- multiphenicsx-0.3.8/tutorials/03_lagrange_multipliers/tutorial_lagrange_multipliers_linear.ipynb +420 -0
- multiphenicsx-0.3.8/tutorials/03_lagrange_multipliers/tutorial_lagrange_multipliers_nonlinear.ipynb +616 -0
- multiphenicsx-0.3.8/tutorials/04_eigenvalue_problems/tutorial_eigenvalue_laplacian.ipynb +881 -0
- multiphenicsx-0.3.8/tutorials/04_eigenvalue_problems/tutorial_infsup_lagrange_multipliers.ipynb +326 -0
- multiphenicsx-0.3.8/tutorials/04_eigenvalue_problems/tutorial_infsup_stokes.ipynb +485 -0
- multiphenicsx-0.3.8/tutorials/06_optimal_control/tutorial_1a_poisson.ipynb +492 -0
- multiphenicsx-0.3.8/tutorials/06_optimal_control/tutorial_1b_poisson.ipynb +549 -0
- multiphenicsx-0.3.8/tutorials/06_optimal_control/tutorial_2a_advection_diffusion_reaction.ipynb +501 -0
- multiphenicsx-0.3.8/tutorials/06_optimal_control/tutorial_2b_advection_diffusion_reaction.ipynb +626 -0
- multiphenicsx-0.3.8/tutorials/06_optimal_control/tutorial_3a_advection_diffusion_reaction_neumann_control.ipynb +541 -0
- multiphenicsx-0.3.8/tutorials/06_optimal_control/tutorial_3b_advection_diffusion_reaction_neumann_control.ipynb +645 -0
- multiphenicsx-0.3.8/tutorials/06_optimal_control/tutorial_4a_poisson_dirichlet_control.ipynb +554 -0
- multiphenicsx-0.3.8/tutorials/06_optimal_control/tutorial_4b_poisson_neumann_control_boundary_observation.ipynb +538 -0
- multiphenicsx-0.3.8/tutorials/06_optimal_control/tutorial_5_stokes.ipynb +562 -0
- multiphenicsx-0.3.8/tutorials/06_optimal_control/tutorial_6_navier_stokes.ipynb +611 -0
- multiphenicsx-0.3.8/tutorials/06_optimal_control/tutorial_7a_stokes_dirichlet_control.ipynb +788 -0
- multiphenicsx-0.3.8/tutorials/06_optimal_control/tutorial_7b_stokes_neumann_control.ipynb +731 -0
- multiphenicsx-0.3.8/tutorials/06_optimal_control/tutorial_8_navier_stokes_neumann_control.ipynb +678 -0
- multiphenicsx-0.3.8/tutorials/07_understanding_restrictions/tutorial_understanding_restrictions.ipynb +1846 -0
- multiphenicsx-0.3.8/tutorials/08_singular_poisson/tutorial_create_nullspace.ipynb +975 -0
- multiphenicsx-0.3.8/tutorials/conftest.py +12 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
github: francesco-ballarin
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- "**"
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
schedule:
|
|
11
|
+
- cron: "0 3 * * *"
|
|
12
|
+
workflow_dispatch:
|
|
13
|
+
workflow_call:
|
|
14
|
+
inputs:
|
|
15
|
+
ref:
|
|
16
|
+
description: "The branch, tag or SHA to checkout"
|
|
17
|
+
type: string
|
|
18
|
+
index:
|
|
19
|
+
description: "The package index, e.g. PyPI or TestPyPI, from which to install the package. If empty, the package will not be installed from any package index, but from the current git clone"
|
|
20
|
+
type: string
|
|
21
|
+
index_version:
|
|
22
|
+
description: "The version of the package to be installed from the package index. If empty, the latest compatible version will be installed. Only used when index is non empty."
|
|
23
|
+
type: string
|
|
24
|
+
expected_index_version:
|
|
25
|
+
description: "The expected version of the package when installed from the package index. If emtpy, no check is carried out. Only used when index is non empty."
|
|
26
|
+
type: string
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
test:
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
container: ghcr.io/fenics/dolfinx/dolfinx:v0.8.0
|
|
32
|
+
strategy:
|
|
33
|
+
matrix:
|
|
34
|
+
petsc_arch: [real, complex]
|
|
35
|
+
fail-fast: false
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v4
|
|
38
|
+
with:
|
|
39
|
+
ref: ${{ inputs.ref }}
|
|
40
|
+
- name: Setup container
|
|
41
|
+
run: |
|
|
42
|
+
export DEBIAN_FRONTEND="noninteractive"
|
|
43
|
+
apt update -y -q
|
|
44
|
+
apt install -y -qq xvfb
|
|
45
|
+
. /usr/local/bin/dolfinx-${{ matrix.petsc_arch }}-mode
|
|
46
|
+
echo "PETSC_ARCH=$PETSC_ARCH" >> $GITHUB_ENV
|
|
47
|
+
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
|
|
48
|
+
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
|
|
49
|
+
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
|
|
50
|
+
echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
|
|
51
|
+
rm /usr/local/lib/python3.10/dist-packages/petsc4py/py.typed
|
|
52
|
+
- name: Wait for package index availability (PyPI and TestPyPI only)
|
|
53
|
+
if: inputs.index != '' && inputs.index_version != ''
|
|
54
|
+
run: |
|
|
55
|
+
INDEX=${{ inputs.index }}
|
|
56
|
+
INDEX_VERSION=${{ inputs.index_version }}
|
|
57
|
+
PACKAGE_NAME="multiphenicsx"
|
|
58
|
+
if [[ "${INDEX}" == "TestPyPI" ]]; then
|
|
59
|
+
INDEX_URL=https://test.pypi.org
|
|
60
|
+
elif [[ "${INDEX}" == "PyPI" ]]; then
|
|
61
|
+
INDEX_URL=https://pypi.org
|
|
62
|
+
else
|
|
63
|
+
echo "Invalid package index" && exit 1
|
|
64
|
+
fi
|
|
65
|
+
COUNTER=0
|
|
66
|
+
INDEX_VERSION_FOUND=0
|
|
67
|
+
while [[ ${INDEX_VERSION_FOUND} -ne 1 ]]; do
|
|
68
|
+
python3 -m pip install --no-cache-dir --index-url ${INDEX_URL}/simple/ ${PACKAGE_NAME}==0 2> all_${PACKAGE_NAME}_versions || true
|
|
69
|
+
if grep -q ${INDEX_VERSION} all_${PACKAGE_NAME}_versions; then
|
|
70
|
+
INDEX_VERSION_FOUND=1
|
|
71
|
+
fi
|
|
72
|
+
[[ ${INDEX_VERSION_FOUND} -ne 1 && ${COUNTER} -eq 5 ]] && echo "Giving up on finding version ${INDEX_VERSION} on ${INDEX_URL}" && exit 1
|
|
73
|
+
[[ ${INDEX_VERSION_FOUND} -ne 1 ]] && echo "Cannot find version ${INDEX_VERSION} on ${INDEX_URL}, attempt ${COUNTER}: trying again after a short pause" && sleep 10
|
|
74
|
+
[[ ${INDEX_VERSION_FOUND} -eq 1 ]] && echo "Found version ${INDEX_VERSION} on ${INDEX_URL}, attempt ${COUNTER}"
|
|
75
|
+
COUNTER=$((COUNTER+1))
|
|
76
|
+
done
|
|
77
|
+
shell: bash
|
|
78
|
+
- name: Install multiphenicsx (PyPI and TestPyPI only)
|
|
79
|
+
if: inputs.index != ''
|
|
80
|
+
run: |
|
|
81
|
+
INDEX=${{ inputs.index }}
|
|
82
|
+
INDEX_VERSION=${{ inputs.index_version }}
|
|
83
|
+
EXPECTED_INDEX_VERSION=${{ inputs.expected_index_version }}
|
|
84
|
+
PACKAGE_NAME="multiphenicsx"
|
|
85
|
+
if [[ "${INDEX}" == "TestPyPI" ]]; then
|
|
86
|
+
INDEX_FLAGS="--no-cache-dir --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/"
|
|
87
|
+
elif [[ "${INDEX}" == "PyPI" ]]; then
|
|
88
|
+
INDEX_FLAGS="--no-cache-dir"
|
|
89
|
+
else
|
|
90
|
+
echo "Invalid package index" && exit 1
|
|
91
|
+
fi
|
|
92
|
+
if [[ -n "${INDEX_VERSION}" ]]; then
|
|
93
|
+
PACKAGE_VERSION="==${INDEX_VERSION}"
|
|
94
|
+
echo "Installing version ${INDEX_VERSION} from ${INDEX}"
|
|
95
|
+
else
|
|
96
|
+
PACKAGE_VERSION=""
|
|
97
|
+
echo "Installing latest compatible version from ${INDEX}"
|
|
98
|
+
fi
|
|
99
|
+
python3 -m pip install ${INDEX_FLAGS} --no-build-isolation --config-settings=build-dir="build" --config-settings=cmake.build-type="Debug" --verbose ${PACKAGE_NAME}[docs,lint,tests,tutorials]${PACKAGE_VERSION}
|
|
100
|
+
if [[ -n "${EXPECTED_INDEX_VERSION}" ]]; then
|
|
101
|
+
ACTUAL_INDEX_VERSION=$(python3 -c 'import importlib.metadata; print(importlib.metadata.version("multiphenicsx"))')
|
|
102
|
+
if [[ "${ACTUAL_INDEX_VERSION}" != "${EXPECTED_INDEX_VERSION}" ]]; then
|
|
103
|
+
echo "Error: installed ${PACKAGE_NAME} version is ${ACTUAL_INDEX_VERSION}, while expected version is ${EXPECTED_INDEX_VERSION}"
|
|
104
|
+
exit 1
|
|
105
|
+
fi
|
|
106
|
+
fi
|
|
107
|
+
shell: bash
|
|
108
|
+
- name: Install multiphenicsx (git clone only)
|
|
109
|
+
if: inputs.index == ''
|
|
110
|
+
run: |
|
|
111
|
+
python3 -m pip install --check-build-dependencies --no-build-isolation --config-settings=build-dir="build" --config-settings=cmake.build-type="Debug" --verbose .[docs,lint,tests,tutorials]
|
|
112
|
+
- name: Clean build files (git clone only)
|
|
113
|
+
if: inputs.index == ''
|
|
114
|
+
run: |
|
|
115
|
+
git config --global --add safe.directory $PWD
|
|
116
|
+
git clean -xdf
|
|
117
|
+
- name: Run ruff on python files
|
|
118
|
+
run: |
|
|
119
|
+
python3 -m ruff check .
|
|
120
|
+
- name: Run isort on python files
|
|
121
|
+
run: |
|
|
122
|
+
python3 -m isort --check --diff .
|
|
123
|
+
- name: Run mypy on python files
|
|
124
|
+
run: |
|
|
125
|
+
python3 -m mypy --exclude=conftest.py .
|
|
126
|
+
python3 -m mypy tests/unit/conftest.py
|
|
127
|
+
python3 -m mypy tutorials/conftest.py
|
|
128
|
+
- name: Run yamllint on workflows
|
|
129
|
+
run: |
|
|
130
|
+
python3 -m yamllint -d "{extends: default, rules: {document-start: {present: false}, line-length: disable, truthy: {check-keys: false}}}" .
|
|
131
|
+
- name: Run clang-format on C++ files
|
|
132
|
+
run: |
|
|
133
|
+
wget https://raw.githubusercontent.com/FEniCS/dolfinx/main/.clang-format
|
|
134
|
+
find . -type f \( -name "*.cpp" -o -name "*.h" \) | xargs clang-format --dry-run --Werror
|
|
135
|
+
- name: Run cmake-format on cmake files
|
|
136
|
+
run: |
|
|
137
|
+
wget https://raw.githubusercontent.com/FEniCS/dolfinx/main/.cmake-format
|
|
138
|
+
find . -type f \( -name "*.cmake" -o -name "*.cmake.in" -o -name "CMakeLists.txt" \) | xargs cmake-format --check
|
|
139
|
+
- name: Run documentation generation
|
|
140
|
+
run: |
|
|
141
|
+
cd docs && python3 -m sphinx -W -b html . build/html
|
|
142
|
+
- name: Remove source directory to ensure that package from installation directory is used
|
|
143
|
+
run: |
|
|
144
|
+
rm -rf multiphenicsx
|
|
145
|
+
- name: Run unit tests (serial)
|
|
146
|
+
run: |
|
|
147
|
+
COVERAGE_FILE=.coverage_unit_serial python3 -m coverage run --source=multiphenicsx -m pytest tests/unit
|
|
148
|
+
- name: Run unit tests (parallel)
|
|
149
|
+
run: |
|
|
150
|
+
COVERAGE_FILE=.coverage_unit_parallel mpirun -n 3 python3 -m coverage run --source=multiphenicsx --parallel-mode -m pytest tests/unit
|
|
151
|
+
- name: Combine coverage reports
|
|
152
|
+
run: |
|
|
153
|
+
python3 -m coverage combine .coverage*
|
|
154
|
+
python3 -m coverage report --fail-under=100 --show-missing --skip-covered
|
|
155
|
+
- name: Generate tutorial files
|
|
156
|
+
run: |
|
|
157
|
+
NO_TESTS_COLLECTED=5
|
|
158
|
+
python3 -m pytest --ipynb-action=create-notebooks tutorials || (($?==$NO_TESTS_COLLECTED))
|
|
159
|
+
python3 -m pytest --ipynb-action=create-notebooks --np=2 tutorials || (($?==$NO_TESTS_COLLECTED))
|
|
160
|
+
shell: bash
|
|
161
|
+
- name: Run ruff on tutorial files
|
|
162
|
+
run: |
|
|
163
|
+
python3 -m nbqa ruff .
|
|
164
|
+
- name: Run isort on tutorial files
|
|
165
|
+
run: |
|
|
166
|
+
python3 -m nbqa isort --check --diff .
|
|
167
|
+
- name: Run mypy on tutorial files
|
|
168
|
+
run: |
|
|
169
|
+
python3 -m nbqa mypy .
|
|
170
|
+
- name: Check for stray outputs, counts and metadata in tutorial files
|
|
171
|
+
uses: RBniCS/check-jupyter-metadata-action@main
|
|
172
|
+
with:
|
|
173
|
+
pattern: "tutorials/**/*.ipynb"
|
|
174
|
+
- name: Run tutorials (serial)
|
|
175
|
+
run: |
|
|
176
|
+
export DISPLAY=":99"
|
|
177
|
+
Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 &
|
|
178
|
+
python3 -m pytest tutorials
|
|
179
|
+
- name: Run tutorials (parallel)
|
|
180
|
+
run: |
|
|
181
|
+
export DISPLAY=":99"
|
|
182
|
+
Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 &
|
|
183
|
+
python3 -m pytest --np 3 tutorials
|
|
184
|
+
- name: Upload tutorials logs as an artifact in case of failure
|
|
185
|
+
if: failure() || cancelled()
|
|
186
|
+
uses: actions/upload-artifact@v4
|
|
187
|
+
with:
|
|
188
|
+
name: "tutorials-logs-${{ matrix.petsc_arch }}"
|
|
189
|
+
path: |
|
|
190
|
+
tutorials/**/.ipynb_pytest/**/*.log*
|
|
191
|
+
include-hidden-files: true
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: multiphenicsx CI (against releases)
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "0 3 * * *"
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test_dolfinx_v0_4_1:
|
|
10
|
+
uses: multiphenics/multiphenicsx/.github/workflows/ci.yml@dolfinx-v0.4.1
|
|
11
|
+
|
|
12
|
+
test_dolfinx_v0_5_2:
|
|
13
|
+
uses: multiphenics/multiphenicsx/.github/workflows/ci.yml@dolfinx-v0.5.2
|
|
14
|
+
|
|
15
|
+
test_dolfinx_v0_6_0:
|
|
16
|
+
uses: multiphenics/multiphenicsx/.github/workflows/ci.yml@dolfinx-v0.6.0
|
|
17
|
+
|
|
18
|
+
test_dolfinx_v0_7_0:
|
|
19
|
+
uses: multiphenics/multiphenicsx/.github/workflows/ci.yml@dolfinx-v0.7.0
|
|
20
|
+
|
|
21
|
+
test_dolfinx_v0_7_1:
|
|
22
|
+
uses: multiphenics/multiphenicsx/.github/workflows/ci.yml@dolfinx-v0.7.1
|
|
23
|
+
|
|
24
|
+
test_dolfinx_v0_7_2:
|
|
25
|
+
uses: multiphenics/multiphenicsx/.github/workflows/ci.yml@dolfinx-v0.7.2
|
|
26
|
+
|
|
27
|
+
test_dolfinx_v0_7_3:
|
|
28
|
+
uses: multiphenics/multiphenicsx/.github/workflows/ci.yml@dolfinx-v0.7.3
|
|
29
|
+
|
|
30
|
+
warn:
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
if: github.repository == 'multiphenics/multiphenicsx' && github.ref == 'refs/heads/main' && github.event_name == 'schedule'
|
|
33
|
+
steps:
|
|
34
|
+
- name: Warn if scheduled workflow is about to be disabled
|
|
35
|
+
uses: fem-on-colab/warn-workflow-about-to-be-disabled-action@main
|
|
36
|
+
with:
|
|
37
|
+
workflow-filename: ci_against_releases.yml
|
|
38
|
+
days-elapsed: 55
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Rebase dolfinx fork
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "0 0 * * *"
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
rebase:
|
|
10
|
+
if: >-
|
|
11
|
+
(github.event_name == 'schedule' && github.repository == 'multiphenics/multiphenicsx')
|
|
12
|
+
|| (github.event_name != 'schedule')
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Set username and email
|
|
16
|
+
run: |
|
|
17
|
+
git config --global user.name "GitHub Actions"
|
|
18
|
+
git config --global user.email "multiphenicsx@github.actions"
|
|
19
|
+
- name: Clone dolfinx repository
|
|
20
|
+
run: |
|
|
21
|
+
git clone https://github.com/fenics/dolfinx.git
|
|
22
|
+
- name: Add dolfinx fork
|
|
23
|
+
run: |
|
|
24
|
+
cd dolfinx
|
|
25
|
+
git remote add fork https://github.com/francesco-ballarin/dolfinx.git
|
|
26
|
+
git fetch fork
|
|
27
|
+
- name: Rebase dolfinx fork
|
|
28
|
+
run: |
|
|
29
|
+
cd dolfinx
|
|
30
|
+
git checkout -b github_actions
|
|
31
|
+
git merge fork/migration
|
|
32
|
+
|
|
33
|
+
warn:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
if: github.repository == 'multiphenics/multiphenicsx' && github.ref == 'refs/heads/main' && github.event_name == 'schedule'
|
|
36
|
+
steps:
|
|
37
|
+
- name: Warn if scheduled workflow is about to be disabled
|
|
38
|
+
uses: fem-on-colab/warn-workflow-about-to-be-disabled-action@main
|
|
39
|
+
with:
|
|
40
|
+
workflow-filename: fork_rebase.yml
|
|
41
|
+
days-elapsed: 55
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
name: "Publish on PyPI (internal: use 'Release new version' instead)"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "0 3 * * MON"
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
index:
|
|
9
|
+
description: "The package index, e.g. PyPI or TestPyPI. Defaults to TestPyPI. Be careful when choosing PyPI, because uploads there cannot be deleted"
|
|
10
|
+
workflow_call:
|
|
11
|
+
inputs:
|
|
12
|
+
ref:
|
|
13
|
+
description: "The branch, tag or SHA to checkout"
|
|
14
|
+
type: string
|
|
15
|
+
index:
|
|
16
|
+
description: "The package index, e.g. PyPI or TestPyPI. Defaults to TestPyPI. Be careful when choosing PyPI, because uploads there cannot be deleted"
|
|
17
|
+
type: string
|
|
18
|
+
secrets:
|
|
19
|
+
PYPI_TOKEN:
|
|
20
|
+
description: "Token that enables publishing to PyPI"
|
|
21
|
+
TEST_PYPI_TOKEN:
|
|
22
|
+
description: "Token that enables publishing to TestPyPI"
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
process_inputs:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- name: Determine package index
|
|
29
|
+
id: determine_index
|
|
30
|
+
run: |
|
|
31
|
+
if [[ -n "${{ (inputs || github.event.inputs).index }}" ]]; then
|
|
32
|
+
echo "index=${{ (inputs || github.event.inputs).index }}" >> ${GITHUB_OUTPUT}
|
|
33
|
+
else
|
|
34
|
+
echo "index=TestPyPI" >> ${GITHUB_OUTPUT}
|
|
35
|
+
fi
|
|
36
|
+
shell: bash
|
|
37
|
+
outputs:
|
|
38
|
+
index: ${{ steps.determine_index.outputs.index }}
|
|
39
|
+
|
|
40
|
+
build_distributions:
|
|
41
|
+
needs: [process_inputs]
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
container: ghcr.io/fenics/dolfinx/dolfinx:v0.8.0
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/checkout@v4
|
|
46
|
+
with:
|
|
47
|
+
ref: ${{ inputs.ref }}
|
|
48
|
+
- name: Add current date at the end of the version string (TestPyPI only)
|
|
49
|
+
if: needs.process_inputs.outputs.index == 'TestPyPI'
|
|
50
|
+
run: |
|
|
51
|
+
DATETIME=$(date "+%Y%m%d%H%M%S")
|
|
52
|
+
sed -i -r "s|version = \"(.*)\"|version = \"\19999${DATETIME}\"|g" pyproject.toml
|
|
53
|
+
- name: Build distributions
|
|
54
|
+
run: |
|
|
55
|
+
python3 -m pip install --break-system-packages build cmake
|
|
56
|
+
python3 -m build --no-isolation
|
|
57
|
+
- name: Determine distribution version
|
|
58
|
+
id: determine_version
|
|
59
|
+
run: |
|
|
60
|
+
python3 -m pip install --break-system-packages wheel-filename
|
|
61
|
+
WHEELS=($(find dist -type f -name "*.whl"))
|
|
62
|
+
if [[ "${#WHEELS[@]}" == "1" ]]; then
|
|
63
|
+
VERSION=$(python3 -c "import wheel_filename; print(wheel_filename.parse_wheel_filename('${WHEELS[0]}').version)")
|
|
64
|
+
echo "version=${VERSION}" >> ${GITHUB_OUTPUT}
|
|
65
|
+
else
|
|
66
|
+
echo "Found ${#WHEELS[@]} wheels, instead of one" && exit 1
|
|
67
|
+
fi
|
|
68
|
+
shell: bash
|
|
69
|
+
- name: Remove created wheels, and only leave source distribution
|
|
70
|
+
run: find dist -type f -name "*.whl" -delete
|
|
71
|
+
- name: Upload distributions as an artifact
|
|
72
|
+
uses: actions/upload-artifact@v4
|
|
73
|
+
with:
|
|
74
|
+
name: distributions-${{ steps.determine_version.outputs.version }}
|
|
75
|
+
path: dist/
|
|
76
|
+
- name: Verify distributions metadata
|
|
77
|
+
run: |
|
|
78
|
+
python3 -m pip install --break-system-packages twine
|
|
79
|
+
python3 -m twine check dist/*
|
|
80
|
+
outputs:
|
|
81
|
+
version: ${{ steps.determine_version.outputs.version }}
|
|
82
|
+
|
|
83
|
+
publish:
|
|
84
|
+
needs: [process_inputs, build_distributions]
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
steps:
|
|
87
|
+
- name: Determine package index token
|
|
88
|
+
id: determine_index_token
|
|
89
|
+
run: |
|
|
90
|
+
INDEX=${{ needs.process_inputs.outputs.index }}
|
|
91
|
+
if [[ "${INDEX}" == "PyPI" ]]; then
|
|
92
|
+
INDEX_TOKEN=${{ secrets.PYPI_TOKEN }}
|
|
93
|
+
elif [[ "${INDEX}" == "TestPyPI" ]]; then
|
|
94
|
+
INDEX_TOKEN=${{ secrets.TEST_PYPI_TOKEN }}
|
|
95
|
+
else
|
|
96
|
+
echo "Invalid package index" && exit 1
|
|
97
|
+
fi
|
|
98
|
+
if [[ -n "${INDEX_TOKEN}" ]]; then
|
|
99
|
+
echo "index_token=${INDEX_TOKEN}" >> ${GITHUB_OUTPUT}
|
|
100
|
+
else
|
|
101
|
+
echo "Missing package index token" && exit 1
|
|
102
|
+
fi
|
|
103
|
+
- name: Determine package index repository url
|
|
104
|
+
id: determine_index_repository_url
|
|
105
|
+
run: |
|
|
106
|
+
INDEX=${{ needs.process_inputs.outputs.index }}
|
|
107
|
+
if [[ "${INDEX}" == "PyPI" ]]; then
|
|
108
|
+
echo "index_repository_url=" >> ${GITHUB_OUTPUT}
|
|
109
|
+
elif [[ "${INDEX}" == "TestPyPI" ]]; then
|
|
110
|
+
echo "index_repository_url=https://test.pypi.org/legacy/" >> ${GITHUB_OUTPUT}
|
|
111
|
+
else
|
|
112
|
+
echo "Invalid package index" && exit 1
|
|
113
|
+
fi
|
|
114
|
+
- name: Report version and index which will be used
|
|
115
|
+
run: |
|
|
116
|
+
echo "Publishing version ${{ needs.build_distributions.outputs.version }} on ${{ needs.process_inputs.outputs.index }} (index repository URL: ${{ steps.determine_index_repository_url.outputs.index_repository_url }})."
|
|
117
|
+
- name: Download distributions from artifacts
|
|
118
|
+
uses: actions/download-artifact@v4
|
|
119
|
+
with:
|
|
120
|
+
name: distributions-${{ needs.build_distributions.outputs.version }}
|
|
121
|
+
path: dist
|
|
122
|
+
- name: Disallow publishing development versions (PyPI only)
|
|
123
|
+
if: needs.process_inputs.outputs.index == 'PyPI'
|
|
124
|
+
run: |
|
|
125
|
+
VERSION=${{ needs.build_distributions.outputs.version }}
|
|
126
|
+
if [[ ${VERSION} == *"dev"* ]]; then
|
|
127
|
+
echo "Cannot publish development version ${VERSION} on PyPI" && exit 1
|
|
128
|
+
fi
|
|
129
|
+
shell: bash
|
|
130
|
+
- name: Publish package distributions
|
|
131
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
132
|
+
with:
|
|
133
|
+
password: ${{ steps.determine_index_token.outputs.index_token }}
|
|
134
|
+
repository-url: ${{ steps.determine_index_repository_url.outputs.index_repository_url }}
|
|
135
|
+
|
|
136
|
+
test:
|
|
137
|
+
needs: [process_inputs, build_distributions, publish]
|
|
138
|
+
uses: multiphenics/multiphenicsx/.github/workflows/ci.yml@v0.3.8
|
|
139
|
+
with:
|
|
140
|
+
ref: ${{ inputs.ref }}
|
|
141
|
+
index: ${{ needs.process_inputs.outputs.index }}
|
|
142
|
+
index_version: ${{ needs.build_distributions.outputs.version }}
|
|
143
|
+
expected_index_version: ${{ needs.build_distributions.outputs.version }}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Francesco Ballarin <francesco.ballarin@unicatt.it>
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|