add nbmake and test for notebooks, test on multiple python versions #37
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: pytest | |
on: | |
push: | |
# Action will run when any changes to these paths are pushed or pr'ed to master | |
branches: [ main ] | |
paths: | |
- flowermd/** | |
- environment-dev.yml | |
- .github/workflows/pytest.yml | |
pull_request: | |
branches: [ main ] | |
paths: | |
- flowermd/** | |
- environment-dev.yml | |
- .github/workflows/pytest.yml | |
issue_comment: | |
types: [created] | |
workflow_dispatch: | |
jobs: | |
pytest: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macOS-latest, ubuntu-latest] | |
python-version: ['3.10', '3.11'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Build environment | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
environment-file: environment-dev.yml | |
python-version: ${{ matrix.python-version }} | |
miniforge-variant: Mambaforge | |
miniforge-version: 4.9.2-4 | |
use-mamba: true | |
- name: Install package | |
shell: bash -l {0} | |
run: pip install . | |
- name: Run pytest with coverage report | |
shell: bash -l {0} | |
run: python -m pytest -rs -v --cov=./ --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
test-tutorials: | |
if: contains(github.event.comment.body, '/testtutorials') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Build environment | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
environment-file: environment-dev.yml | |
miniforge-variant: Mambaforge | |
miniforge-version: 4.9.2-4 | |
use-mamba: true | |
- name: Install package | |
shell: bash -l {0} | |
run: pip install . | |
- name: Run pytest on tutorials | |
shell: bash -l {0} | |
run: python -m pytest -rs -v --nbmake tutorials/ |