mypy fixes again #309
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
# SPDX-FileCopyrightText: 2021 - 2023 Constantine Evans <qslib@mb.costi.net> | |
# | |
# SPDX-License-Identifier: EUPL-1.2 | |
name: Python tests | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- CHANGELOG.md | |
- README.md | |
- AUTHORS.md | |
pull_request: | |
branches: | |
- main | |
jobs: | |
black: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: psf/black@stable | |
with: | |
options: "--check --verbose --diff" | |
src: "./src" | |
mypy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools_scm[toml] wheel setuptools | |
python -m pip install --upgrade attrs types-attrs | |
python -m pip install flake8 tox mypy | |
- name: Mypy | |
run: | | |
mypy --cache-dir .mypy_cache --install-types --non-interactive ./src | |
tests: | |
runs-on: ${{ matrix.os }} | |
needs: "mypy" | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ["3.9", "3.10", "3.11"] # , "3.12.0-beta.4"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools_scm[toml] wheel setuptools | |
python -m pip install flake8 tox mypy | |
- name: Test with tox/pytest | |
run: | | |
tox -- -k 'not test_real' | |
- name: "Upload coverage to Codecov" | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: false | |
direct_tests: | |
runs-on: "self-hosted" | |
needs: "tests" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
~/qpcr-sim/actions-runner/runner-venv/bin/python -m pip install -U pip setuptools_scm[toml] wheel setuptools | |
~/qpcr-sim/actions-runner/runner-venv/bin/python -m pip install -U flake8 mypy pytest pytest-cov pytest-asyncio hypothesis | |
~/qpcr-sim/actions-runner/runner-venv/bin/python -m pip install -U .[monitor] --no-build-isolation | |
- name: Setup environment | |
run: | | |
start_realtest_environment | |
- name: Test with tox/pytest | |
run: | | |
~/qpcr-sim/actions-runner/runner-venv/bin/python -m pytest -k 'test_real' --cov --cov-report=xml | |
- name: Stop environment | |
run: | | |
stop_realtest_environment | |
- name: "Upload coverage to Codecov" | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: false | |
token: ${{ secrets.CODECOV_TOKEN }} |