diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index 9489bff9..9c8377ec 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -17,7 +17,15 @@ jobs: max-parallel: 12 matrix: os: [Ubuntu-20.04, macOS-latest] - python-version: [3.8, 3.9, "3.10"] + include: + - python-version: '3.8' + toxenv: py38-test-oldestdeps + + - python-version: '3.9' + toxenv: py39-test + + - python-version: '3.10' + toxenv: py310-test-devdeps steps: - uses: actions/checkout@v2 @@ -27,18 +35,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies - run: | - python -m pip install -r site/requirements.txt -r requirements.txt - python -m pip list + run: python -m pip install --upgrade tox - name: Test with nbval - run: | - python -m pip install pytest nbval - find content/ -name "*.md" -exec jupytext --to notebook {} \; - # TODO: find better way to exclude notebooks from test - rm content/tutorial-deep-reinforcement-learning-with-pong-from-pixels.ipynb - rm content/pairing.ipynb - rm content/tutorial-style-guide.ipynb - rm content/tutorial-nlp-from-scratch.ipynb - # Test notebook execution - pytest --nbval-lax --durations=10 content/ + run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }} diff --git a/.gitignore b/.gitignore index fe8151b1..a1654131 100644 --- a/.gitignore +++ b/.gitignore @@ -97,3 +97,6 @@ site/notebooks/* content/mooreslaw_regression* content/tutorial-x-ray-image-processing/xray_image.gif content/video +content/*ipynb +content/tutorial-nlp-from-scratch/parameters.npy +content/tutorial-nlp-from-scratch/*ipynb \ No newline at end of file diff --git a/ignore_testing b/ignore_testing new file mode 100644 index 00000000..a72bcd51 --- /dev/null +++ b/ignore_testing @@ -0,0 +1,4 @@ +content/tutorial-deep-reinforcement-learning-with-pong-from-pixels.md +content/pairing.md +content/tutorial-style-guide.md +content/tutorial-nlp-from-scratch.md diff --git a/test_requirements.txt b/test_requirements.txt new file mode 100644 index 00000000..d20d5b24 --- /dev/null +++ b/test_requirements.txt @@ -0,0 +1,2 @@ +pytest +nbval diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..71b8a547 --- /dev/null +++ b/tox.ini @@ -0,0 +1,40 @@ +[tox] +envlist = + py{38,39,310}-test{,-oldestdeps,-devdeps,-predeps}{,-buildhtml} +requires = + pip >= 19.3.1 + +[testenv] + +description = run tests + +deps = + # We use these files to specify all the dependencies, and below we override + # versions for specific testing schenarios + -rtest_requirements.txt + -rsite/requirements.txt + -rrequirements.txt + + # TODO: add the oldest supported versions of all the dependencies here + # oldestdeps: numpy==1.18 + # oldestdeps: matplotlib==3.1.2 + # oldestdeps: scipy==1.4 + +commands = + devdeps: pip install -U --pre --only-binary :all: -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy + devdeps: pip install -U --pre --only-binary :all: -i https://pypi.anaconda.org/scipy-wheels-nightly/simple scipy + devdeps: pip install -U --pre --only-binary :all: -i https://pypi.anaconda.org/scipy-wheels-nightly/simple matplotlib + + pip freeze + + # Ignore testing the tutorials listed in ignore_testing file + !buildhtml: bash -c 'find content -name "*.md" | grep -vf ignore_testing | xargs jupytext --to notebook ' + + !buildhtml: pytest --nbval-lax --durations=10 content/ + buildhtml: make -C site/ SPHINXOPTS="-nWT --keep-going" html + +pip_pre = + predeps: true + !predeps: false + +skip_install = true