Framework py -> ipynb -> docu #143
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: PyTest | ||
on: | ||
pull_request: | ||
paths-ignore: | ||
- "**.md" | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11"] | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install .[test] | ||
python -m pip install .[notebook] | ||
- name: Install pytest-github-actions-annotate-failures plugin | ||
run: pip install pytest-github-actions-annotate-failures | ||
- name: Run PyTest | ||
run: | | ||
pytest -n 4 --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=mrpro | tee pytest-coverage.txt | ||
- name: Pytest coverage comment | ||
id: coverageComment | ||
uses: MishaKav/[email protected] | ||
with: | ||
pytest-coverage-path: ./pytest-coverage.txt | ||
junitxml-path: ./pytest.xml | ||
- name: Create the Badge | ||
uses: schneegans/[email protected] | ||
with: | ||
auth: ${{ secrets.GIST_SECRET }} | ||
gistID: 48e334a10caf60e6708d7c712e56d241 | ||
filename: coverage.json | ||
label: Coverage Report | ||
message: ${{ steps.coverageComment.outputs.coverage }} | ||
color: ${{ steps.coverageComment.outputs.color }} | ||
namedLogo: python | ||
- name: Set pipeline status | ||
run: | | ||
if [[ ${{ steps.coverageComment.outputs.errors }} -ne 0 || ${{ steps.coverageComment.outputs.failures }} -ne 0 ]]; then | ||
echo "Errors or failures detected, marking pipeline as failure." | ||
exit 1 | ||
fi | ||
set_notebooks: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.notebooks }} | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pip' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install .[notebook] | ||
- name: Create notebook list | ||
id: set-matrix | ||
run: | | ||
ls ./examples/ | ||
jupytext --to ipynb $(grep -rl --include='./examples/*.py' './') | ||
ls | ||
echo "::set-output name=notebooks:{$(grep -rl --include='*.ipynb' './')}"" | ||
run_notebooks: | ||
needs: set_notebooks | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: ${{fromJson(needs.set_notebooks.outputs.notebooks)}} | ||
steps: | ||
- name: Get notebook names | ||
run: | | ||
Check failure on line 106 in .github/workflows/pytest.yml GitHub Actions / PyTestInvalid workflow file
|
||
echo ${{ notebooks }} | ||
echo ${{ notebooks.name }} | ||
- name: Run notebooks | ||
uses: yaananth/run-notebook@v2 | ||
env: | ||
RUNNER: ${{ toJson(runner) }} | ||
SECRETS: ${{ toJson(secrets) }} | ||
GITHUB: ${{ toJson(github) }} | ||
with: | ||
notebook: "notebook2.ipynb" |