-
Notifications
You must be signed in to change notification settings - Fork 13
109 lines (92 loc) · 2.96 KB
/
ci.yml
File metadata and controls
109 lines (92 loc) · 2.96 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
104
105
106
107
108
109
name: Run CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
types: [ opened, synchronize, reopened, ready_for_review ]
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
env:
UV_PROJECT_ENVIRONMENT: .venv
steps:
# ---- Disk Cleanup (Safe) ----
- name: Free disk space
run: |
df -h
sudo rm -rf /usr/local/lib/android || true
sudo rm -rf /usr/share/dotnet || true
sudo rm -rf /opt/ghc || true
sudo rm -rf /usr/local/.ghcup || true
sudo apt-get clean
df -h
# ---- Checkout ----
- uses: actions/checkout@v6
# ---- Python setup ----
# Pin to an explicit patch version so cached venv is always valid
- uses: actions/setup-python@v6
id: setup-python
with:
python-version: "3.9.25"
# ---- Install uv ----
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
# ---- Cache uv global + python installs ----
- name: Cache uv global cache
uses: actions/cache@v5
with:
path: |
~/.cache/uv
~/.local/share/uv
key: uv-cache-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/uv.lock', '**/pyproject.toml') }}
restore-keys: |
uv-cache-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-
# ---- Cache project venv ----
- name: Cache project .venv
uses: actions/cache@v5
with:
path: .venv
key: uv-venv-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/uv.lock', '**/pyproject.toml') }}
restore-keys: |
uv-venv-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-
# ---- Environment Setup ----
# Important:
# make setup-dev MUST *not* delete .venv — otherwise the cache is pointless.
- name: Setup dev environment
run: make setup-dev
# ---- FORMAT ----
- name: Run formatter
run: make check-format
# ---- LINT ----
- name: Run linter
run: make check-lint
# ---- TEST ----
- name: Run tests
run: make test
# ---- DOCS ----
- name: Build docs
run: make docs
# ---- Upload docs artifact ----
- uses: actions/upload-pages-artifact@v4
with:
path: site
# ---- Deploy Docs ----
deploy_docs:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4