Higher splitting for Github Actions and Cache venv #7107
Workflow file for this run
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
name: Notebook tests | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
notebook_tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.10'] | |
group: [1, 2] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Restore Python environment cache | |
id: restore-env | |
uses: actions/cache/restore@v4 | |
with: | |
path: .venv-${{ matrix.python-version }} | |
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }} | |
- name: Set up virtual environment if not restored from cache | |
if: steps.restore-env.outputs.cache-hit != 'true' | |
run: | | |
python -m venv .venv-${{ matrix.python-version }} | |
source .venv-${{ matrix.python-version }}/bin/activate | |
python -m pip install --upgrade pip | |
pip install -r devtools/dev-requirements.txt | |
- name: Test notebooks with pytest and nbmake | |
run: | | |
source .venv-${{ matrix.python-version }}/bin/activate | |
pwd | |
lscpu | |
export PYTHONPATH=$(pwd) | |
pytest -v --nbmake "./docs/notebooks" \ | |
--nbmake-timeout=2000 \ | |
--ignore=./docs/notebooks/zernike_eval.ipynb \ | |
--splits 2 \ | |
--group ${{ matrix.group }} \ |