11name : Python tests
2+
23on : [push, pull_request]
4+
35jobs :
46 pre_job :
57 name : Path match check
@@ -13,33 +15,34 @@ jobs:
1315 with :
1416 github_token : ${{ github.token }}
1517 paths : ' ["**.py", ".github/workflows/tox.yml", "tox.ini", "pyproject.toml", "uv.lock"]'
18+
1619 build :
1720 name : Build wheel
1821 needs : pre_job
22+ if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
1923 runs-on : ubuntu-latest
2024 steps :
2125 - uses : actions/checkout@v6
2226 with :
2327 fetch-depth : 0
2428 - name : Install uv
25- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
2629 uses : astral-sh/setup-uv@v7
2730 with :
2831 python-version : 3.9
2932 enable-cache : " true"
3033 - name : Build wheel
31- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
3234 run : uv build --wheel
3335 - name : Upload wheel artifact
34- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
3536 uses : actions/upload-artifact@v7
3637 with :
3738 name : wheel
3839 path : dist/*.whl
3940 retention-days : 1
41+
4042 unit_test :
4143 name : Python unit tests
4244 needs : [pre_job, build]
45+ if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
4346 runs-on : ubuntu-latest
4447 strategy :
4548 max-parallel : 5
@@ -48,27 +51,25 @@ jobs:
4851 steps :
4952 - uses : actions/checkout@v6
5053 - name : Download wheel artifact
51- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
5254 uses : actions/download-artifact@v8
5355 with :
5456 name : wheel
5557 path : dist/
5658 - name : Install uv
57- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
5859 uses : astral-sh/setup-uv@v7
5960 with :
6061 python-version : " ${{ matrix.python-version }}"
6162 activate-environment : " true"
6263 enable-cache : " true"
6364 - name : Install dependencies
64- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
65- run : uv sync --extra dev
65+ run : uv sync --frozen --group dev
6666 - name : Test with tox
67- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
68- run : uv run tox --installpkg dist/*.whl -e py${{ matrix.python-version }}
67+ run : uv run tox --installpkg "$(find dist/ -name '*.whl')" -e py${{ matrix.python-version }}
68+
6969 unit_test_eol_python :
7070 name : Python unit tests for EOL Python versions
7171 needs : [pre_job, build]
72+ if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
7273 runs-on : ubuntu-latest
7374 strategy :
7475 max-parallel : 5
@@ -79,28 +80,33 @@ jobs:
7980 steps :
8081 - uses : actions/checkout@v6
8182 - name : Download wheel artifact
82- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
8383 uses : actions/download-artifact@v8
8484 with :
8585 name : wheel
8686 path : dist/
87+ - name : Install uv
88+ uses : astral-sh/setup-uv@v7
89+ with :
90+ enable-cache : " true"
91+ - name : Manually install test dependencies
92+ run : |
93+ uv pip install --system --group test
8794 - name : Install tox
88- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
8995 run : |
9096 python -m pip install --upgrade pip
9197 pip install tox
9298 - name : tox env cache
93- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
9499 uses : actions/cache@v5
95100 with :
96101 path : ${{ github.workspace }}/.tox/py${{ matrix.python-version }}
97102 key : ${{ runner.os }}-tox-py${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
98103 - name : Test with tox
99- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
100- run : tox --installpkg dist/*.whl -e py${{ matrix.python-version }}
104+ run : tox --installpkg "$(find dist/ -name '*.whl')" -e py${{ matrix.python-version }} --sitepackages
105+
101106 cryptography :
102107 name : Python unit tests + cryptography
103108 needs : [pre_job, build]
109+ if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
104110 runs-on : ubuntu-latest
105111 env :
106112 cryptography_version : ' 40.0.2'
@@ -111,31 +117,28 @@ jobs:
111117 steps :
112118 - uses : actions/checkout@v6
113119 - name : Download wheel artifact
114- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
115120 uses : actions/download-artifact@v8
116121 with :
117122 name : wheel
118123 path : dist/
119124 - name : Install system dependencies
120- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
121125 run : |
122126 sudo apt-get -y -qq update
123127 sudo apt-get install -y openssl libssl-dev
124128 - name : Install uv
125- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
126129 uses : astral-sh/setup-uv@v7
127130 with :
128131 python-version : " ${{ matrix.python-version }}"
129132 enable-cache : " true"
130133 - name : Install dependencies
131- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
132- run : uv sync --extra dev
134+ run : uv sync --frozen --group dev
133135 - name : Test with tox
134- if : $ {{ needs.pre_job.outputs.should_skip != 'true' }}
135- run : uv run tox --installpkg dist/*.whl -e py${{ matrix.python-version }}-cryptography${{ env.cryptography_version }}
136+ run : uv run tox --installpkg "$(find dist/ -name '*.whl')" -e py$ {{ matrix.python-version }}-cryptography${{ env.cryptography_version }}
137+
136138 cryptography_eol_python :
137139 name : Python unit tests + cryptography for EOL Python versions
138140 needs : [pre_job, build]
141+ if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
139142 runs-on : ubuntu-latest
140143 env :
141144 cryptography_version : ' 40.0.2'
@@ -148,36 +151,40 @@ jobs:
148151 steps :
149152 - uses : actions/checkout@v6
150153 - name : Download wheel artifact
151- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
152154 uses : actions/download-artifact@v8
153155 with :
154156 name : wheel
155157 path : dist/
156158 - name : Install system dependencies
157- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
158159 run : |
159160 echo "deb http://archive.debian.org/debian-archive/debian/ buster main" > /etc/apt/sources.list
160161 echo "deb http://archive.debian.org/debian-archive/debian-security/ buster/updates main" >> /etc/apt/sources.list
161162 echo "Acquire::Check-Valid-Until \"false\";" > /etc/apt/apt.conf.d/99archive
162163 apt-get -y -qq update
163164 apt-get install -y openssl libssl-dev
165+ - name : Install uv
166+ uses : astral-sh/setup-uv@v7
167+ with :
168+ enable-cache : " true"
169+ - name : Manually install test dependencies
170+ run : |
171+ uv pip install --system --group test
164172 - name : Install tox
165- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
166173 run : |
167174 python -m pip install --upgrade pip
168175 pip install tox
169176 - name : tox env cache
170- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
171177 uses : actions/cache@v5
172178 with :
173179 path : ${{ github.workspace }}/.tox/py${{ matrix.python-version }}-cryptography${{ env.cryptography_version }}
174180 key : ${{ runner.os }}-tox-py${{ matrix.python-version }}-crypto${{ env.cryptography_version }}-${{ hashFiles('pyproject.toml') }}
175181 - name : Test with tox
176- if : $ {{ needs.pre_job.outputs.should_skip != 'true' }}
177- run : tox --installpkg dist/*.whl -e py${{ matrix.python-version }}-cryptography${{ env.cryptography_version }}
182+ run : tox --installpkg "$(find dist/ -name '*.whl')" -e py$ {{ matrix.python-version }}-cryptography${{ env.cryptography_version }} --sitepackages
183+
178184 postgres :
179185 name : Python postgres unit tests
180186 needs : [pre_job, build]
187+ if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
181188 runs-on : ubuntu-latest
182189 services :
183190 # Label used to access the service container
@@ -198,27 +205,25 @@ jobs:
198205 steps :
199206 - uses : actions/checkout@v6
200207 - name : Download wheel artifact
201- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
202208 uses : actions/download-artifact@v8
203209 with :
204210 name : wheel
205211 path : dist/
206212 - name : Install uv
207- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
208213 uses : astral-sh/setup-uv@v7
209214 with :
210215 python-version : " 3.9"
211216 activate-environment : " true"
212217 enable-cache : " true"
213218 - name : Install dependencies
214- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
215- run : uv sync --extra dev
219+ run : uv sync --frozen --group dev
216220 - name : Test with tox
217- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
218- run : uv run tox --installpkg dist/*.whl --discover $(uv python find 3.9) -e postgres
221+ run : uv run tox --installpkg "$(find dist/ -name '*.whl')" --discover "$(uv python find 3.9)" -e postgres
222+
219223 windows :
220224 name : Python unit tests on Windows Server
221225 needs : [pre_job, build]
226+ if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
222227 runs-on : windows-latest
223228 strategy :
224229 max-parallel : 5
@@ -227,23 +232,26 @@ jobs:
227232 steps :
228233 - uses : actions/checkout@v6
229234 - name : Download wheel artifact
230- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
231235 uses : actions/download-artifact@v8
232236 with :
233237 name : wheel
234238 path : dist/
235239 - name : Set up Python ${{ matrix.python-version }}
236- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
237240 uses : actions/setup-python@v6
238241 with :
239242 python-version : ${{ matrix.python-version }}
243+ - name : Install uv
244+ uses : astral-sh/setup-uv@v7
245+ with :
246+ enable-cache : " true"
247+ - name : Manually install test dependencies
248+ run : |
249+ uv pip install --system --group test
240250 - name : Install tox
241- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
242251 run : |
243252 python -m pip install --upgrade pip
244253 pip install tox
245254 - name : Test with tox
246- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
247255 run : |
248256 $wheel = Get-ChildItem dist\*.whl | Select-Object -ExpandProperty FullName -First 1
249- tox --installpkg $wheel -e windows
257+ tox --installpkg $wheel -e windows --sitepackages
0 commit comments