ufl4rom CI #294
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |