-
-
Notifications
You must be signed in to change notification settings - Fork 3
173 lines (163 loc) · 5.3 KB
/
check.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
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
steps:
- name: Re-enable workflow
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api -X PUT repos/${{ github.repository }}/actions/workflows/check.yaml/enable