Skip to content

Commit 06678b3

Browse files
Improve code quality workflow
1 parent b8c2c01 commit 06678b3

File tree

1 file changed

+53
-30
lines changed

1 file changed

+53
-30
lines changed

.github/workflows/code_quality.yml

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,71 @@ on:
66

77
jobs:
88
code-quality:
9-
name: Code Quality Checks
9+
name: Code Quality (Python ${{ matrix.python-version }})
1010
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
1115

1216
steps:
13-
# Step 1: Checkout the repository code
1417
- name: Checkout code
15-
uses: actions/checkout@v6
18+
uses: actions/checkout@v4
1619

17-
# Step 2: Install uv
18-
- name: Install uv
19-
run: |
20-
curl -Ls https://astral.sh/uv/install.sh | bash
21-
echo "${HOME}/.local/bin" >> $GITHUB_PATH
20+
- name: Set up uv
21+
uses: astral-sh/setup-uv@v3
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
enable-cache: true
2225

23-
# Step 3: Set up environment and install dependencies
2426
- name: Install dependencies
2527
run: |
26-
uv venv .venv
2728
uv sync --frozen --extra dev
2829
uv pip install -e .
2930
30-
# Step 4: Get changed Python files
31-
- name: Get Python changed files
32-
id: changed-py-files
33-
uses: tj-actions/changed-files@v47
31+
- name: Run tests with coverage
32+
run: |
33+
uv run pytest --cov=gsppy --cov-branch --cov-report=term-missing:skip-covered --cov-report=xml
34+
35+
- name: Run mypy
36+
run: uv run mypy .
37+
38+
- name: Run pyright
39+
run: uv run pyright
40+
41+
- name: Upload coverage report
42+
if: always()
43+
uses: actions/upload-artifact@v4
3444
with:
35-
files: |
36-
*.py
37-
**/*.py
45+
name: coverage-${{ matrix.python-version }}
46+
path: coverage.xml
47+
if-no-files-found: ignore
3848

39-
# Step 5: Run Ruff for only changed files
40-
- name: Run Ruff (Lint)
41-
if: steps.changed-py-files.outputs.any_changed == 'true'
42-
run: |
43-
echo "Running Ruff on changed files..."
44-
echo "Changed files: ${{ steps.changed-py-files.outputs.all_changed_files }}"
45-
uv run ruff check ${{ steps.changed-py-files.outputs.all_changed_files }}
49+
rust-backend:
50+
name: Rust Backend (Python 3.12)
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
56+
- name: Set up uv
57+
uses: astral-sh/setup-uv@v3
58+
with:
59+
python-version: "3.12"
60+
enable-cache: true
4661

47-
# Step 6: Run Pyright for only changed files
48-
- name: Run Pyright (Type Check)
49-
if: steps.changed-py-files.outputs.any_changed == 'true'
62+
- name: Install Rust toolchain
63+
uses: dtolnay/rust-toolchain@stable
64+
65+
- name: Install dependencies
5066
run: |
51-
echo "Running Pyright on changed files..."
52-
echo "Changed files: ${{ steps.changed-py-files.outputs.all_changed_files }}"
53-
uv run pyright ${{ steps.changed-py-files.outputs.all_changed_files }}
67+
uv sync --frozen --extra dev
68+
uv pip install -e .
69+
70+
- name: Build Rust extension
71+
run: make rust-build
72+
73+
- name: Run tests (Rust backend)
74+
env:
75+
GSPPY_BACKEND: rust
76+
run: uv run pytest

0 commit comments

Comments
 (0)