Skip to content

Commit d683131

Browse files
authored
Add tests for min dependencies and update test matrix for min and max server versions (#183)
1 parent 265a305 commit d683131

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

.github/workflows/test-python.yml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ defaults:
1414
shell: bash -eux {0}
1515

1616
env:
17-
MONGODB_VERSION: "7.0"
17+
MIN_PYTHON: "3.9"
18+
MIN_MONGODB: "4.0"
19+
MAX_MONGODB: "8.0"
1820

1921
jobs:
2022
static:
@@ -55,18 +57,16 @@ jobs:
5557
- uses: extractions/setup-just@v2
5658
- name: Start MongoDB on Linux
5759
if: ${{ startsWith(runner.os, 'Linux') }}
58-
run: |
59-
docker run --name mongodb -p 27017:27017 -e MONGO_INITDB_DATABASE=unittest --detach mongo:${MONGODB_VERSION} mongod --replSet rs --setParameter transactionLifetimeLimitSeconds=5
60-
until docker exec --tty mongodb mongosh 127.0.0.1:27017 --eval "db.runCommand({ ping: 1 })"; do
61-
sleep 1
62-
done
63-
sudo docker exec --tty mongodb mongosh 127.0.0.1:27017 --eval "rs.initiate({\"_id\":\"rs\",\"members\":[{\"_id\":0,\"host\":\"127.0.0.1:27017\" }]})"
60+
uses: supercharge/[email protected]
61+
with:
62+
mongodb-version: ${{ env.MAX_MONGODB }}
63+
mongodb-replica-set: test-rs
6464
- name: Start MongoDB on MacOS
6565
if: ${{ startsWith(runner.os, 'macOS') }}
6666
run: |
6767
brew tap mongodb/brew
68-
brew install mongodb/brew/mongodb-community@${MONGODB_VERSION}
69-
brew services start mongodb-community@${MONGODB_VERSION}
68+
brew install mongodb/brew/mongodb-community@${MAX_MONGODB}
69+
brew services start mongodb-community@${MAX_MONGODB}
7070
- name: Start MongoDB on Windows
7171
if: ${{ startsWith(runner.os, 'Windows') }}
7272
shell: powershell
@@ -77,3 +77,31 @@ jobs:
7777
net start MongoDB
7878
- run: just install
7979
- run: just test
80+
81+
build-min:
82+
runs-on: ubuntu-latest
83+
steps:
84+
- uses: actions/checkout@v4
85+
with:
86+
persist-credentials: false
87+
fetch-depth: 0
88+
- name: Install uv
89+
uses: astral-sh/setup-uv@v5
90+
with:
91+
enable-cache: true
92+
python-version: ${{ env.MIN_PYTHON }}
93+
- uses: extractions/setup-just@v2
94+
- name: Install uv
95+
uses: astral-sh/setup-uv@v5
96+
with:
97+
enable-cache: true
98+
python-version: ${{ env.MIN_PYTHON }}
99+
- uses: extractions/setup-just@v2
100+
- uses: supercharge/[email protected]
101+
with:
102+
mongodb-version: ${{ env.MIN_MONGODB }}
103+
mongodb-replica-set: test-rs
104+
- name: Run unit tests with minimum dependency versions
105+
run: |
106+
uv sync --python=${MIN_PYTHON} --resolution=lowest-direct
107+
just test

0 commit comments

Comments
 (0)