Skip to content

Commit 90ebe20

Browse files
Mehdy ChaillouMehdy Chaillou
authored andcommitted
Add linting and type checking to CI workflow
1 parent 31d216f commit 90ebe20

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,36 @@ on:
1111
workflow_dispatch:
1212

1313
jobs:
14+
lint:
15+
name: Lint & Type Check
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.11'
26+
27+
- name: Install lint dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install ruff pyright
31+
pip install -r python/requirements.txt
32+
33+
- name: Run ruff linter
34+
working-directory: python
35+
run: ruff check .
36+
37+
- name: Run pyright type checker
38+
working-directory: python
39+
run: pyright
40+
1441
build-python-windows:
1542
name: Build Python (Windows)
43+
needs: [lint]
1644
runs-on: windows-latest
1745

1846
steps:
@@ -46,6 +74,7 @@ jobs:
4674

4775
build-python-linux:
4876
name: Build Python (Linux)
77+
needs: [lint]
4978
runs-on: ubuntu-latest
5079

5180
steps:
@@ -84,6 +113,7 @@ jobs:
84113

85114
build-csharp:
86115
name: Build C# (Windows)
116+
needs: [lint]
87117
runs-on: windows-latest
88118

89119
steps:
@@ -102,7 +132,7 @@ jobs:
102132

103133
- name: Build solution
104134
working-directory: csharp
105-
run: msbuild StarCitizenPlaytimeCalculator.sln /p:Configuration=Release /p:Platform="Any CPU"
135+
run: msbuild StarCitizenPlaytimeCalculator.sln /p:Configuration=Release /p:Platform="Any CPU" /p:TreatWarningsAsErrors=true /p:RunAnalyzersDuringBuild=true
106136

107137
- name: Upload C# artifact
108138
uses: actions/upload-artifact@v4

python/pyproject.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[tool.ruff]
2+
line-length = 120
3+
target-version = "py311"
4+
5+
[tool.ruff.lint]
6+
select = [
7+
"E", # pycodestyle errors
8+
"F", # pyflakes
9+
"W", # pycodestyle warnings
10+
"B", # flake8-bugbear
11+
"I", # isort
12+
]
13+
ignore = [
14+
"E501", # line too long (handled by formatter)
15+
]
16+
17+
[tool.pyright]
18+
pythonVersion = "3.11"
19+
typeCheckingMode = "basic"
20+
reportMissingImports = true
21+
reportMissingTypeStubs = false
22+
reportUnusedImport = true
23+
reportUnusedVariable = true
24+
reportAttributeAccessIssue = true

0 commit comments

Comments
 (0)