Skip to content

Run code quality steps regardless of the results of previous steps #69

Run code quality steps regardless of the results of previous steps

Run code quality steps regardless of the results of previous steps #69

Workflow file for this run

name: Tests
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
code-quality:
name: Code Quality
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install Poetry
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: poetry
- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: poetry install
- name: Run linter
run: poetry run ruff check . --output-format github
- name: Run formatter
if: ${{ success() || failure() }}
run: poetry run ruff format --check .
- name: Run mypy for Python 3.8
if: ${{ success() || failure() }}
run: |
poetry run mypy . --python-version 3.8 --platform linux
poetry run mypy . --python-version 3.8 --platform darwin
poetry run mypy . --python-version 3.8 --platform win32
- name: Run mypy for Python 3.9
if: ${{ success() || failure() }}
run: |
poetry run mypy . --python-version 3.9 --platform linux
poetry run mypy . --python-version 3.9 --platform darwin
poetry run mypy . --python-version 3.9 --platform win32
- name: Run mypy for Python 3.10
if: ${{ success() || failure() }}
run: |
poetry run mypy . --python-version 3.10 --platform linux
poetry run mypy . --python-version 3.10 --platform darwin
poetry run mypy . --python-version 3.10 --platform win32
- name: Run mypy for Python 3.11
if: ${{ success() || failure() }}
run: |
poetry run mypy . --python-version 3.11 --platform linux
poetry run mypy . --python-version 3.11 --platform darwin
poetry run mypy . --python-version 3.11 --platform win32
- name: Run mypy for Python 3.12
if: ${{ success() || failure() }}
run: |
poetry run mypy . --python-version 3.12 --platform linux
poetry run mypy . --python-version 3.12 --platform darwin
poetry run mypy . --python-version 3.12 --platform win32
tests:
strategy:
matrix:
os: ['macOS', 'Ubuntu', 'Windows']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
include:
- os: macOS
image: macos-latest
- os: Ubuntu
image: ubuntu-latest
- os: Windows
image: windows-latest
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.image }}
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install Poetry
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Update PATH
if: ${{ matrix.os != 'Windows' }}
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Update PATH (Windows)
if: ${{ matrix.os == 'Windows' }}
run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH
- name: Install dependencies
run: poetry install
- name: Install pytest annotation plugin
run: poetry run pip install pytest-github-actions-annotate-failures
- name: Run tests with coverage
if: ${{ matrix.os != 'Ubuntu' }}
run: poetry run pytest --cov
- name: Run tests with coverage (Ubuntu)
if: ${{ matrix.os == 'Ubuntu' }}
run: sudo -E env "PATH=$PATH" poetry run pytest --cov
- name: Upload coverage data to Coveralls
run: poetry run coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}