Skip to content

Scheduled

Scheduled #1233

name: Scheduled
on:
workflow_dispatch:
# Run every day at 3 am UTC
schedule:
- cron: "0 3 * * *"
permissions: {}
env:
PYBAMM_DISABLE_TELEMETRY: "true"
FORCE_COLOR: 3
concurrency:
# github.workflow: name of the workflow, so that we don't cancel other workflows
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# Cancel in-progress runs when a new workflow with the same group name is triggered
# This avoids workflow runs on both pushes and PRs
cancel-in-progress: true
jobs:
# Build the solver wheels once (like test_on_push.yml) and download them per
# job; otherwise every nox/uv sync would compile the solver from source and fail.
build_solver:
name: Solver wheels
# Pass contents:read to the reusable workflow (top-level permissions are {},
# so its checkout would otherwise get no token scope).
permissions:
contents: read
uses: ./.github/workflows/_build_solver_wheels.yml
with:
cache_wheels: true
build_sdist: false
run_unit_integration_and_coverage_tests:
needs: build_solver
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
# Full sweep: every OS x Python. Complements test_on_push.yml's sparse PR matrix;
# keep the Python list in sync with it.
matrix:
os: [ ubuntu-latest, macos-15-intel, macos-latest, windows-latest ]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
name: Tests (${{ matrix.os }} / Python ${{ matrix.python-version }})
env:
# noxfile install_locked installs the matching prebuilt solver wheel from
# this directory instead of building the solver from source.
PYBAMM_SOLVER_WHEELS: ${{ github.workspace }}/solver-wheels
steps:
- name: Check out PyBaMM repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Linux system dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install gfortran gcc graphviz pandoc
sudo apt-get install libopenblas-dev texlive-latex-extra dvipng
- name: Install macOS system dependencies
if: matrix.os == 'macos-15-intel' || matrix.os == 'macos-latest'
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_COLOR: 1
# Speed up CI
NONINTERACTIVE: 1
# sometimes gfortran cannot be found, so reinstall gcc just to be sure
run: |
brew analytics off
brew install graphviz libomp
brew reinstall gcc
- name: Install Windows system dependencies
if: matrix.os == 'windows-latest'
run: winget install --id Graphviz.Graphviz --exact --accept-source-agreements --accept-package-agreements
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
version: "latest"
enable-cache: true
- name: Install nox
run: uv tool install nox
- name: Download in-repo solver wheels
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ matrix.os == 'ubuntu-latest' && 'wheels_manylinux' || matrix.os == 'windows-latest' && 'wheels_windows' || format('wheels_{0}', matrix.os) }}
path: solver-wheels
- name: Run unit tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
if: matrix.os != 'ubuntu-latest' || matrix.python-version != '3.13'
run: nox -s unit
- name: Run coverage tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
run: nox -s coverage
- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Run integration tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
run: nox -s integration
run_doctests:
needs: build_solver
name: Doctests
permissions:
contents: read
uses: ./.github/workflows/_nox.yml
with:
sessions: "doctests docs"
# Full clone: the docs build's sphinx_last_updated_by_git needs the history.
fetch_depth: 0
legs: '[{"os": "ubuntu-latest", "python": "3.13"}]'
run_example_tests:
needs: build_solver
name: Example notebooks
permissions:
contents: read
uses: ./.github/workflows/_nox.yml
with:
sessions: examples
legs: '[{"os": "ubuntu-latest", "python": "3.13"}]'
run_scripts_tests:
needs: build_solver
name: Example scripts
permissions:
contents: read
uses: ./.github/workflows/_nox.yml
with:
sessions: scripts
legs: '[{"os": "ubuntu-latest", "python": "3.13"}]'