Merge pull request #591 from realpython/python-variables-update #1620
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
# Check that code is formatted consistently | |
# | |
# Available Python versions: | |
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json | |
name: linters | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
tests: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {name: Linux312, python: '3.12.3', os: ubuntu-latest} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Restore cache | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: ./venv | |
key: ${{ matrix.name }}-v1-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ matrix.name }}-v1-pip- | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
python -m venv venv | |
. venv/bin/activate | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements.txt | |
- name: Check code style | |
run: | | |
. venv/bin/activate | |
python -m ruff check . | |
python -m black --check . | |
- name: Check directory layout | |
run: | | |
. venv/bin/activate | |
python .github/workflows/dircheck.py |