Skip to content

Commit 57868db

Browse files
committed
github: add Static Analysis workflow
1 parent 4923f0e commit 57868db

File tree

2 files changed

+64
-3
lines changed

2 files changed

+64
-3
lines changed

.github/workflows/static.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
on:
2+
push:
3+
paths:
4+
- "ignis/**"
5+
- ".github/workflows/static.yaml"
6+
pull_request:
7+
paths:
8+
- "ignis/**"
9+
- ".github/workflows/static.yaml"
10+
11+
name: Static Analysis
12+
jobs:
13+
mypy-check:
14+
name: Mypy
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.12"
22+
23+
- name: Install system dependencies
24+
run: |
25+
sudo apt update
26+
sudo apt install libcairo2-dev git
27+
28+
- name: Clone Ignis repository
29+
run: |
30+
git clone https://github.com/linkfrg/ignis.git src
31+
32+
- name: Install Python dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
cd src
36+
pip install --no-deps --config-settings=setup-args="-Dbuild_gvc=false" --config-settings=setup-args="-Ddependency_check=false" .
37+
pip install -r dev.txt
38+
grep -vE "PyGObject|setuptools" requirements.txt | pip install -r /dev/stdin
39+
cd ..
40+
41+
- name: Run mypy analysis
42+
run: |
43+
MYPYPATH=ignis mypy --explicit-package-bases ignis
44+
45+
ruff-check:
46+
name: Ruff
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
- name: Set up Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: "3.12"
54+
- name: Install Python dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install ruff
58+
59+
- name: Check code
60+
run: ruff check
61+
62+
- name: Check format
63+
run: ruff format --check

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
[tool.mypy]
22
python_version = "3.10"
3-
files = ["ignis", "/sda3/ignis/ignis"] # replace /sda3/ignis/ignis with the actual path to Ignis sources
43
exclude = ["venv"]
54
disable_error_code = [
65
"no-redef", # allow variable redefinition (needed for GObject.Property decorator)
76
"method-assign", # also needed for GObject.Property
87
"import-untyped"
98
]
10-
explicit_package_bases = true
11-
mypy_path = ["stubs", "ignis"]
9+
mypy_path = ["stubs"]
1210
check_untyped_defs = true
1311

1412
[[tool.mypy.overrides]]

0 commit comments

Comments
 (0)