-
Notifications
You must be signed in to change notification settings - Fork 7
103 lines (84 loc) · 3.14 KB
/
ci.yml
File metadata and controls
103 lines (84 loc) · 3.14 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [develop, main]
# Concurrency controls restored.
# Crucial for preventing cost blowouts when developers push multiple commits rapidly.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# NEW JOB: Code Quality Enforcement
code-quality:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install dependencies with dev extras
run: uv sync --extra dev --extra cpu --locked
- name: Check formatting with Black
run: uv run black --check --diff .
# - name: Check import sorting with isort
# run: uv run --with isort isort --check-only --diff .
- name: Lint with flake8
run: |
uv run flake8 \
--max-line-length=88 \
--extend-ignore=E203,E501,W503,E402,F401,F403,F841,B006,B007,B008,B009,C416,E262 \
anomavision/ anodet/ apps/ tests/
tests:
name: Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
# Run tests only after code quality passes
needs: code-quality
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
fail-fast: false # Prevents the entire matrix from dying if one python version fails
steps:
- uses: actions/checkout@v4
# UV's official action natively handles downloading Python, installing uv,
# and caching the environment based on your uv.lock file.
- name: Install uv and Set up Python
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies (CPU)
# --locked is MANDATORY. This instantly fails the build if the lockfile drifted,
# preventing transient dependencies from sneaking into production.
run: uv sync --extra cpu --locked
- name: Run tests
run: uv run pytest -v
cuda-matrix-check:
name: Verify CUDA Resolvers
runs-on: ubuntu-latest
# Run CUDA checks only after code quality passes
needs: code-quality
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.11"
enable-cache: false # Caching isn't needed since we're only doing dry-runs
# Architect Note: We use --dry-run here. We only want to verify that the
# hardware routing matrix in pyproject.toml correctly resolves all dependencies
# without dependency conflicts. We DO NOT want to physically download 8GB of wheels.
- name: Verify cu118 resolution
run: uv sync --extra cu118 --locked --dry-run
- name: Verify cu121 resolution
run: uv sync --extra cu121 --locked --dry-run
- name: Verify cu124 resolution
run: uv sync --extra cu124 --locked --dry-run