Skip to content

Fix publish workflow: preserve PDF when building HTML #15

Fix publish workflow: preserve PDF when building HTML

Fix publish workflow: preserve PDF when building HTML #15

Workflow file for this run

name: CI
on:
push:
branches: [main, devito]
pull_request:
branches: [main]
jobs:
# Run tests for mathematical derivations and operators with coverage
test-derivations:
name: Test Mathematical Derivations
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov numpy sympy matplotlib ipython
- name: Run tests with coverage
run: |
pytest tests/test_operators.py tests/test_derivations.py -v --cov=src --cov-report=xml --cov-report=term-missing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: derivations
name: derivations-coverage
fail_ci_if_error: false
# Run explicit Devito solver tests with coverage
test-devito-explicit:
name: Test Devito Explicit Solvers
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov numpy sympy matplotlib
pip install devito
- name: Run Devito tests with coverage
run: |
pytest tests/ -v -m "devito" --cov=src --cov-report=xml --cov-report=term-missing --tb=short
continue-on-error: true # Allow to continue even if Devito tests fail initially
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: devito
name: devito-coverage
fail_ci_if_error: false
# Lint and style checks
lint:
name: Lint and Style
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install ruff isort
- name: Run ruff check
run: |
# Check only new Devito code (skip legacy code with many pre-existing issues)
ruff check src/wave/*_devito.py src/diffu/*_devito.py src/advec/*_devito.py src/nonlin/ src/symbols.py src/operators.py src/display.py src/verification.py src/plotting.py tests/ --select=E,W,F --ignore=F403,F405,E501,E741,E743,E731,E402,F841,E722
- name: Check import ordering
run: |
isort --check-only src/ tests/ --skip __init__.py
continue-on-error: true
# Build Quarto book
build-book:
name: Build Quarto Book
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install numpy sympy matplotlib jupyter
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: '1.4.554'
- name: Install TinyTeX
run: |
quarto install tinytex
- name: Render book
run: |
quarto render --to pdf
continue-on-error: true # Book may not build initially
- name: Upload book artifact
uses: actions/upload-artifact@v4
with:
name: book-pdf
path: _book/*.pdf
if: success()