Skip to content

Commit eadde28

Browse files
committed
Postgres and crypto are optionals, the others are groups
1 parent 4f82b63 commit eadde28

11 files changed

Lines changed: 141 additions & 93 deletions

File tree

.github/actionlint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
paths:
2+
.github/workflows/check_migrations_sqlite.yml:
3+
ignore:
4+
- 'SC2086:info:10:54'

.github/workflows/check-docs.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Docs
2+
23
on: [push, pull_request]
4+
35
jobs:
46
pre_job:
57
name: Path match check
@@ -13,6 +15,7 @@ jobs:
1315
with:
1416
github_token: ${{ github.token }}
1517
paths: '["docs/**", "pyproject.toml", "uv.lock"]'
18+
1619
docs:
1720
name: Checking docs build
1821
needs: pre_job
@@ -33,6 +36,6 @@ jobs:
3336
activate-environment: "true"
3437
enable-cache: "true"
3538
- name: Install dependencies
36-
run: uv sync --extra docs
39+
run: uv sync --frozen --group docs
3740
- name: Check Docs build
3841
run: make docs

.github/workflows/check_migrations_sqlite.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Migrations for SQLite versions
2+
23
on: [push, pull_request]
4+
35
jobs:
46
pre_job:
57
name: Path match check
@@ -13,33 +15,34 @@ jobs:
1315
with:
1416
github_token: ${{ github.token }}
1517
paths: '["morango/migrations/*.py", ".github/workflows/check_migrations_sqlite.yml", "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
migration_test:
4143
name: SQLite migration tests
4244
needs: [pre_job, build]
45+
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
4346
runs-on: ubuntu-latest
4447
container:
4548
image: python:3.7-buster
@@ -53,18 +56,15 @@ jobs:
5356
apt-get -y -qq update
5457
apt-get install -y build-essential tcl git-lfs
5558
- uses: actions/checkout@v6
56-
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
5759
with:
5860
lfs: true
5961
fetch-depth: 0
6062
- name: Download wheel artifact
61-
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
6263
uses: actions/download-artifact@v8
6364
with:
6465
name: wheel
6566
path: dist/
6667
- name: Build SQLite 3.25.3
67-
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
6868
run: |
6969
# Following the instructions from https://til.simonwillison.net/sqlite/ld-preload
7070
# to build SQLite from source, using version 3.25.3
@@ -77,15 +77,20 @@ jobs:
7777
# Once we have confirmed that this works, set it for subsequent steps
7878
echo "LD_PRELOAD=$(realpath .libs/libsqlite3.so)" >> $GITHUB_ENV
7979
- uses: actions/cache@v5
80-
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
8180
with:
8281
path: ~/.cache/pip
8382
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
8483
restore-keys: |
8584
${{ runner.os }}-pip-
85+
- name: Install uv
86+
uses: astral-sh/setup-uv@v7
87+
with:
88+
enable-cache: "true"
89+
- name: Manually install test dependencies
90+
run: |
91+
uv pip install --system --group test
8692
- name: Install dependencies
87-
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
88-
run: pip install $(ls dist/*.whl | head -n 1)[test]
93+
run: pip install "$(find dist -name '*.whl' | head -n 1)"
8994
- name: Run migrations
9095
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
9196
run: python tests/testapp/manage.py migrate

.github/workflows/python-publish.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# This workflow will upload a Python Package using uv when a release is created
2-
# uv provides fast, modern Python package building and publishing
3-
41
name: Upload Python Package
2+
53
on:
64
release:
75
types: [published]
6+
87
jobs:
98
deploy:
109
runs-on: ubuntu-22.04

.github/workflows/tox.yml

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Python tests
2+
23
on: [push, pull_request]
4+
35
jobs:
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

Comments
 (0)