Scheduled #271
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
# Run all unit tests and integration tests for all Python versions | |
# and platforms at 3am UTC every day and on PRs to the main branch | |
name: Scheduled | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
# Run everyday at 3 am UTC | |
schedule: | |
- cron: "0 3 * * *" | |
env: | |
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: | |
style: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Check style | |
run: | | |
python -m pip install pre-commit | |
pre-commit run -a | |
build: | |
needs: style | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Linux system dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt install gfortran gcc libopenblas-dev graphviz pandoc | |
sudo apt install texlive-full | |
- name: Install macOS system dependencies | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew analytics off | |
brew install graphviz openblas libomp | |
brew reinstall gcc | |
- name: Install Windows system dependencies | |
if: matrix.os == 'windows-latest' | |
run: choco install graphviz --version=2.38.0.20190211 | |
- name: Install nox | |
run: python -m pip install nox | |
- name: Install SuiteSparse and SUNDIALS on GNU/Linux and macOS | |
if: matrix.os != 'windows-latest' | |
run: python -m nox -s pybamm-requires | |
- name: Run unit tests for GNU/Linux with Python 3.8, 3.9, 3.10, and 3.12; and for macOS and Windows with all Python versions | |
if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest') | |
run: python -m nox -s unit | |
- name: Run unit tests for GNU/Linux with Python 3.11 and generate coverage report | |
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 | |
run: python -m nox -s coverage | |
- name: Upload coverage report | |
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 | |
uses: codecov/[email protected] | |
- name: Run integration tests | |
run: python -m nox -s integration | |
- name: Install docs dependencies and run doctests | |
if: matrix.os == 'ubuntu-latest' | |
run: python -m nox -s doctests | |
- name: Check if the documentation can be built | |
if: matrix.os == 'ubuntu-latest' | |
run: python -m nox -s docs | |
- name: Install dev dependencies and run example tests | |
if: matrix.os == 'ubuntu-latest' | |
run: python -m nox -s examples | |
- name: Run example scripts tests | |
if: matrix.os == 'ubuntu-latest' | |
run: python -m nox -s scripts | |
#M-series Mac Mini | |
build-apple-mseries: | |
if: github.repository_owner == 'pybamm-team' | |
needs: style | |
runs-on: [self-hosted, macOS, ARM64] | |
env: | |
GITHUB_PATH: ${PYENV_ROOT/bin:$PATH} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install python & create virtualenv | |
shell: bash | |
run: | | |
eval "$(pyenv init -)" | |
pyenv install ${{ matrix.python-version }} -s | |
pyenv virtualenv ${{ matrix.python-version }} pybamm-${{ matrix.python-version }} | |
- name: Install dependencies & run unit tests for Windows and MacOS | |
shell: bash | |
run: | | |
eval "$(pyenv init -)" | |
pyenv activate pybamm-${{ matrix.python-version }} | |
python -m pip install --upgrade pip wheel setuptools nox | |
python -m nox -s unit | |
- name: Run integration tests for Windows and MacOS | |
run: | | |
eval "$(pyenv init -)" | |
pyenv activate pybamm-${{ matrix.python-version }} | |
python -m nox -s integration | |
- name: Uninstall pyenv-virtualenv & python | |
if: always() | |
shell: bash | |
run: | | |
eval "$(pyenv init -)" | |
pyenv activate pybamm-${{ matrix.python-version }} | |
pyenv uninstall -f $( python --version ) | |
test_install_odes: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
fail-fast: false | |
name: Test pybamm_install_odes on ${{ matrix.os }} | |
steps: | |
- name: Check out PyBaMM repository | |
uses: actions/checkout@v4 | |
- name: Install Linux system dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install gfortran gcc libopenblas-dev | |
- name: Install macOS system dependencies | |
if: matrix.os == 'macos-latest' | |
env: | |
# Homebrew environment variables | |
HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
HOMEBREW_NO_COLOR: 1 | |
# Speed up CI | |
NONINTERACTIVE: 1 | |
run: | | |
brew analytics off | |
brew install openblas | |
brew reinstall gcc gfortran | |
- name: Set up Python ${{ matrix.python-version }} | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install PyBaMM | |
run: python -m pip install -e . | |
- name: Test pybamm_install_odes on ${{ matrix.os }} | |
run: | | |
python -m pip cache purge | |
python -m pip install wget cmake | |
pybamm_install_odes |