Skip to content

INTPYTHON-893 Fix benchmark setup (#376) #510

INTPYTHON-893 Fix benchmark setup (#376)

INTPYTHON-893 Fix benchmark setup (#376) #510

Workflow file for this run

name: Python Tests
on:
push:
branches: ["main"]
pull_request:
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: ./bindings/python
shell: bash -eux {0}
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-python@v6
- name: Install Deps
run: |
python -m pip install rust-just uv
- name: Run linter
run: just lint
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]
fail-fast: false
name: CPython ${{ matrix.python-version }}-${{ matrix.os }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
- name: Set up env
run: |
echo "LIBBSON_INSTALL_DIR=$PWD/libbson" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$PWD/libbson/lib" >> $GITHUB_ENV
echo "MONGODB_VERSION=8.0" >> $GITHUB_ENV
- name: Set up env on Windows
if: ${{ startsWith(runner.os, 'Windows') }}
run: |
echo "MONGODB_VERSION=4.4" >> $GITHUB_ENV
- name: Start MongoDB
uses: mongodb-labs/drivers-evergreen-tools@master
with:
version: ${{ env.MONGODB_VERSION }}
topology: replica_set
- name: Install CMake 3 on MacOS
# libbson requires cmake 3, and cmake 4 is now the default on the GHA runners.
if: ${{ startsWith(runner.os, 'macOS') }}
run: |
pipx install "cmake>=3.15,<4"
- name: Install Deps
run: |
python -m pip install rust-just uv
- name: Install libbson
run: just build-libbson
- name: Ensure imports with no test deps
run: just import-check
- name: Run the tests
if: ${{ ! endsWith(matrix.python-version, 't') }}
env:
UV_PYTHON: ${{matrix.python-version}}
run: just test
- name: Run the tests with no optional deps
env:
UV_PYTHON: ${{matrix.python-version}}
run: just test-no-optional
bson2:
name: bson2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-python@v6
- name: Install Deps
run: |
python -m pip install rust-just uv
- name: Set up env
run: |
echo "LIBBSON_INSTALL_DIR=$PWD/libbson" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$PWD/libbson/lib" >> $GITHUB_ENV
echo "LIBBSON_VERSION=2.0.1" >> $GITHUB_ENV
- name: Install libbson
run: just build-libbson
- name: Ensure imports with no test deps
run: just import-check
- name: Start MongoDB
uses: mongodb-labs/drivers-evergreen-tools@master
with:
version: "8.0"
topology: replica_set
- name: Run the tests
run: just test
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
- name: Install Deps
run: |
python -m pip install rust-just uv
- name: Build docs
run: just docs
- name: Run linkcheck
run: just docs-linkcheck
test_minimum:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
- name: Install Deps
run: |
python -m pip install uv rust-just
- name: Set up env
run: |
echo "LIBBSON_INSTALL_DIR=$PWD/libbson" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$PWD/libbson/lib" >> $GITHUB_ENV
- name: Install libbson
run: just build-libbson
- name: Start MongoDB
uses: mongodb-labs/drivers-evergreen-tools@master
with:
version: "8.0"
topology: replica_set
- name: Run tests
shell: bash
run: |
uv venv
source .venv/bin/activate
uv pip install -e ".[test]" --resolution=lowest-direct
pytest