Merge pull request #48 from felixriese/fix-rtd-docs2 #82
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 and Linting | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: "*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Python versions need to be strings (otherwise: 3.10 -> 3.1) | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r test-requirements.txt | |
pip install -r requirements.txt | |
pip install . | |
- name: List of installed packages | |
run: | | |
pip list | |
- name: Lint with flake8 (with stopping) | |
if: ${{ matrix.python-version == '3.12' }} | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
- name: Lint with flake8 (without stopping) | |
if: ${{ matrix.python-version == '3.12' }} | |
run: | | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Check formatting (black, isort) | |
if: ${{ matrix.python-version == '3.12' }} | |
run: | | |
black --check . | |
isort --check . | |
- name: Test with pytest | |
if: ${{ matrix.python-version != '3.12' }} | |
run: | | |
pytest --nbval | |
- name: Test with pytest and Codecov | |
if: ${{ matrix.python-version == '3.12' }} | |
run: | | |
pip install pytest-cov | |
pytest --nbval --cov=susi --cov-report=xml --cov-config .coveragerc | |
- name: Upload coverage to Codecov | |
if: ${{ matrix.python-version == '3.12' }} | |
uses: codecov/codecov-action@v1 | |
with: | |
verbose: true |