Skip to content

Commit f937e85

Browse files
committed
fix(CI): migrate CI to uv, simplify MongoDB setup, align deps with pyproject
- Use uv for dependency management and builds - Simplify GitHub Actions matrix and MongoDB setup - Replace custom CI scripts with uv-based dependency management, actions - Match tox environment with GitHub Action matrix
1 parent fa21035 commit f937e85

File tree

4 files changed

+33
-215
lines changed

4 files changed

+33
-215
lines changed

.github/workflows/github-actions.yml

Lines changed: 33 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -13,111 +13,49 @@ on:
1313
tags:
1414
- 'v[0-9]+\.[0-9]+\.[0-9]+*'
1515
env:
16-
MONGODB_4_4: "4.4.29"
17-
MONGODB_5_0: "5.0.31"
18-
MONGODB_6_0: "6.0.22"
19-
MONGODB_7_0: "7.0.19"
20-
MONGODB_8_0: "8.0.9"
21-
22-
PYMONGO_3_12: "3.12.3"
23-
PYMONGO_3_13: "3.13.0"
24-
PYMONGO_4_0: "4.0.2"
25-
PYMONGO_4_3: "4.3.3"
26-
PYMONGO_4_4: "4.4.1"
27-
PYMONGO_4_6: "4.6.2"
28-
PYMONGO_4_7: "4.7.3"
29-
PYMONGO_4_8: "4.8.0"
30-
PYMONGO_4_9: "4.9.2"
31-
PYMONGO_4_10: "4.10.1"
32-
PYMONGO_4_11: "4.11.2"
33-
34-
MAIN_PYTHON_VERSION: "3.9"
16+
MAIN_PYTHON_VERSION: "3.14"
3517

3618
jobs:
3719
linting:
3820
# Run pre-commit (https://pre-commit.com/)
3921
# which runs pre-configured linter & autoformatter
4022
runs-on: ubuntu-latest
4123
steps:
42-
- uses: actions/checkout@v4
43-
- uses: actions/setup-python@v5
44-
with:
45-
python-version: ${{ env.MAIN_PYTHON_VERSION }}
46-
check-latest: true
47-
- run: bash .github/workflows/install_ci_python_dep.sh
48-
- run: pre-commit run -a
24+
- uses: actions/checkout@v6
25+
- name: Install the latest version of uv
26+
uses: astral-sh/setup-uv@v7
27+
- name: Install Dependencies for lint
28+
run: uv sync --only-group dev
29+
- name: Install Dependencies for lint
30+
run: uv run pre-commit run -a
4931

5032
test:
5133
# Test suite run against recent python versions
5234
# and against a few combination of MongoDB and pymongo
53-
runs-on: ubuntu-22.04
35+
runs-on: ubuntu-latest
5436
strategy:
5537
fail-fast: false
5638
matrix:
57-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.9", "pypy3.10"]
58-
MONGODB: [$MONGODB_4_4]
59-
PYMONGO: [$PYMONGO_3_12]
60-
include:
61-
- python-version: "3.9"
62-
MONGODB: $MONGODB_4_4
63-
PYMONGO: $PYMONGO_3_13
64-
- python-version: "3.10"
65-
MONGODB: $MONGODB_4_4
66-
PYMONGO: $PYMONGO_4_0
67-
- python-version: "3.11"
68-
MONGODB: $MONGODB_5_0
69-
PYMONGO: $PYMONGO_4_3
70-
- python-version: "3.11"
71-
MONGODB: $MONGODB_6_0
72-
PYMONGO: $PYMONGO_4_4
73-
- python-version: "3.11"
74-
MONGODB: $MONGODB_7_0
75-
PYMONGO: $PYMONGO_4_6
76-
- python-version: "3.11"
77-
MONGODB: $MONGODB_7_0
78-
PYMONGO: $PYMONGO_4_7
79-
- python-version: "3.11"
80-
MONGODB: $MONGODB_7_0
81-
PYMONGO: $PYMONGO_4_8
82-
- python-version: "3.11"
83-
MONGODB: $MONGODB_7_0
84-
PYMONGO: $PYMONGO_4_9
85-
- python-version: "3.12"
86-
MONGODB: $MONGODB_7_0
87-
PYMONGO: $PYMONGO_4_9
88-
- python-version: "3.12"
89-
MONGODB: $MONGODB_8_0
90-
PYMONGO: $PYMONGO_4_9
91-
- python-version: "3.13"
92-
MONGODB: $MONGODB_8_0
93-
PYMONGO: $PYMONGO_4_9
94-
- python-version: "3.13"
95-
MONGODB: $MONGODB_8_0
96-
PYMONGO: $PYMONGO_4_10
97-
- python-version: "3.13"
98-
MONGODB: $MONGODB_8_0
99-
PYMONGO: $PYMONGO_4_11
39+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
40+
mongodb-version: ["4.4", "5.0", "6.0", "7.0", "8.0"]
10041
steps:
101-
- uses: actions/checkout@v4
102-
- name: Set up Python ${{ matrix.python-version }}
103-
uses: actions/setup-python@v5
42+
- uses: actions/checkout@v6
43+
- name: Install uv and set the Python version ${{ matrix.python-version }}
44+
uses: astral-sh/setup-uv@v7
10445
with:
10546
python-version: ${{ matrix.python-version }}
106-
check-latest: true
107-
- name: install mongo and ci dependencies
108-
run: |
109-
bash .github/workflows/install_mongo.sh ${{ matrix.MONGODB }}
110-
bash .github/workflows/install_ci_python_dep.sh
111-
bash .github/workflows/start_mongo.sh ${{ matrix.MONGODB }}
112-
- name: tox dry-run (to pre-install venv)
113-
run: tox -e $(echo py${{ matrix.python-version }}-mg${{ matrix.PYMONGO }} | tr -d . | sed -e 's/pypypy/pypy/') -- "-k=test_ci_placeholder"
47+
- name: Start MongoDB
48+
uses: supercharge/[email protected]
49+
with:
50+
mongodb-version: ${{ matrix.mongodb-version }}
51+
- name: Install Dependencies
52+
run: uv sync --only-group test
11453
- name: Run test suite
115-
run: tox -e $(echo py${{ matrix.python-version }}-mg${{ matrix.PYMONGO }} | tr -d . | sed -e 's/pypypy/pypy/') -- "--cov=mongoengine"
54+
run: uv run tox run-parallel -o -e "$(tox -a | grep py$(echo "${{ matrix.python-version }}" | tr -d . ))" -- "--cov=mongoengine"
11655
- name: Send coverage to Coveralls
11756
env:
11857
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11958
COVERALLS_SERVICE_NAME: github
120-
if: ${{ matrix.python-version == env.MAIN_PYTHON_VERSION }}
12159
run: coveralls
12260

