Initialise PETSc, drop LinSolveExprs in lower_petsc, add PETScStruct, create matvec callback and move files into PETSc folder #45
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: CI-petsc | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the master branch | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
pytest: | |
name: ${{ matrix.name }}-${{ matrix.set }} | |
runs-on: "${{ matrix.os }}" | |
env: | |
DEVITO_ARCH: "${{ matrix.arch }}" | |
DEVITO_LANGUAGE: ${{ matrix.language }} | |
strategy: | |
# Prevent all build to stop if a single one fails | |
fail-fast: false | |
matrix: | |
name: [ | |
pytest-docker-py38, | |
pytest-docker-py39, | |
pytest-docker-py312 | |
] | |
include: | |
- name: pytest-docker-py38 | |
python-version: '3.8' | |
os: ubuntu-latest | |
arch: "gcc" | |
language: "C" | |
sympy: "1.12" | |
- name: pytest-docker-py39 | |
python-version: '3.9' | |
os: ubuntu-latest | |
arch: "gcc" | |
language: "C" | |
sympy: "1.12" | |
- name: pytest-docker-py312 | |
python-version: '3.12' | |
os: ubuntu-latest | |
arch: "gcc" | |
language: "C" | |
sympy: "1.12" | |
steps: | |
- name: Checkout devito | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
if: "!contains(matrix.name, 'docker')" | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Build docker image | |
run: | | |
docker build . --file docker/Dockerfile.devito --tag devito_img --build-arg base=zoeleibowitz/zoeleibowitz:petsc | |
- name: Set run prefix | |
run: | | |
echo "RUN_CMD=docker run --rm -t -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} --name testrun devito_img" >> $GITHUB_ENV | |
fi | |
id: set-run | |
- name: Set tests | |
run : | | |
echo "TESTS=tests/test_petsc.py" >> $GITHUB_ENV | |
fi | |
id: set-tests | |
- name: Set pip flags for latest python (3.12) | |
run: | | |
if [ "${{ matrix.python-version }}" == '3.12' ]; then | |
echo "PIPFLAGS='--break-system-packages'" >> $GITHUB_ENV | |
fi | |
- name: Check configuration | |
run: | | |
${{ env.RUN_CMD }} python3 -c "from devito import configuration; print(''.join(['%s: %s \n' % (k, v) for (k, v) in configuration.items()]))" | |
- name: Test with pytest | |
run: | | |
${{ env.RUN_CMD }} pytest -k "${{ matrix.test-set }}" -m "not parallel" --cov --cov-config=.coveragerc --cov-report=xml ${{ env.TESTS }} | |
- name: Upload coverage to Codecov | |
if: "!contains(matrix.name, 'docker')" | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
name: ${{ matrix.name }} |