Skip to content

Commit

Permalink
Sync periodic tests with the push workflow (#4172)
Browse files Browse the repository at this point in the history
* Sync workflow

* Remove caching

* Switch order of commands

* Fix lychee

* Remove self-hosted runners

* Apply suggestions from code review

Co-authored-by: Agriya Khetarpal <[email protected]>

---------

Co-authored-by: Agriya Khetarpal <[email protected]>
  • Loading branch information
kratman and agriyakhetarpal authored Jun 28, 2024
1 parent e22d10c commit 91b1d50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 138 deletions.
147 changes: 12 additions & 135 deletions .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,15 @@ concurrency:
cancel-in-progress: true

jobs:
run_unit_tests:
name: Unit tests (${{ matrix.os }} / Python ${{ matrix.python-version }})
run_tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, macos-14, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
# Exclude Python 3.12 from unit tests since we run it in the coverage jobs
exclude:
- os: ubuntu-latest
python-version: "3.12"
os: [ ubuntu-latest, macos-12, macos-14, windows-latest ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
name: Tests (${{ matrix.os }} / Python ${{ matrix.python-version }})

steps:
- name: Check out PyBaMM repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -78,98 +75,27 @@ jobs:
run: python -m nox -s pybamm-requires

- name: Run unit tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
if: matrix.os != 'ubuntu-latest' || matrix.python-version != '3.12'
run: python -m nox -s unit

check_coverage:
runs-on: ubuntu-latest
name: Coverage tests (ubuntu-latest / Python 3.12)

steps:
- name: Check out PyBaMM repository
uses: actions/checkout@v4

- name: Install Linux system dependencies
run: |
sudo apt-get update
sudo apt-get install gfortran gcc graphviz pandoc libopenblas-dev texlive-latex-extra dvipng
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install nox
run: python -m pip install nox

- name: Install SuiteSparse and SUNDIALS on GNU/Linux
timeout-minutes: 10
run: python -m nox -s pybamm-requires

- name: Run unit tests for Ubuntu with Python 3.12 and generate coverage report
- name: Run coverage tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
run: python -m nox -s coverage

- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/[email protected]
if: github.repository == 'pybamm-team/PyBaMM'
with:
token: ${{ secrets.CODECOV_TOKEN }}

run_integration_tests:
name: Integration tests (${{ matrix.os }} / Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, macos-14, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
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 graphviz pandoc libopenblas-dev texlive-latex-extra dvipng
- name: Install macOS system dependencies
if: matrix.os == 'macos-12' || matrix.os == 'macos-14'
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
brew reinstall gcc
- name: Install Windows system dependencies
if: matrix.os == 'windows-latest'
run: choco install graphviz --version=8.0.5

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install nox
run: python -m pip install nox

- name: Install SuiteSparse and SUNDIALS on GNU/Linux and macOS
timeout-minutes: 10
if: matrix.os != 'windows-latest'
run: python -m nox -s pybamm-requires

- name: Run integration tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
run: python -m nox -s integration

# Skips IDAKLU module compilation for speedups, which is already tested in other jobs.
run_doctests:
runs-on: ubuntu-latest
name: Doctests (ubuntu-latest / Python 3.11)

steps:
- name: Check out PyBaMM repository
uses: actions/checkout@v4
Expand All @@ -179,9 +105,9 @@ jobs:
- name: Install Linux system dependencies
run: |
sudo apt-get update
sudo apt-get install graphviz pandoc libopenblas-dev texlive-latex-extra dvipng
sudo apt-get install graphviz pandoc texlive-latex-extra dvipng
- name: Set up Python 3.11
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
Expand Down Expand Up @@ -250,52 +176,3 @@ jobs:

- name: Run example scripts tests for GNU/Linux with Python 3.12
run: python -m nox -s scripts

# M-series Mac Mini
build-apple-mseries:
if: github.repository_owner == 'pybamm-team'
runs-on: [self-hosted, macOS, ARM64]
env:
GITHUB_PATH: ${PYENV_ROOT/bin:$PATH}
LD_LIBRARY_PATH: $HOME/.local/lib
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- name: Check out PyBaMM repository
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 build-time dependencies & run unit tests for M-series macOS runner
shell: bash
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
NONINTERACTIVE: 1
run: |
eval "$(pyenv init -)"
pyenv activate pybamm-${{ matrix.python-version }}
python -m pip install --upgrade pip nox
python -m nox -s pybamm-requires -- --force
python -m nox -s unit
- name: Run integration tests for M-series macOS runner
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 )
3 changes: 0 additions & 3 deletions pybamm/expression_tree/operations/latexify.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,12 @@ def latexify(self, output_variables=None):
# Split list with new lines
eqn_new_line = sympy.Symbol(r"\\\\".join(map(custom_print_func, eqn_list)))

# Return latex of equations
if self.filename is None:
if self.newline is True:
return eqn_new_line
else:
return eqn_list

# # Formats - tex
elif self.filename.endswith(".tex"): # pragma: no cover
return sympy.preview(eqn_new_line, outputTexFile=self.filename)

Expand All @@ -289,7 +287,6 @@ def latexify(self, output_variables=None):
euler=False,
)

# For more dvioptions see https://www.nongnu.org/dvipng/dvipng_4.html
else:
try:
return sympy.preview(
Expand Down

0 comments on commit 91b1d50

Please sign in to comment.