Check #190
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: | |
workflow_dispatch: | |
schedule: | |
# Re-test every month | |
- cron: '0 2 1 * *' | |
env: | |
# more verbosity to make it easier to understand failures | |
PYTEST_FLAGS: -v --log-level=DEBUG | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: Persistent Github pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'setup.cfg', 'setup.py', 'Makefile') }} | |
restore-keys: | | |
pip-${{ runner.os }}-${{ matrix.python-version }}- | |
pip-${{ runner.os }}- | |
- name: Persistent Github venv cache | |
uses: actions/cache@v4 | |
with: | |
path: .venv/ | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'setup.cfg', 'setup.py', 'Makefile') }} | |
- name: Install dependencies | |
run: make venv | |
- name: flake8 | |
uses: liskin/gh-problem-matcher-wrap@v3 | |
with: | |
linters: flake8 | |
run: make lint-flake8 | |
- name: mypy | |
uses: liskin/gh-problem-matcher-wrap@v3 | |
with: | |
linters: mypy | |
run: make lint-mypy | |
- name: isort | |
uses: liskin/gh-problem-matcher-wrap@v3 | |
with: | |
linters: isort | |
run: make lint-isort | |
- name: pytest | |
uses: liskin/gh-problem-matcher-wrap@v3 | |
with: | |
linters: pytest | |
run: make test-pytest | |
- name: prysk, readme | |
run: make test-prysk readme | |
- name: check-wheel | |
run: make check-wheel | |
check-distro: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
image: | |
- 'debian:unstable' | |
- 'debian:testing' | |
- 'debian:stable' | |
- 'debian:oldstable' | |
- 'ubuntu:devel' | |
- 'ubuntu:rolling' | |
- 'ubuntu:latest' | |
container: ${{ matrix.image }} | |
steps: | |
- name: Install prerequisites via apt | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
set -ex | |
apt update | |
apt install -y git | |
- uses: actions/checkout@v4 | |
- name: Install dependencies via apt | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
set -ex | |
deps=$(sed -n '/^\[tool.gha-check-distro\]/,/^\[/p' pyproject.toml \ | |
| tr '\n' ' ' \ | |
| grep -o -P '\sdependencies-apt\s*=\s*\K\[.*?\]' \ | |
| grep -o -P '".*?"' \ | |
| tr -d '"') | |
apt-cache --generate pkgnames \ | |
| grep --line-regexp --fixed-strings "$deps" \ | |
| xargs apt install -y | |
- name: Workaround for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1057968 | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
shell: bash | |
run: | | |
set -ex | |
grep " noble " /etc/apt/sources.list || exit 0 | |
apt install -y debian-archive-keyring | |
ln -s /usr/share/keyrings/debian-archive-keyring.gpg /etc/apt/trusted.gpg.d/ | |
python3_pycodestyle=$(dpkg-query --showformat='${Version}\n' --show python3-pycodestyle) | |
python3_flake8=$(dpkg-query --showformat='${Version}\n' --show python3-flake8) | |
if [[ $python3_pycodestyle == 2.11.* && $python3_flake8 == 5.* ]]; then | |
echo 'deb https://deb.debian.org/debian unstable main' >/etc/apt/sources.list.d/debian-unstable.list | |
echo 'APT::Default-Release "noble";' >/etc/apt/apt.conf.d/debian-release | |
apt update | |
apt install -t unstable -y python3-flake8 | |
fi | |
- name: Workaround for https://github.com/actions/checkout/pull/762 not persisting | |
run: git config --global --add safe.directory "$PWD" | |
- name: Install remaining dependencies | |
run: make venv-system-site-packages | |
- name: flake8 | |
uses: liskin/gh-problem-matcher-wrap@v3 | |
with: | |
linters: flake8 | |
run: make lint-flake8 | |
- name: mypy | |
uses: liskin/gh-problem-matcher-wrap@v3 | |
with: | |
linters: mypy | |
run: make lint-mypy | |
- name: isort | |
uses: liskin/gh-problem-matcher-wrap@v3 | |
with: | |
linters: isort | |
run: make lint-isort | |
- name: pytest | |
uses: liskin/gh-problem-matcher-wrap@v3 | |
with: | |
linters: pytest | |
run: make test-pytest | |
- name: prysk, readme | |
run: make readme | |
- name: check-wheel | |
run: make check-wheel | |
workflow-keepalive: | |
if: github.event_name == 'schedule' | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
steps: | |
- uses: liskin/gh-workflow-keepalive@v1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |