Skip to content

Commit

Permalink
Merge pull request #617 from connorjward/test-ci
Browse files Browse the repository at this point in the history
Make PETSc and petsc4py for CI use Firedrake not pip
  • Loading branch information
wence- authored May 10, 2021
2 parents d0cc348 + 5a89bfc commit f1daf21
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 23 deletions.
61 changes: 44 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
runs-on: ubuntu-latest
env:
CC: mpicc
PETSC_CONFIGURE_OPTIONS: --with-debugging=1
steps:
- name: Checkout repository
uses: actions/checkout@v2
PETSC_DIR: ${{ github.workspace }}/petsc
PETSC_ARCH: default
PETSC_CONFIGURE_OPTIONS: --with-debugging=1 --with-shared-libraries=1

steps:
- name: Install system dependencies
shell: bash
run: |
Expand All @@ -32,23 +32,50 @@ jobs:
with:
python-version: '3.6'

# xargs is used to force installation of requirements in the order we specified.
# pip 20.2 needed for loopy install to work.
- name: Install Python dependencies
- name: Clone PETSc
uses: actions/checkout@v2
with:
repository: firedrakeproject/petsc
path: ${{ env.PETSC_DIR }}

- name: Build and install PETSc
shell: bash
working-directory: ${{ env.PETSC_DIR }}
run: |
pip install pip==20.2
xargs -l1 pip install < requirements-ext.txt
xargs -l1 pip install < requirements-git.txt
pip install pulp
pip install -U flake8
./configure ${PETSC_CONFIGURE_OPTIONS}
make
- name: Install PyOP2
- name: Build and install petsc4py
shell: bash
run: pip install -e .
working-directory: ${{ env.PETSC_DIR }}/src/binding/petsc4py
run: |
python -m pip install --upgrade cython numpy
python -m pip install --no-deps .
- name: Do tests
- name: Checkout PyOP2
uses: actions/checkout@v2
with:
path: PyOP2

- name: Install PyOP2
shell: bash
working-directory: PyOP2
run: |
make lint
py.test test -v --tb=native
python -m pip install pip==20.2 # pip 20.2 needed for loopy install to work.
# xargs is used to force installation of requirements in the order we specified.
xargs -l1 python -m pip install < requirements-ext.txt
xargs -l1 python -m pip install < requirements-git.txt
python -m pip install pulp
python -m pip install -U flake8
python -m pip install .
- name: Run linting
shell: bash
working-directory: PyOP2
run: make lint

- name: Run tests
shell: bash
working-directory: PyOP2
run: pytest test -v --tb=native
2 changes: 1 addition & 1 deletion requirements-ext.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ pytest>=2.3
flake8>=2.1.0
pycparser>=2.10
mpi4py>=1.3.1
decorator
decorator<=4.4.2
2 changes: 0 additions & 2 deletions requirements-git.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
git+https://github.com/firedrakeproject/petsc.git@firedrake#egg=petsc
--no-deps git+https://github.com/firedrakeproject/petsc4py.git@firedrake#egg=petsc4py
git+https://github.com/coneoproject/COFFEE.git#egg=coffee
git+https://github.com/firedrakeproject/loopy.git@firedrake#egg=loopy
6 changes: 3 additions & 3 deletions test/unit/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,11 +785,11 @@ def test_dat_on_set_builds_dim_one_dataset(self, set):
assert d.dataset.cdim == 1

def test_dat_dtype_type(self, dset):
"The type of a Dat's dtype property should by numpy.dtype."
"The type of a Dat's dtype property should be a numpy.dtype."
d = op2.Dat(dset)
assert type(d.dtype) == np.dtype
assert isinstance(d.dtype, np.dtype)
d = op2.Dat(dset, [1.0] * dset.size * dset.cdim)
assert type(d.dtype) == np.dtype
assert isinstance(d.dtype, np.dtype)

def test_dat_split(self, dat):
"Splitting a Dat should yield a tuple with self"
Expand Down

0 comments on commit f1daf21

Please sign in to comment.