This repository has been archived by the owner on Jan 20, 2024. It is now read-only.
✨ Python #3
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: "✨ Python" | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- "**.py" | |
- "requirements.txt" | |
- "dev-requirements.txt" | |
- ".github/workflows/python.yml" | |
push: | |
paths: | |
- "**.py" | |
permissions: | |
contents: read | |
pull-requests: read | |
jobs: | |
analyse-supported: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
supported-python-version: ["3.9", "3.10", "3.11", "3.12"] | |
best_effort-python-version: ["3.7"] | |
name: Testing on Python ${{ matrix.supported-python-version }} | |
continue-on-error: true | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.supported-python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.supported-python-version }} | |
allow-prereleases: true | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r dev-requirements.txt | |
- name: Lint check with Ruff | |
run: | | |
if [ ${{ matrix.supported-python-version }} == 3.7 ]; then | |
ruff check $(git ls-files '*.py') --target-version=py37 | |
fi | |
if [ ${{ matrix.supported-python-version }} == 3.8 ]; then | |
ruff check $(git ls-files '*.py') --target-version=py38 | |
fi | |
if [ ${{ matrix.supported-python-version }} == 3.9 ]; then | |
ruff check $(git ls-files '*.py') --target-version=py39 | |
fi | |
if [ ${{ matrix.supported-python-version }} == 3.10 ]; then | |
ruff check $(git ls-files '*.py') --target-version=py310 | |
fi | |
if [ ${{ matrix.supported-python-version }} == 3.11 ]; then | |
ruff check $(git ls-files '*.py') --target-version=py311 | |
fi | |
if [ ${{ matrix.supported-python-version }} == 3.12 ]; then | |
ruff check $(git ls-files '*.py') --target-version=py312 | |
fi | |
- name: Static analysis with MyPy | |
run: | | |
mypy $(git ls-files '*.py') --python-version ${{ matrix.supported-python-version }} | |
- name: Testing with Pytest | |
run: | | |
pytest | |
analyse-best_effort: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
base-python-version: ["3.11"] | |
best_effort-python-version: ["3.7"] | |
name: Static analysis on Python ${{ matrix.best_effort-python-version }} | |
continue-on-error: true | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.base-python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.base-python-version }} | |
allow-prereleases: true | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r dev-requirements.txt | |
- name: Static analysis with MyPy | |
run: | | |
mypy $(git ls-files '*.py') --python-version ${{ matrix.best_effort-python-version }} |