12361
build_doc_dryrun:
@@ -127,16 +65,13 @@ jobs:
12765
# builds are visible at https://readthedocs.org/projects/mongoengine-odm/builds/
12866
runs-on: ubuntu-latest
12967
steps:
130-
- uses: actions/checkout@v4
131-
- name: Set up Python ${{ matrix.python-version }}
132-
uses: actions/setup-python@v5
68+
- uses: actions/checkout@v6
69+
- name: Install uv and set the Python version ${{ env.MAIN_PYTHON_VERSION }}
70+
uses: astral-sh/setup-uv@v7
13371
with:
13472
python-version: ${{ env.MAIN_PYTHON_VERSION }}
135-
check-latest: true
13673
- name: install python dep
137-
run: |
138-
pip install -e .
139-
pip install -r docs/requirements.txt
74+
run: uv sync --only-group docs
14075
- name: build doc
14176
run: |
14277
cd docs
@@ -146,33 +81,28 @@ jobs:
14681
runs-on: ubuntu-latest
14782
needs: [linting, test, build_doc_dryrun]
14883
steps:
149-
- uses: actions/checkout@v4
150-
- uses: actions/setup-python@v5
84+
- uses: actions/checkout@v6
85+
- name: Install uv and set the Python version ${{ env.MAIN_PYTHON_VERSION }}
86+
uses: astral-sh/setup-uv@v7
15187
with:
15288
python-version: ${{ env.MAIN_PYTHON_VERSION }}
153-
check-latest: true
15489
- name: build dummy wheel for test-pypi
155-
run: |
156-
pip install wheel
157-
python setup.py sdist bdist_wheel
90+
run: uv build
15891

15992
build-n-publish:
16093
runs-on: ubuntu-latest
16194
needs: [linting, test, build_doc_dryrun, build-dryrun]
16295
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')
16396
steps:
164-
- uses: actions/checkout@v4
165-
- name: Set up Python ${{ env.MAIN_PYTHON_VERSION }}
166-
uses: actions/setup-python@v5
97+
- uses: actions/checkout@v6
98+
- name: Install uv and set the Python version ${{ env.MAIN_PYTHON_VERSION }}
99+
uses: astral-sh/setup-uv@v7
167100
with:
168101
python-version: ${{ env.MAIN_PYTHON_VERSION }}
169-
check-latest: true
170102
# todo separate build from publish
171103
# https://stackoverflow.com/questions/59349905/which-properties-does-github-event-in-a-github-workflow-have
172104
- name: build dummy wheel for test-pypi
173-
run: |
174-
pip install wheel
175-
python setup.py sdist bdist_wheel
105+
run: uv build
176106
- name: publish pypi
177107
uses: pypa/gh-action-pypi-publish@release/v1
178108
with:

.github/workflows/install_ci_python_dep.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/install_mongo.sh

Lines changed: 0 additions & 82 deletions
This file was deleted.

.github/workflows/start_mongo.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)