Skip to content

style: make mypy check strict #342

style: make mypy check strict

style: make mypy check strict #342

Workflow file for this run

name: Tests
on:
push:
branches:
- "master"
- "devel"
- "main"
paths:
- "**.py"
- "**.yaml"
- "**.yml"
- "**.toml"
- "**/data/**"
- ".github/constraints.txt"
pull_request:
branches:
- "master"
- "devel"
- "main"
paths:
- "**.py"
- "**.yaml"
- "**.yml"
- "**.toml"
concurrency:
group: ci-tests-${{ github.ref }}-1
cancel-in-progress: true
env:
DEFAULT_PYTHON: "3.12"
jobs:
lint:
runs-on: ubuntu-latest
if: |
!contains(github.event.head_commit.message, '[skip_ci]')
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Use frozen pip version
run: |
pip install --constraint=.github/constraints.txt pip
pip --version
- name: Install Nox
run: |
pip install --constraint=.github/constraints.txt nox
nox --version
- name: Load poetry cache
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: |
.cache/pypoetry
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
run: |
pip install --constraint=.github/constraints.txt poetry
poetry --version
poetry config --local cache-dir .cache/pypoetry
poetry config --local virtualenvs.create false
- name: Run pre commit checks
run: |
nox --force-color --session=pre-commit
- name: Run mypy static type checks
run: |
nox --force-color --session=mypy
docs:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Use frozen pip version
run: |
pip install --constraint=.github/constraints.txt pip
pip --version
- name: Install Nox
run: |
pip install --constraint=.github/constraints.txt nox
nox --version
- name: Load poetry cache
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: |
.cache/pypoetry
key: poetry-${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
run: |
pip install --constraint=.github/constraints.txt poetry
poetry --version
poetry config --local cache-dir .cache/pypoetry
poetry config --local virtualenvs.create false
poetry env info
- name: Build documentation
run: |
nox --force-color --session=docs-build
tests:
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }}"
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
python-version: [ '3.10', '3.11', '3.12' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Use frozen pip version
run: |
pip install --constraint=.github/constraints.txt pip virtualenv
pip --version
- name: Install nox
run: |
pip install --constraint=.github/constraints.txt nox
nox --version
- name: Load poetry cache
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: |
.cache/pypoetry
key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
run: |
pip install --constraint=.github/constraints.txt poetry
poetry --version
poetry config --local cache-dir .cache/pypoetry
poetry config --local virtualenvs.create false
poetry env info
- name: Run nox tests
run: nox --force-color --session tests --python ${{ matrix.python-version }}
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ runner.os }}-${{ matrix.python-version }}
path: ".coverage.*"
include-hidden-files: true
if-no-files-found: error
coverage:
runs-on: ubuntu-latest
needs: tests
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Use frozen pip version
run: |
pip install --constraint=.github/constraints.txt pip
pip --version
- name: Load poetry cache
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: |
.cache/pypoetry
key: poetry-${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
run: |
pip install --constraint=.github/constraints.txt poetry
poetry --version
poetry config --local cache-dir .cache/pypoetry
poetry config --local virtualenvs.create false
poetry env info
- name: Install Nox
run: |
pip install --constraint=.github/constraints.txt nox
nox --version
- name: Download coverage data
uses: actions/download-artifact@v4
with:
pattern: coverage-data-*
merge-multiple: true
- name: Combine coverage data and display human readable report
run: |
nox --force-color --session=coverage
- name: Create coverage report
run: |
nox --force-color --session=coverage -- xml
- name: Upload coverage report
uses: codecov/codecov-action@v4