Skip to content

Commit

Permalink
CI: try testing changed notebooks only
Browse files Browse the repository at this point in the history
  • Loading branch information
mbackenkoehler committed Nov 13, 2023
1 parent ca89d98 commit 9bb95c5
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ jobs:
fail-fast: false
matrix:
cfg:
- os: ubuntu-latest
python-version: "3.8"
- os: ubuntu-latest
python-version: "3.9"
- os: macos-latest
python-version: "3.8"
python-version: "3.9"
- os: windows-latest
python-version: "3.8"
python-version: "3.9"

env:
PYVER: ${{ matrix.cfg.python-version }}
PACKAGE: teachopencadd

steps:
- uses: actions/checkout@v3
- name: Checkout Repository
uses: actions/checkout@v3

- uses: conda-incubator/setup-miniconda@v2
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.cfg.python-version }}
miniforge-variant: Mambaforge
Expand Down Expand Up @@ -68,7 +68,16 @@ jobs:
teachopencadd -h
pytest -v --cov=${PACKAGE} --cov-report=xml --color=yes ${PACKAGE}/tests/
- name: Run tests
- name: Find changed notebooks
id: find_changed
run: |
# Find changed notebooks in the last commit
changed_files=$(git diff --name-only ${{ github.sha }}^ ${{ github.sha }} | grep 'talktorial.ipynb$' || true)
echo "Changed notebooks: $changed_files"
echo "::set-output name=changed_notebooks::$changed_files"
- name: Setup environment variables:
shell: bash -l {0}
run: |
PYTEST_ARGS="--nbval-lax --current-env --dist loadscope --numprocesses 2"
Expand Down Expand Up @@ -102,6 +111,15 @@ jobs:
IGNORE="$IGNORE $PYTEST_IGNORE_T036" # may cause kernel dying in pytest
fi
- name: Test changed notebooks
if: steps.find_changed.outputs.changed_notebooks != ''
run: |
pytest $PYTEST_ARGS ${{ steps.find_changed.outputs.changed_notebooks }} $IGNORE
- name: Test all notebooks
if: github.event_name == 'schedule'
shell: bash -l {0}
run: |
pytest $PYTEST_ARGS teachopencadd/talktorials/ $IGNORE
format:
Expand Down

0 comments on commit 9bb95c5

Please sign in to comment.