-
Notifications
You must be signed in to change notification settings - Fork 21
93 lines (79 loc) · 2.67 KB
/
main.yaml
File metadata and controls
93 lines (79 loc) · 2.67 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
name: CI
on:
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Install uv (fast Python + package manager) and enable caching
- name: Setup uv
uses: astral-sh/setup-uv@v3
# Cache uv tool + resolver cache (speeds up uvx + resolves)
- name: Cache uv caches
uses: actions/cache@v4
with:
path: |
~/.cache/uv
key: uv-cache-${{ runner.os }}-${{ hashFiles('pyproject.toml', 'uv.lock') }}
# Style checks via uvx (no env creation needed, blazing fast)
- name: black (s2and/)
run: uvx --from black==24.8.0 black s2and --check --line-length 120
- name: black (scripts/*.py)
shell: bash
run: |
shopt -s nullglob
files=(scripts/*.py)
if (( ${#files[@]} )); then
uvx --from black==24.8.0 black "${files[@]}" --check --line-length 120
fi
typecheck-and-test:
runs-on: ubuntu-latest
needs: [lint]
steps:
- uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v3
# Optional: ensure a specific Python (uv can also manage this on its own)
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
# Cache uv resolver + wheels + project venv
- name: Cache uv + venv
uses: actions/cache@v4
with:
path: |
~/.cache/uv
.venv
key: uv-venv-${{ runner.os }}-py311-${{ hashFiles('pyproject.toml', 'uv.lock') }}
restore-keys: |
uv-venv-${{ runner.os }}-py311-
uv-venv-
# Sync environment from lock if present (fast; no network if cached)
- name: Sync deps (locked if available)
shell: bash
run: |
if [[ -f uv.lock ]]; then
uv sync --all-extras --dev --frozen
else
# No lock present; resolve once, then install
uv sync --all-extras --dev
fi
# Type checking (run mypy commands directly)
- name: mypy (s2and)
run: uv run mypy s2and --ignore-missing-imports
- name: mypy (scripts)
run: uv run mypy scripts/*.py --ignore-missing-imports
# Single pytest run with coverage (replaces the two docker pytest calls)
- name: pytest (coverage)
env:
# keep startup lean; avoid user-level plugins on hosted runners
PYTHONPATH: .
run: |
uv run pytest tests/ \
--cov=s2and --cov-report=term-missing --cov-fail-under=40