-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from carpentries-incubator/AddNotebookRunWorkf…
…lowFile ENH: Add notebook run GitHub Actions workflow file
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Run-Notebooks | ||
|
||
# Workflow Details | ||
# Set up notebook | ||
|
||
on: | ||
push: | ||
branches: main | ||
paths: '*.ipynb' | ||
pull_request: | ||
branches: main | ||
paths: '*.ipynb' | ||
|
||
jobs: | ||
test-notebooks: | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
name: Checkout repo and download data | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.8', '3.9', '3.10', '3.11'] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Cache pip install | ||
uses: actions/cache@v4 | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} | ||
restore-keys: | | ||
${{ env.pythonLocation }}- | ||
- name: Install python environment | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install nbval pytest | ||
- name: Download data | ||
run: | | ||
./code/setup_test | ||
- name: Test notebooks | ||
run: | | ||
pytest --nbval-lax -v code/*solutions*.ipynb |