Merge pull request #278 from HLasse/dependabot/pip/black-23.9.1 #398
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: Tests | |
on: | |
push: | |
branches: [main, dev] | |
pull_request: | |
branches: [main, dev] | |
jobs: | |
pytest-and-notebooks: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.9", "3.8"] | |
# This allows a subsequently queued workflow run to interrupt previous runs | |
concurrency: | |
group: "${{ github.workflow }} - ${{ matrix.python-version}} - ${{ matrix.os }} @ ${{ github.ref }}" | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: "**/pyproject.toml" | |
- name: Install dependencies | |
shell: bash | |
run: | | |
python -m pip install --upgrade pip | |
# Assumes the package have the tests extra | |
pip install ".[tests]" | |
# if there is a ./tests/requirements.txt file then install it | |
if [ -f ./tests/requirements.txt ]; then | |
pip install -r ./tests/requirements.txt | |
fi | |
- name: Run and write pytest | |
shell: bash | |
run: | | |
set -o pipefail | |
pytest --cov=textdescriptives --cov-report term-missing | tee pytest-coverage.txt | |
- name: Install dependencies for notebooks | |
shell: bash | |
run: | | |
# Assumes the package have the tutorials extra | |
pip install ".[tutorials]" | |
# if there is a tutorials requirements.txt file then install it | |
if [ -f ./tests/requirements.txt ]; then | |
pip install -r ./docs/tutorials/requirements.txt | |
fi | |
- name: Convert and run notebooks | |
shell: bash | |
run: | | |
jupyter nbconvert --to python ./docs/tutorials/*.ipynb | |
for f in docs/tutorials/*.py; do ipython "$f"; done | |
- name: Check the output coverage | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' }} | |
shell: bash | |
run: | | |
echo "Coverage Report - ${{ steps.coverage-comment.outputs.coverage }}" | |
echo "Coverage Color - ${{ steps.coverage-comment.outputs.color }}" | |