Skip to content

Force upgrade of scikit-build-core[pyproject] #2780

Force upgrade of scikit-build-core[pyproject]

Force upgrade of scikit-build-core[pyproject] #2780

Workflow file for this run

name: CI
on:
push:
branches:
- "**"
pull_request:
branches:
- main
schedule:
- cron: "0 3 * * *"
workflow_dispatch:
workflow_call:
inputs:
ref:
description: "The branch, tag or SHA to checkout"
type: string
index:
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"
type: string
index_version:
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."
type: string
expected_index_version:
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."
type: string
jobs:
test:
runs-on: ubuntu-latest
container: ghcr.io/fenics/dolfinx/dolfinx:v0.9.0
strategy:
matrix:
petsc_arch: [real, complex]
fail-fast: false
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ inputs.ref }}
- name: Setup container
run: |
export DEBIAN_FRONTEND="noninteractive"
apt update -y -q
apt install -y -qq libegl1 libgl1-mesa-dri
. /usr/local/bin/dolfinx-${{ matrix.petsc_arch }}-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
rm /dolfinx-env/lib/python3.12/site-packages/petsc4py/py.typed
python3 -m pip install --upgrade scikit-build-core[pyproject]
- name: Wait for package index availability (PyPI and TestPyPI only)
if: inputs.index != '' && inputs.index_version != ''
run: |
INDEX=${{ inputs.index }}
INDEX_VERSION=${{ inputs.index_version }}
PACKAGE_NAME="multiphenicsx"
if [[ "${INDEX}" == "TestPyPI" ]]; then
INDEX_URL=https://test.pypi.org
elif [[ "${INDEX}" == "PyPI" ]]; then
INDEX_URL=https://pypi.org
else
echo "Invalid package index" && exit 1
fi
COUNTER=0
INDEX_VERSION_FOUND=0
while [[ ${INDEX_VERSION_FOUND} -ne 1 ]]; do
python3 -m pip install --no-cache-dir --index-url ${INDEX_URL}/simple/ ${PACKAGE_NAME}==0 2> all_${PACKAGE_NAME}_versions || true
if grep -q ${INDEX_VERSION} all_${PACKAGE_NAME}_versions; then
INDEX_VERSION_FOUND=1
fi
[[ ${INDEX_VERSION_FOUND} -ne 1 && ${COUNTER} -eq 5 ]] && echo "Giving up on finding version ${INDEX_VERSION} on ${INDEX_URL}" && exit 1
[[ ${INDEX_VERSION_FOUND} -ne 1 ]] && echo "Cannot find version ${INDEX_VERSION} on ${INDEX_URL}, attempt ${COUNTER}: trying again after a short pause" && sleep 10
[[ ${INDEX_VERSION_FOUND} -eq 1 ]] && echo "Found version ${INDEX_VERSION} on ${INDEX_URL}, attempt ${COUNTER}"
COUNTER=$((COUNTER+1))
done
shell: bash
- name: Install multiphenicsx (PyPI and TestPyPI only)
if: inputs.index != ''
run: |
INDEX=${{ inputs.index }}
INDEX_VERSION=${{ inputs.index_version }}
EXPECTED_INDEX_VERSION=${{ inputs.expected_index_version }}
PACKAGE_NAME="multiphenicsx"
if [[ "${INDEX}" == "TestPyPI" ]]; then
INDEX_FLAGS="--no-cache-dir --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/"
elif [[ "${INDEX}" == "PyPI" ]]; then
INDEX_FLAGS="--no-cache-dir"
else
echo "Invalid package index" && exit 1
fi
if [[ -n "${INDEX_VERSION}" ]]; then
PACKAGE_VERSION="==${INDEX_VERSION}"
echo "Installing version ${INDEX_VERSION} from ${INDEX}"
else
PACKAGE_VERSION=""
echo "Installing latest compatible version from ${INDEX}"
fi
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}
if [[ -n "${EXPECTED_INDEX_VERSION}" ]]; then
ACTUAL_INDEX_VERSION=$(python3 -c 'import importlib.metadata; print(importlib.metadata.version("multiphenicsx"))')
if [[ "${ACTUAL_INDEX_VERSION}" != "${EXPECTED_INDEX_VERSION}" ]]; then
echo "Error: installed ${PACKAGE_NAME} version is ${ACTUAL_INDEX_VERSION}, while expected version is ${EXPECTED_INDEX_VERSION}"
exit 1
fi
fi
shell: bash
- name: Install multiphenicsx (git clone only)
if: inputs.index == ''
run: |
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]
- name: Clean build files (git clone only)
if: inputs.index == ''
run: |
git config --global --add safe.directory $PWD
git clean -xdf
- name: Run ruff on python files
run: |
python3 -m ruff check .
- name: Run isort on python files
run: |
python3 -m isort --check --diff .
- name: Run mypy on python files
run: |
python3 -m mypy --exclude=conftest.py .
python3 -m mypy tests/unit/conftest.py
python3 -m mypy tutorials/conftest.py
- name: Run yamllint on workflows
run: |
python3 -m yamllint -d "{extends: default, rules: {document-start: {present: false}, line-length: disable, truthy: {check-keys: false}}}" .
- name: Run cmake-format on cmake files
run: |
wget https://raw.githubusercontent.com/FEniCS/dolfinx/main/.cmake-format
find . -type f \( -name "*.cmake" -o -name "*.cmake.in" -o -name "CMakeLists.txt" \) | xargs cmake-format --check
- name: Run documentation generation
run: |
cd docs && python3 -m sphinx -W -b html . build/html
- name: Remove source directory to ensure that package from installation directory is used
run: |
rm -rf multiphenicsx
- name: Run unit tests (serial)
run: |
COVERAGE_FILE=.coverage_unit_serial python3 -m coverage run --source=multiphenicsx -m pytest tests/unit
- name: Run unit tests (parallel)
run: |
COVERAGE_FILE=.coverage_unit_parallel mpirun -n 3 python3 -m coverage run --source=multiphenicsx --parallel-mode -m pytest tests/unit
- name: Combine coverage reports
run: |
python3 -m coverage combine .coverage*
python3 -m coverage report --fail-under=100 --show-missing --skip-covered
- name: Generate tutorial files
run: |
NO_TESTS_COLLECTED=5
python3 -m pytest --ipynb-action=create-notebooks tutorials || (($?==$NO_TESTS_COLLECTED))
python3 -m pytest --ipynb-action=create-notebooks --np=2 tutorials || (($?==$NO_TESTS_COLLECTED))
shell: bash
- name: Run ruff on tutorial files
run: |
python3 -m nbqa ruff .
- name: Run isort on tutorial files
run: |
python3 -m nbqa isort --check --diff .
- name: Run mypy on tutorial files
run: |
python3 -m nbqa mypy .
- name: Check for stray outputs, counts and metadata in tutorial files
uses: RBniCS/check-jupyter-metadata-action@6df653e5d45f7620d888c6a1bd85d07b4f903045 # v1.0.0
with:
pattern: "tutorials/**/*.ipynb"
- name: Run tutorials (serial)
run: |
VISKEX_PYVISTA_BACKEND="static" python3 -m pytest tutorials
- name: Run tutorials (parallel)
run: |
VISKEX_PYVISTA_BACKEND="static" python3 -m pytest --np 3 tutorials
- name: Upload tutorials logs as an artifact in case of failure
if: failure() || cancelled()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: "tutorials-logs-${{ matrix.petsc_arch }}"
path: |
tutorials/**/.ipynb_pytest/**/*.log*
include-hidden-files: true