Merge pull request #41 from carpentries-incubator/CleanUpLesson #9
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: Test notebooks | |
on: | |
push: | |
paths: ["*.ipynb", "requirements.txt", "notebook.yml"] | |
jobs: | |
test-notebooks: | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.6, 3.7, 3.8] | |
steps: | |
- name: Checkout GitHub repository | |
uses: actions/checkout@v2 | |
# Run with multiple Python versions. | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Use a cache for the pip install to avoid reinstalling every time this is run. | |
- name: Cache pip install | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ env.pythonLocation }}- | |
# Install all requirements to run these tests. | |
- name: Install requirements | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pytest nbval | |
# Download the necessary data | |
- name: Download data | |
run: | | |
datalad install | |
# Run the actual tests of all the Python Notebooks. | |
- name: Test Notebooks | |
run: | | |
pytest --nbval-lax -v code/*ipynb |