Skip to content

Commit 5706243

Browse files
Added python CI checks
1 parent 6531085 commit 5706243

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

.github/workflows/ci-checks.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Check Python
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
paths:
9+
- '**'
10+
workflow_dispatch:
11+
merge_group:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
# Principle of least privilege
18+
permissions:
19+
contents: read
20+
pull-requests: read
21+
22+
jobs:
23+
ci-checks:
24+
name: "Python CI Checks"
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
# --- Python toolchain (uv) ---
30+
- name: Setup uv
31+
uses: astral-sh/setup-uv@v6
32+
with:
33+
enable-cache: true
34+
35+
- name: Sync dependencies and check uv lockfile is up to date
36+
run: uv sync --all-groups --all-extras --locked
37+
38+
# --- Quality: lint, format, type-checking, unused deps ---
39+
- name: Ruff format
40+
run: uv run ruff format --check --diff
41+
42+
- name: Ruff check
43+
run: uv run ruff check --diff
44+
45+
- name: Type checking (Pyrefly)
46+
run: uv run pyrefly check
47+
48+
- name: Type checking (Ty)
49+
run: uv run ty check
50+
continue-on-error: true
51+
52+
- name: Unused dependencies (Deptry)
53+
run: uv run deptry .
54+
55+
# --- Tests ---
56+
- name: Unit tests (PyTest)
57+
run: |
58+
uv run pytest -v --tb=short -n auto

tests/test_example_package.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import importlib.util
2+
3+
import pytest
4+
5+
6+
def test_import() -> None:
7+
if importlib.util.find_spec("example_package") is None:
8+
pytest.fail("Failed to find example_package module")

0 commit comments

Comments
 (0)