workflows: format & lint with fewer python versions #7
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Test esdl4tulipa | |
on: | |
push: | |
branches: [ "main" ] | |
paths-ignore: | |
- "docs/**" | |
- "*.md" | |
pull_request: | |
branches: [ "main" ] | |
paths-ignore: | |
- "docs/**" | |
- "*.md" | |
jobs: | |
format: | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.13"] | |
# test with minimum & prerelease | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
allow-prereleases: true | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install black toml | |
- name: Format source w/ black | |
# fail when file(s) would be formatted | |
run: black --check src tests | |
lint: | |
strategy: | |
matrix: | |
python-version: ["py310", "py312"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Ruff with Python target version ${{ matrix.python-version }} | |
uses: chartboost/ruff-action@v1 | |
with: | |
src: './src' | |
args: "check --target-version ${{ matrix.python-version }}" | |
test: | |
needs: [format, lint] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] | |
python-version: ["3.10", "3.11", "3.12"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install .[dev] | |
- name: Test with pytest | |
run: | | |
pytest | |
type-check: | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
allow-prereleases: true | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install mypy{,_extensions} | |
- name: Type check w/ mypy | |
run: mypy --install-types --non-interactive --pretty |