chore(dev): switch formatting to ruff format
#631
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: check | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
venv | |
key: >- | |
lint-${{ hashFiles( | |
'.github/requirements.txt', | |
'requirements-dev.txt', | |
'requirements-test.txt', | |
'setup.cfg' | |
) }} | |
restore-keys: lint- | |
- name: Install dependencies | |
run: | | |
set -euxo pipefail | |
# venv due to mypy through pre-commit, venv-run | |
python3 -m venv venv | |
venv/bin/python3 -m pip install -Ur .github/requirements.txt | |
- run: venv/bin/gitlint --commits "origin/$GITHUB_BASE_REF..HEAD" | |
if: github.event_name == 'pull_request' | |
- uses: pre-commit/action@v3.0.0 | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
python-version: | |
- "3.7" | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
- "3.13.0-alpha - 3.13" | |
- "pypy-3.9" | |
- "pypy-3.10" | |
include: | |
- python-version: "3.5" | |
os: ubuntu-20.04 | |
extra-deps: "'virtualenv<20.22.0'" | |
- python-version: "3.6" | |
os: ubuntu-20.04 | |
extra-deps: "'virtualenv<20.22.0'" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
# >= 3.11 to ensure there's a recent one to run nox with | |
# (assumption: last one listed ends up as "python3") | |
python-version: | | |
${{ matrix.python-version }} | |
>=3.11 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
.nox | |
key: >- | |
test-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles( | |
'requirements-test.txt' | |
) }} | |
restore-keys: test-${{ runner.os }}-${{ matrix.python-version }}- | |
- run: | | |
set -euxo pipefail | |
python3 -m pip install -U nox codecov ${{ matrix.extra-deps }} | |
v="${{ matrix.python-version }}" | |
v=${v##* } # "3.12.0-alpha - 3.12" -> "3.12" | |
v=${v//-} # "pypy-3.9" -> "pypy3.9" | |
nox --force-color --python $v | |
codecov -X gcov | |
env: | |
PYTEST_ADDOPTS: --color=yes |