forked from crowdsecurity/hub
-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (49 loc) · 1.45 KB
/
Copy pathlint-python.yaml
File metadata and controls
58 lines (49 loc) · 1.45 KB
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
name: Lint Python
on:
push:
branches: [ master ]
paths:
- '.github/workflows/lint-python.yaml'
- 'pyproject.toml'
- 'uv.lock'
- 'src/cshub/**'
pull_request:
branches: [ master ]
paths:
- '.github/workflows/lint-python.yaml'
- 'pyproject.toml'
- 'uv.lock'
- 'src/cshub/**'
permissions:
contents: read
jobs:
tests:
name: ruff + basedpyright
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
with:
version: 0.9.5
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: "Set up Python"
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version-file: ".python-version"
- name: Install the project
run: uv sync --all-extras --dev
- name: Lint
run: |
uv run ruff check || ruff_status=$? || ruff_status=0
uv run basedpyright || pyright_status=$? || pyright_status=0
if [ "${ruff_status:-0}" -ne 0 ] || [ "${pyright_status:-0}" -ne 0 ]; then
echo "❌ Linting failed:"
echo " Ruff exit code: ${ruff_status:-0}"
echo " BasedPyright exit code: ${pyright_status:-0}"
exit 1
fi