1+ name : CI
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ pull_request :
8+ types : [opened, reopened, synchronize]
9+
10+ env :
11+ UV_VERSION : " 0.4.27"
12+ DEFAULT_PYTHON_VERSION : " 3.12"
13+
14+ concurrency :
15+ group : ${{ github.workflow }}-${{ github.ref }}
16+ cancel-in-progress : true
17+
18+ jobs :
19+ pre-commit :
20+ name : pre-commit
21+ runs-on : ubuntu-latest
22+
23+ steps :
24+ - name : Check out the repo
25+ uses : actions/checkout@v4
26+
27+ - name : Install uv version ${{ env.UV_VERSION }}
28+ uses : astral-sh/setup-uv@v3
29+ with :
30+ version : ${{ env.UV_VERSION }}
31+ enable-cache : true
32+
33+ - name : Install python ${{ env.DEFAULT_PYTHON_VERSION }} using uv
34+ run : uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
35+
36+ - name : Install dependencies
37+ run : uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --only-group lint
38+
39+ - name : Run pre-commit
40+ run : uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync pre-commit run --all-files --color always --show-diff-on-failure
41+
42+ type-checking :
43+ name : type-checking
44+ runs-on : ubuntu-latest
45+
46+ steps :
47+ - name : Check out the repo
48+ uses : actions/checkout@v4
49+
50+ - name : Install uv version ${{ env.UV_VERSION }}
51+ uses : astral-sh/setup-uv@v3
52+ with :
53+ version : ${{ env.UV_VERSION }}
54+ enable-cache : true
55+
56+ - name : Install python ${{ env.DEFAULT_PYTHON_VERSION }} using uv
57+ run : uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
58+
59+ - name : Install dependencies
60+ run : uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --no-group test --no-group docs
61+
62+ - name : Run pyright
63+ run : uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync pyright
64+
65+ tests :
66+ name : ${{ matrix.session }} ${{ matrix.python }} [${{ matrix.os }}]
67+ runs-on : ${{ matrix.os }}
68+ strategy :
69+ fail-fast : false
70+ matrix :
71+ include :
72+ - { python: "3.12", os: "ubuntu-latest", session: "tests" }
73+ - { python: "3.11", os: "ubuntu-latest", session: "tests" }
74+ - { python: "3.10", os: "ubuntu-latest", session: "tests" }
75+ - { python: "3.12", os: "windows-latest", session: "tests" }
76+ - { python: "3.11", os: "windows-latest", session: "tests" }
77+ - { python: "3.10", os: "windows-latest", session: "tests" }
78+ - { python: "3.12", os: "macos-latest", session: "tests" }
79+ - { python: "3.11", os: "macos-latest", session: "tests" }
80+ - { python: "3.10", os: "macos-latest", session: "tests" }
81+ - { python: "3.12", os: "macos-13", session: "tests" }
82+ - { python: "3.11", os: "macos-13", session: "tests" }
83+ - { python: "3.10", os: "macos-13", session: "tests" }
84+
85+ steps :
86+ - name : Check out the repo
87+ uses : actions/checkout@v4
88+
89+ - name : Install uv version ${{ env.UV_VERSION }}
90+ uses : astral-sh/setup-uv@v3
91+ with :
92+ version : ${{ env.UV_VERSION }}
93+ enable-cache : true
94+
95+ - name : Install python ${{ matrix.python }} using uv
96+ run : uv python install ${{ matrix.python }}
97+
98+ - name : Install test dependencies
99+ run : uv sync -p ${{ matrix.python }} --frozen --no-group docs --no-group lint
100+
101+ - name : Run pytest
102+ run : uv run -p ${{ matrix.python }} --no-sync coverage run --parallel-mode -m pytest
103+
104+ - name : Upload coverage data
105+ uses : actions/upload-artifact@v4
106+ with :
107+ name : coverage-data-${{ matrix.session }}-${{ matrix.os }}-${{ matrix.python }}
108+ include-hidden-files : true
109+ path : " .coverage.*"
110+
111+ docs-build :
112+ name : docs-build
113+ runs-on : ubuntu-latest
114+
115+ steps :
116+ - name : Check out the repo
117+ uses : actions/checkout@v4
118+
119+ - name : Install uv version ${{ env.UV_VERSION }}
120+ uses : astral-sh/setup-uv@v3
121+ with :
122+ version : ${{ env.UV_VERSION }}
123+ enable-cache : true
124+
125+ - name : Install python ${{ env.DEFAULT_PYTHON_VERSION }} using uv
126+ run : uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
127+
128+ - name : Install dependencies
129+ run : uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --no-group test --no-group lint
130+
131+ - name : Install pandoc
132+ uses : pandoc/actions/setup@v1
133+
134+ - name : Build docs
135+ run : uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync sphinx-build --color docs docs/_build
136+
137+ - name : Upload docs
138+ uses : actions/upload-artifact@v4
139+ with :
140+ name : docs
141+ path : docs/_build
142+
143+ coverage :
144+ name : coverage
145+ runs-on : ubuntu-latest
146+ needs : tests
147+
148+ steps :
149+ - name : Check out the repo
150+ uses : actions/checkout@v4
151+
152+ - name : Install uv version ${{ env.UV_VERSION }}
153+ uses : astral-sh/setup-uv@v3
154+ with :
155+ version : ${{ env.UV_VERSION }}
156+ enable-cache : true
157+
158+ - name : Install python ${{ env.DEFAULT_PYTHON_VERSION }} using uv
159+ run : uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
160+
161+ - name : Install dependencies
162+ run : uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --only-group test
163+
164+ - name : Download coverage data
165+ uses : actions/download-artifact@v4
166+ with :
167+ pattern : coverage-data-*
168+ merge-multiple : true
169+
170+ - name : Combine coverage data
171+ run : uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync coverage combine
172+
173+ - name : Display coverage report
174+ run : uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync coverage report -i
175+
176+ - name : Create coverage report
177+ run : uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync coverage xml -i
178+
179+ - name : Upload coverage report
180+ uses : codecov/codecov-action@v4
181+ with :
182+ token : ${{ secrets.CODECOV_TOKEN }}
0 commit comments