-
Notifications
You must be signed in to change notification settings - Fork 61
68 lines (56 loc) · 1.7 KB
/
check-sources.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
name: Static Checks
on:
push:
branches:
- main
pull_request:
concurrency:
group: check-${{github.ref}}
cancel-in-progress: true
jobs:
pre-commit:
name: Check pre-commit hooks
runs-on: ubuntu-latest
steps:
- name: 📥 Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📦 Install pre-commit
run: pipx install pre-commit
- name: 🪝 Install pre-commit hooks
run: pre-commit install-hooks
# switch git branches so we don't trip the branch pre-commit check
- name: Switch branches
run: git checkout -b check-source HEAD
- name: ✅ Check that pre-commit is clean
run: |
if pre-commit run --all-files; then
echo "::debug title=pre-commit::pre-commit checks passed"
else
git diff
git status -s |sed -Ee 's/^...(.*)/::error file=\1,title=pre-commit::pre-commit would modify this file/'
exit 1
fi
lint:
name: Annotate with lint failures
runs-on: ubuntu-latest
steps:
- name: 📥 Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🐍 Set up Python
id: python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: 🛠️ Install development tools and dependencies
run: |
$PYTHON -m pip install -U uv
uv pip install --python $PYTHON -r requirements-dev.txt
env:
PYTHON: ${{steps.python.outputs.python-path}}
- name: 🐜 Check source code lint rules
id: lint
run: ruff check --output-format=github