Skip to content

PYTHON-5349 Use drivers-evergreen-tools to start servers in GitHub Actions #2474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 19 additions & 21 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,34 +50,32 @@
cppcheck pymongo

build:
# supercharge/mongodb-github-action requires containers so we don't test other platforms
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Tests currently only pass on ubuntu on GitHub Actions.
os: [ubuntu-latest]
python-version: ["3.9", "pypy-3.10", "3.13", "3.13t"]
python-version: ["3.9", "pypy-3.10", "3.13t"]
mongodb-version: ["8.0"]

name: CPython ${{ matrix.python-version }}-${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install just
uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
- name: Install uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: just install
- name: Start MongoDB
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
with:
mongodb-version: 6.0
version: "${{ matrix.mongodb-version }}"
- name: Run tests
run: just test
run: uv run --extra test pytest -v

doctest:
runs-on: ubuntu-latest
name: DocTest
Expand All @@ -92,15 +90,15 @@
with:
enable-cache: true
python-version: "3.9"
- name: Start MongoDB
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
with:
mongodb-version: '8.0.0-rc4'
version: "8.0"
- name: Install dependencies
run: just install
- name: Run tests
run: |
just setup-tests doctest
just run-tests

docs:
Expand Down Expand Up @@ -210,8 +208,8 @@
cache-dependency-path: 'sdist/test/pyproject.toml'
# Test sdist on lowest supported Python
python-version: '3.9'
- name: Start MongoDB
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
- name: Run connect test from sdist
shell: bash
run: |
Expand All @@ -234,13 +232,13 @@
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v5
with:
python-version: '3.9'
- name: Start MongoDB
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
with:
mongodb-version: 6.0
version: "8.0"
# Async and our test_dns do not support dnspython 1.X, so we don't run async or dns tests here
- name: Run tests
shell: bash
run: |
uv venv
source .venv/bin/activate
Expand All @@ -260,13 +258,13 @@
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v5
with:
python-version: '3.9'
- name: Start MongoDB
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
with:
mongodb-version: 6.0
version: "8.0"
# The lifetime kwarg we use in srv resolution was added to the async resolver API in dnspython 2.1.0
- name: Run tests
shell: bash
run: |
uv venv
source .venv/bin/activate
Expand Down
7 changes: 7 additions & 0 deletions .github/zizmor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rules:
unpinned-uses:
config:
policies:
actions/*: ref-pin
mongodb-labs/drivers-github-tools/*: ref-pin
mongodb-labs/drivers-evergreen-tools: ref-pin
Loading