Skip to content

JDBetteridge/Composite actions #209

JDBetteridge/Composite actions

JDBetteridge/Composite actions #209

Workflow file for this run

name: Jupyter Notebooks
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
jobs:
tutorials-basic:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
DEVITO_ARCH: "${{ matrix.compiler }}"
DEVITO_LANGUAGE: ${{ matrix.language }}
strategy:
# Prevent all build to stop if a single one fails
fail-fast: false
matrix:
name: [
tutos-ubuntu-gcc-py310,
tutos-osx-clang-py311
]
include:
- name: tutos-ubuntu-gcc-py310
os: ubuntu-latest
compiler: gcc
language: "openmp"
python-version: "3.10"
- name: tutos-osx-clang-py311
os: macos-latest
compiler: clang
language: "C"
python-version: "3.11"
steps:
- name: Checkout devito
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- uses: maxim-lobanov/setup-xcode@v1
if: runner.os == 'macOS'
with:
xcode-version: latest-stable
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[tests,extras]"
pip install blosc
- name: Seismic notebooks
run: |
pytest --nbval -k 'not dask' -k 'not synthetics' examples/seismic/tutorials/
pytest --nbval examples/seismic/acoustic/accuracy.ipynb
- name: Failing notebooks
continue-on-error: true
run: |
pytest --nbval examples/seismic/tutorials/14_creating_synthetics.ipynb
- name: Dask notebooks
if: runner.os != 'macOS'
run: |
pytest --nbval examples/seismic/tutorials/*dask*.ipynb
- name: Self-adjoint notebooks
run: |
pytest --nbval examples/seismic/self_adjoint/
- name: CFD notebooks
run: |
pytest --nbval examples/cfd
- name: User api notebooks
run: |
pytest --nbval examples/userapi
- name: Compiler notebooks
run: |
pytest --nbval examples/compiler
- name: Finance notebooks
run: |
pytest --nbval examples/finance
- name: Performance notebooks
run: |
pytest --nbval examples/performance
- name: ABC Notebooks
run: |
pytest --nbval examples/seismic/abc_methods
- name: Timestepping Notebooks
run: |
pytest --nbval examples/timestepping
tutorials-docker:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
DEVITO_ARCH: "${{ matrix.compiler }}"
DEVITO_LANGUAGE: ${{ matrix.language }}
strategy:
# Prevent all build to stop if a single one fails
fail-fast: false
matrix:
name: [
tutos-docker-gcc-py310
]
include:
- name: tutos-docker-gcc-py310
os: ubuntu-latest
compiler: gcc
language: "openmp"
python-version: "3.10"
steps:
- name: Checkout devito
uses: actions/checkout@v6
- id: build
name: Build docker image
uses: ./.github/actions/docker-build
with:
file: docker/Dockerfile.devito
tag: ${{ matrix.name }}
- name: Get the Docker image Python version
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
command: >
python3 --version | grep "Python " | cut -d' ' -f2 | cut -d'.' -f1,2 > dockerpythonversion.txt
- name: Check Docker image Python version
run: |
declared_pyver="${{ matrix.python-version }}"
actual_pyver=$(cat dockerpythonversion.txt)
echo "Declared Python version: $declared_pyver"
echo "Actual Python version: $actual_pyver"
if [ "$declared_pyver" != "$actual_pyver" ]; then
echo "Python version mismatch: declared $declared_pyver, image has $actual_pyver"
exit 1
fi
- name: Test seismic notebooks
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
CI=true
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
DEVITO_LOGGING=DEBUG
PYTHONFAULTHANDLER=1
command: |
pytest \
--nbval \
-k 'not dask' \
-k 'not synthetics' \
examples/seismic/tutorials/
- name: Test seismic accuracy notebook
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
CI=true
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
DEVITO_LOGGING=DEBUG
PYTHONFAULTHANDLER=1
command: |
pytest --nbval examples/seismic/acoustic/accuracy.ipynb
- name: Failing notebooks
continue-on-error: true
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
CI=true
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
DEVITO_LOGGING=DEBUG
PYTHONFAULTHANDLER=1
command: |
pytest --nbval examples/seismic/tutorials/14_creating_synthetics.ipynb
- name: Dask notebooks
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
CI=true
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
DEVITO_LOGGING=DEBUG
PYTHONFAULTHANDLER=1
command: |
pytest --nbval examples/seismic/tutorials/*dask*.ipynb
- name: Self-adjoint notebooks
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
CI=true
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
DEVITO_LOGGING=DEBUG
PYTHONFAULTHANDLER=1
command: |
pytest --nbval examples/seismic/self_adjoint/
- name: CFD notebooks
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
CI=true
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
DEVITO_LOGGING=DEBUG
PYTHONFAULTHANDLER=1
command: |
pytest --nbval examples/cfd
- name: User api notebooks
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
CI=true
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
PYTHONFAULTHANDLER=1
command: |
pytest --nbval examples/userapi
- name: Compiler notebooks
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
CI=true
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
DEVITO_LOGGING=DEBUG
PYTHONFAULTHANDLER=1
command: |
pytest --nbval examples/compiler
- name: Finance notebooks
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
CI=true
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
DEVITO_LOGGING=DEBUG
PYTHONFAULTHANDLER=1
command: |
pytest --nbval examples/finance
- name: Performance notebooks
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
CI=true
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
PYTHONFAULTHANDLER=1
command: |
pytest --nbval examples/performance
- name: ABC Notebooks
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
CI=true
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
DEVITO_LOGGING=DEBUG
PYTHONFAULTHANDLER=1
command: |
pytest --nbval examples/seismic/abc_methods
- name: Timestepping Notebooks
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
CI=true
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
DEVITO_LOGGING=DEBUG
PYTHONFAULTHANDLER=1
command: |
pytest --nbval examples/timestepping
- name: Cleanup docker image
if: always()
uses: ./.github/actions/docker-clean
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}