From 6b80fe1383a11b8522a3456f86cfbef2d8e9d827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Sun, 18 Feb 2024 10:17:46 -0500 Subject: [PATCH] ENH: Add notebook run GitHub Actions workflow file Add notebook run GitHub Actions workflow file. Left behind by the Carpentries Workbench infrastructure automated transition tool in commits 68f7777, 977f605 and c64f03a. --- .github/workflows/build_and_run_notebooks.yml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/build_and_run_notebooks.yml diff --git a/.github/workflows/build_and_run_notebooks.yml b/.github/workflows/build_and_run_notebooks.yml new file mode 100644 index 00000000..590597e6 --- /dev/null +++ b/.github/workflows/build_and_run_notebooks.yml @@ -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