notebooks-mocpy #148
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: notebooks-mocpy | |
on: workflow_dispatch | |
jobs: | |
# Run the notebooks. This add more examples to test the code with. | |
# This workflow should not block the deployment pipeline. | |
run-notebooks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout branch ${{ github.head_ref }}" | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: "Set up Python 3.12 on Ubuntu" | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
- name: "Run notebooks" | |
run: | | |
# Install virtualenv | |
pip install virtualenv | |
# Create and activate a new virtualenv | |
virtualenv mocpy-env | |
source mocpy-env/bin/activate | |
# Install pytest and nbmake | |
pip install nbmake pytest-xdist | |
# Install maturin | |
pip install maturin | |
# Build and install mocpy | |
maturin develop --release | |
# Install pytest-cov, needed to test with coverage | |
pip install .[notebooks] | |
# Add the mocpy-env environnement as a jupyter kernel | |
python -m ipykernel install --user --name mocpy-env | |
# Run the notebooks under that kernel | |
pytest --nbmake -n=auto "./notebooks" | |
# Switch off the virtualenv | |
deactivate | |