Skip to content

Commit

Permalink
Merge pull request #9 from connorjward/JDBetteridge/enable_ci
Browse files Browse the repository at this point in the history
Enable CI testing (3.10, 3.11 only)
  • Loading branch information
connorjward authored Sep 13, 2023
2 parents e1a8b9c + a7ccfd8 commit 0c639ed
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 5 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Testing

# Trigger the workflow on push or pull request,
# but only for the master branch
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
strategy:
# Don't immediately kill all if one Python version fails
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
env:
CC: mpicc
PETSC_DIR: ${{ github.workspace }}/petsc
PETSC_ARCH: default
PETSC_CONFIGURE_OPTIONS: --with-debugging=1 --with-shared-libraries=1 --with-c2html=0 --with-fortran-bindings=0
RDMAV_FORK_SAFE: 1
timeout-minutes: 60

steps:
- name: Install system dependencies
shell: bash
run: |
sudo apt update
sudo apt install build-essential mpich libmpich-dev \
libblas-dev liblapack-dev gfortran
- name: Set correct Python version
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Clone PETSc
uses: actions/checkout@v4
with:
repository: firedrakeproject/petsc
path: ${{ env.PETSC_DIR }}

- name: Build and install PETSc
shell: bash
working-directory: ${{ env.PETSC_DIR }}
run: |
./configure ${PETSC_CONFIGURE_OPTIONS}
make
- name: Build and install petsc4py
# Remove this step when Firedrake PETSc branch is updated to support
# building petsc4py with Cython>=3.0
shell: bash
working-directory: ${{ env.PETSC_DIR }}/src/binding/petsc4py
run: |
pip install --upgrade pip
pip install --upgrade wheel 'cython<3' numpy
pip install --no-deps .
- name: Checkout pyop3
uses: actions/checkout@v4
with:
path: pyop3

- name: Install pyop3 and testing dependencies
shell: bash
working-directory: pyop3
run: |
# Gross:
pip install toml
python scripts/requirements.py build | pip install -r /dev/stdin
pip install --no-build-isolation .
python scripts/requirements.py run | pip install -r /dev/stdin
pip install pytest pytest-cov pytest-timeout pytest-xdist pytest-timeout
- name: Run tests
shell: bash
working-directory: pyop3
run: |
pytest \
--durations=200 \
--tb=native \
--cov pyop3 \
--timeout=480 \
--timeout-method=thread \
-o faulthandler_timeout=540 \
-n 12 --dist worksteal \
-v tests
timeout-minutes: 10


4 changes: 0 additions & 4 deletions pyop3/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
import os
from tempfile import gettempdir

from loopy.target.c import CWithGNULibcTarget


class ConfigurationError(RuntimeError):
pass
Expand Down Expand Up @@ -155,5 +153,3 @@ def __setitem__(self, key, value):


config = Configuration()

target = CWithGNULibcTarget()
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
[build-system]
requires = ["setuptools", "cython"]
requires = [
"setuptools",
"cython<3",
"numpy",
"petsc4py"
]
build-backend = "setuptools.build_meta"

[project]
name = "pyop3"
version = "0.1"
dependencies = [
"pyrsistent",
"numpy",
"loopy @ git+https://github.com/firedrakeproject/loopy.git",
"mpi4py",
"petsc4py"
]

[project.optional-dependencies]
Expand Down
11 changes: 11 additions & 0 deletions scripts/requirements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sys

import toml

pyproject = toml.load("pyproject.toml")
if "build" in sys.argv:
packages = pyproject["build-system"]["requires"]
elif "run" in sys.argv:
packages = pyproject["project"]["dependencies"]

print("\n".join([pkg for pkg in packages if pkg != "petsc4py"]))

0 comments on commit 0c639ed

Please sign in to comment.