Skip to content

🚨

🚨 #124

---
name: 🚨
on: # yamllint disable-line rule:truthy
push:
branches-ignore:
# NOTE: bot-managed branches don't need to be linted on
# NOTE: push: they always have PR builds
- dependabot/**
pull_request:
schedule:
- cron: 1 0 * * * # Run daily at 0:01 UTC
# Run every Friday at 18:02 UTC
# https://crontab.guru/#2_18_*_*_5
# - cron: 2 18 * * 5
jobs:
linters:
name: >-
${{ matrix.toxenv }}/${{ matrix.python-version }}@${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- 3.11
os:
- ubuntu-latest
toxenv:
- lint
- build-docs
- make-changelog
env:
PY_COLORS: 1
TOX_PARALLEL_NO_SPINNER: 1
TOXENV: ${{ matrix.toxenv }}
steps:
- uses: actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: >-
Calculate Python interpreter version hash value
for use in the cache key
id: calc-cache-key-py
run: |
from hashlib import sha512
from os import environ
from pathlib import Path
from sys import version
FILE_APPEND_MODE = 'a'
hash = sha512(version.encode()).hexdigest()
with Path(environ['GITHUB_OUTPUT']).open(
mode=FILE_APPEND_MODE,
) as outputs_file:
print(f'py-hash-key={hash}', file=outputs_file)
shell: python
- name: Pre-commit cache
uses: actions/[email protected]
with:
path: ~/.cache/pre-commit
key: >-
${{ runner.os }}-pre-commit-${{
steps.calc-cache-key-py.outputs.py-hash-key }}-${{
hashFiles('setup.cfg') }}-${{ hashFiles('tox.ini') }}-${{
hashFiles('pyproject.toml') }}-${{
hashFiles('.pre-commit-config.yaml') }}-${{
hashFiles('pytest.ini') }}
- name: Pip cache
uses: actions/[email protected]
with:
path: ~/.cache/pip
key: >-
${{ runner.os }}-pip-${{
steps.calc-cache-key-py.outputs.py-hash-key }}-${{
hashFiles('setup.cfg') }}-${{ hashFiles('tox.ini') }}-${{
hashFiles('pyproject.toml') }}-${{
hashFiles('.pre-commit-config.yaml') }}-${{
hashFiles('pytest.ini') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install tox
run: |
python -m pip install --upgrade tox
- name: Log installed dists
run: python -m pip freeze --all
- name: Initialize tox envs
run: |
python -m tox --parallel auto --parallel-live --notest
- name: Initialize pre-commit envs if needed
run: >-
test -d .tox/lint
&& .tox/lint/bin/python -m pre_commit install-hooks
|| :
- name: Test with tox
run: python -m tox --parallel auto --parallel-live
...