-
Notifications
You must be signed in to change notification settings - Fork 4
243 lines (234 loc) · 7.47 KB
/
check.yml
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
name: Check
on: [ push, pull_request ]
env:
PIP_DISABLE_PIP_VERSION_CHECK: yes
jobs:
fix_stupid_mistakes:
name: Fix stupid mistakes
runs-on: ubuntu-24.04
if: github.ref_type == 'branch'
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
token: ${{ secrets.GH_PUSH_TOKEN }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
cache-dependency-path: Pipfile.lock
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ~2.1
- name: Install required stuff
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev
pip install -r pip-requirements.txt
pip install -c pip-constraints.txt autoflake black isort
- name: Run autoflake
run: autoflake --recursive --in-place --remove-all-unused-imports --remove-unused-variables --remove-duplicate-keys .
- name: Run isort
run: isort .
- name: Run Black
run: black .
- name: Install dprint
run: curl -sSf https://dprint.dev/install.sh | sh -s 0.48.0
- name: Run dprint
run: ~/.dprint/bin/dprint fmt --diff
- name: Install dart-sass
uses: ./.github/actions/install_dart_sass
- name: Generate snow
run: sass -s compressed --random-seed 0 style/snow.scss style/snow.css
- name: Build JS & CSS
run: deno task clean && deno task build
- name: Generate humans.txt
run: ./scripts/humans.py
- name: Sort methods
run: ./scripts/sort_python_code.py
- name: Generate config.ini.default
run: python3 -m an_website --save-config-to example-configurations/config.ini.default -c
- name: Update env
run: |
D=$(python -c "print((_:=__import__('datetime')).datetime.now(tz=_.timezone.utc).replace(minute=0, second=0, microsecond=0).isoformat())")
echo "GIT_AUTHOR_DATE=${D}" >> "${GITHUB_ENV}"
echo "GIT_COMMITTER_DATE=${D}" >> "${GITHUB_ENV}"
- name: Push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_author: Bot <>
commit_message: "🤦"
commit_user_name: Bot
commit_user_email:
mypy:
name: mypy
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
cache-dependency-path: Pipfile.lock
- name: Cache
uses: pat-s/always-upload-cache@v3
with:
path: .mypy_cache
key: mypy-${{ github.repository }}-${{ github.ref }}-${{ github.sha }}
restore-keys: mypy-${{ github.repository }}-${{ github.ref }}-
- name: Install libcurl4-openssl-dev for compiling PycURL
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev
- name: Install requirements
run: pip install -r pip-requirements.txt
- name: Install mypy + stuff required for checking the tests and setup.py
run: |
pip install -c pip-constraints.txt dulwich html5lib mypy numpy pytest pytest-is-running time-machine trove-classifiers
grep "^types-" pip-constraints.txt | xargs pip install
- name: Run mypy
run: mypy
flake8:
name: Flake8
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
cache-dependency-path: Pipfile.lock
- name: Install Flake8
run: grep "^flake8-" pip-constraints.txt | xargs pip install -c pip-constraints.txt flake8 pep8-naming
- name: Run Flake8
run: flake8 --extend-ignore=SIM9
pylint:
name: Pylint
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
cache-dependency-path: Pipfile.lock
- name: Cache
uses: pat-s/always-upload-cache@v3
with:
path: ~/.cache/pylint
key: pylint-${{ github.repository }}-${{ github.ref }}-${{ github.sha }}
restore-keys: pylint-${{ github.repository }}-${{ github.ref }}-
- name: Install libcurl4-openssl-dev for compiling PycURL
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev
- name: Install requirements
run: pip install -r pip-requirements.txt
- name: Install Pylint + stuff required for checking the tests and setup.py
run: pip install -c pip-constraints.txt html5lib pylint pylint-pytest pytest setuptools time-machine trove-classifiers zopflipy zstd
- name: Run Pylint
run: pylint -r y -d fixme .
env:
DISABLE_PYSTON: 1
bandit:
name: Bandit
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
cache-dependency-path: Pipfile.lock
- name: Install Bandit
run: pip install -c pip-constraints.txt bandit[toml]
- name: Run Bandit
run: bandit -rc pyproject.toml .
eslint:
name: ESLint
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18.20"
cache: pnpm
- name: Enable corepack
run: corepack enable
- name: Cache
uses: pat-s/always-upload-cache@v3
with:
path: .eslintcache
key: eslint-${{ github.repository }}-${{ github.ref }}-${{ github.sha }}
restore-keys: eslint-${{ github.repository }}-${{ github.ref }}-
- name: Install ESLint
run: pnpm install
- name: Run ESLint
run: pnpm eslint --cache .
tsc:
name: tsc
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18.20"
cache: pnpm
- name: Enable corepack
run: corepack enable
- name: Install tsc
run: pnpm install
- name: Run tsc
run: |
pnpm tsc
pnpm tsc -p an_website
shellcheck:
name: ShellCheck
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/[email protected]
env:
SHELLCHECK_OPTS: -x -o all
with:
version: v0.10.0
check_together: yes
ignore_names: screenfetch