Bump pre-commit/action from 3.0.0 to 3.0.1 #72
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: "Tests" | |
on: | |
push: | |
branches-ignore: | |
- "dependabot/**" | |
- "sourcery/**" | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Run pre-commit | |
uses: pre-commit/[email protected] | |
create-test-matrix: | |
name: Create Notebook List | |
runs-on: ubuntu-latest | |
needs: [pre-commit] | |
outputs: | |
notebook-list: ${{ steps.notebooks.outputs.notebook-list }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Set notebook list | |
id: notebooks | |
shell: python | |
run: | | |
import json | |
import os | |
from pathlib import Path | |
block_list =[ | |
"BRC_NIR-global-case-study-pretty", | |
"BRC_VIS_NIR-target-case-study-pretty", | |
"BRC_VIS-global-case-study-pretty", | |
"CK-case-study", | |
"oc_tol", | |
"coc_tol", | |
"oc_coc_tol_target", | |
"oc_coc_tol_target_refined", | |
"PCP-case-study", | |
"PCP-case-study-pretty", | |
"BE-case-study-pretty", | |
"Spirulina-case-study", | |
"CKq-case-study", | |
"CKuq-case-study", | |
"PS1_pyglotaran_equalarea", | |
"ocg_dcm", | |
"ocg_dcm-refined2", | |
"PAL_open_global-pretty", | |
"PAL_closed_global-pretty", | |
"PAL_open_closed_target_exercise" | |
] | |
notebook_paths = [] | |
for notebook_path in Path().rglob("*.ipynb"): | |
if notebook_path.stem not in block_list: | |
notebook_paths.append( | |
{ | |
"name": notebook_path.stem, | |
"path": notebook_path.resolve().as_posix(), | |
} | |
) | |
with open(os.getenv("GITHUB_OUTPUT"), "a", encoding="utf8") as f: | |
f.writelines([f"notebook-list={json.dumps(notebook_paths)}"]) | |
run-tests: | |
name: "Test ${{ matrix.notebook_path.name }}" | |
runs-on: ubuntu-latest | |
needs: [create-test-matrix] | |
strategy: | |
matrix: | |
notebook_path: ${{fromJson(needs.create-test-matrix.outputs.notebook-list)}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install test dependencies | |
run: | | |
pip install wheel | |
pip install -r .github/test-requirements.txt | |
- name: Testing ${{ matrix.notebook_path.name }} | |
run: python -m pytest --nbval-lax ${{ matrix.notebook_path.path }} | |
- name: Installed packages | |
if: always() | |
run: | | |
pip freeze |