-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (40 loc) · 1.21 KB
/
Copy pathpython-code-inspection.yml
File metadata and controls
50 lines (40 loc) · 1.21 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
name: Python CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- '**/*.md'
- '**/*.txt'
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.11"
- name: Install linters
run: |
python -m pip install --upgrade pip
pip install ruff yamllint
- name: Lint Python files with ruff
run: |
ruff check . || true
- name: Validate YAML files
run: |
# Only lint YAML files we own to avoid noise from node_modules / third-party files
find docs .github -type f \( -name '*.yml' -o -name '*.yaml' \) -print0 | xargs -0 yamllint || true
- name: Validate JSON files
run: |
# Use Python's stdlib json module to validate JSON files and skip node_modules
find . -type f -name '*.json' -not -path './node_modules/*' -print0 \
| xargs -0 -I {} python -c "import sys,json; json.load(open(sys.argv[1]));" {} || true
- name: Python syntax check
run: |
python -m compileall -q .