Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
141dfde
Point vendor.sh at libbson 2.5.0
blink1073 Sep 1, 2026
b7719f7
Vendor libbson 2.5.0 sources
blink1073 Sep 1, 2026
c5a0f14
Fix vendor.sh for libbson 2.x's common/src and mlib layout
blink1073 Sep 1, 2026
522e816
Fix build against vendored libbson 2.5.0
blink1073 Sep 1, 2026
658a703
Update docs for libbson 2.5.0 bump
blink1073 Sep 1, 2026
102e30c
Update README speed claim for libbson 2.5.0
blink1073 Sep 1, 2026
f1221dc
Address code review feedback on the libbson 2.5.0 bump
blink1073 Sep 3, 2026
3bb2f63
Add CodeQL analysis workflow
blink1073 Sep 4, 2026
1129253
Add .codeqlignore to exclude vendored sources from CodeQL
blink1073 Sep 4, 2026
9e2cd0c
Exclude vendored libbson/jsonsl sources from CodeQL by never compilin…
blink1073 Sep 4, 2026
138b1ba
Update CodeQL workflow permissions and timeout
blink1073 Sep 4, 2026
85f540f
Fix invalid CodeQL workflow YAML
blink1073 Sep 4, 2026
cfcaaea
Drop unused vendored sources from the build
blink1073 Sep 4, 2026
5782cce
Drop unused vendored sources at vendor time instead of build time
blink1073 Sep 4, 2026
8b1f702
Revert setup.py build-time filtering, now handled by vendor.sh
blink1073 Sep 4, 2026
0ef0b22
Merge remote-tracking branch 'upstream/main' into claude/python-6050-…
blink1073 Sep 4, 2026
c4f1775
Fix CodeQL c-cpp build after merging BSONJS_VERSION from main
blink1073 Sep 4, 2026
776a964
Add build-libbson.sh to build libbson 2.5.0 as a static library
blink1073 Sep 12, 2026
510c808
Add CMakeLists.txt for scikit-build-core with static libbson
blink1073 Sep 12, 2026
ae0a70a
Migrate from setuptools to scikit-build-core
blink1073 Sep 12, 2026
0cda5f4
Add cibw_before_build.sh to build libbson in cibuildwheel containers
blink1073 Sep 12, 2026
d5d3c98
Remove vendored libbson sources and obsolete build scripts
blink1073 Sep 12, 2026
a312847
Ignore libbson build artifacts
blink1073 Sep 12, 2026
9886831
Update CI workflows for build-time libbson checkout
blink1073 Sep 12, 2026
cdace52
Set both libbson include dirs so #include <bson/...> resolves
blink1073 Sep 12, 2026
e302ffc
Update docs for build-time libbson checkout
blink1073 Sep 12, 2026
a2ed673
Run CodeQL on the master branch
blink1073 Sep 12, 2026
e7acce1
Build libbson via CMake FetchContent instead of an install-time script
blink1073 Sep 13, 2026
70913a7
Add bump-libbson.sh to bump libbson and refresh README benchmark
blink1073 Sep 13, 2026
ea1f780
Detect latest mongo-c-driver and bail when libbson is current
blink1073 Sep 13, 2026
f3d7ce6
Update README for FetchContent build and bump libbson to 2.5.3
blink1073 Sep 13, 2026
714a1f4
Move build helpers into scripts/ and split bump-libbson Python into a…
blink1073 Sep 13, 2026
c5a0b40
Disable libmongoc in the CMake build and fix bump-libbson nits
blink1073 Sep 14, 2026
10d786b
Bump minimum supported Python to 3.11
blink1073 Sep 14, 2026
6525544
Build the extension as a Stable ABI module so abi3 wheels work everyw…
blink1073 Sep 14, 2026
84b95aa
Fetch mongo-c-driver via a shallow git clone for resilient downloads
blink1073 Sep 14, 2026
6d4986f
Add ccache to CI to speed up the repeated libbson build
blink1073 Sep 14, 2026
f67f86b
Build the wheel once per platform and test it against every Python ve…
blink1073 Sep 14, 2026
8a7e298
Fix zizmor findings in workflow changes
blink1073 Sep 14, 2026
0479548
Split the build into per-platform jobs so tests don't wait on each other
blink1073 Sep 14, 2026
5432797
Report ccache statistics after each wheel build
blink1073 Sep 14, 2026
9ecd0ef
Build in a deterministic directory so ccache hits across CI runs
blink1073 Sep 14, 2026
53d799c
Fetch mongo-c-driver from a retryable tarball instead of a git clone
blink1073 Sep 14, 2026
281c020
Only use ccache as the compiler launcher on GNU/Clang platforms
blink1073 Sep 14, 2026
9d4636d
Do not install ccache on Windows builds
blink1073 Sep 14, 2026
ffc7425
Make the mongo-c-driver download robust against CI stalls
blink1073 Sep 14, 2026
36d30aa
Normalize Windows paths for the cached mongo-c-driver archive
blink1073 Sep 14, 2026
aeb1858
Pre-fetch the mongo-c-driver tarball and fail fast if it's unavailable
blink1073 Sep 14, 2026
50ec861
Instrument the mongo-c-driver fetch and FetchContent with timing markers
blink1073 Sep 15, 2026
2fc905d
Build wheels with --no-build-isolation to rule out isolation overhead
blink1073 Sep 15, 2026
06512e6
Build only libbson: apply the minimal-build options before FetchContent
blink1073 Sep 15, 2026
67634c7
Exclude the workspace from Defender to speed up MSVC compilation
blink1073 Sep 15, 2026
e3e232d
Add a toolchain-detection step to confirm MSVC vs MinGW on runners
blink1073 Sep 15, 2026
8279038
Force MSVC in the Windows wheel build (was defaulting to MinGW)
blink1073 Sep 15, 2026
4868f00
Build libbson via meson-python instead of scikit-build-core
blink1073 Sep 15, 2026
8bb5846
Fix Linux and Windows builds of the Meson migration
blink1073 Sep 15, 2026
421bdfb
Fix action.yml YAML: extract mongo-c-driver with a one-line python call
blink1073 Sep 15, 2026
b060c0f
extract mongo-c-driver without python -c '--' (sys.argv[1] became '--')
blink1073 Sep 15, 2026
cf58640
Build Windows wheels on the windows-2022 runner (VS 2022/MSVC 17.x)
blink1073 Sep 15, 2026
59a71bd
Skip ccache setup on the Windows build job
blink1073 Sep 15, 2026
f5c3698
Link ws2_32 as an import library on Windows
blink1073 Sep 15, 2026
84c3663
Drop dead CMake build; point version tooling at meson.build
blink1073 Sep 15, 2026
1c90473
Address code review: bootstrap the sdist and wire CodeQL to Meson
blink1073 Sep 15, 2026
f8d0dca
Build 64-bit Windows wheels only
blink1073 Sep 15, 2026
b0586a8
Run the Python Dist Windows build on windows-2022
blink1073 Sep 15, 2026
73fa85c
Skip ccache setup on the dist Windows build
blink1073 Sep 15, 2026
fb2e873
Define _DEFAULT_SOURCE for the Linux build
blink1073 Sep 15, 2026
174cd9a
Define _XOPEN_SOURCE=700 for the Linux build
blink1073 Sep 15, 2026
c6c8583
Restore the 32-bit Windows wheel build
blink1073 Sep 15, 2026
3532a17
Fix zizmor findings in the workflows
blink1073 Sep 15, 2026
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
56 changes: 56 additions & 0 deletions .github/actions/setup-ccache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Setup ccache
description: "Install ccache, configure it, and restore/save the cache"
inputs:
key:
description: "Cache key for actions/cache"
required: true
restore-keys:
description: "Restore-key prefix for actions/cache"
required: true
maxsize:
description: "CCACHE_MAXSIZE"
required: false
default: "400M"
sloppiness:
description: "CCACHE_SLOPPINESS"
required: false
default: "pch_defines,time_macros"
runs:
using: "composite"
steps:
- name: Configure ccache
shell: bash
env:
CCACHE_MAXSIZE: ${{ inputs.maxsize }}
CCACHE_SLOPPINESS: ${{ inputs.sloppiness }}
run: |
{
echo "CCACHE_BASEDIR=$GITHUB_WORKSPACE"
echo "CCACHE_DIR=$GITHUB_WORKSPACE/.ccache"
echo "CCACHE_COMPRESS=true"
echo "CCACHE_COMPRESSLEVEL=6"
echo "CCACHE_MAXSIZE=$CCACHE_MAXSIZE"
echo "CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS"
} >> "$GITHUB_ENV"

- name: Install ccache
shell: bash
run: |
# Only used as a compiler launcher on GNU/Clang; ccache's MSVC launcher
# hangs compiler detection on Windows, so skip it there.
if [ "$RUNNER_OS" = "Linux" ]; then
sudo apt-get install -y ccache
elif [ "$RUNNER_OS" = "macOS" ]; then
brew install ccache
fi
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed

- name: Restore/save ccache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ github.workspace }}/.ccache
key: ${{ inputs.key }}
restore-keys: ${{ inputs.restore-keys }}

- name: Zero ccache stats
shell: bash
run: ccache --zero-stats
32 changes: 32 additions & 0 deletions .github/actions/setup-mongo-c-driver/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Setup mongo-c-driver
description: "Cache and fetch the mongo-c-driver release pinned in meson.build"
runs:
using: "composite"
steps:
- name: Exclude the workspace from Windows Defender
if: runner.os == 'Windows'
shell: powershell
run: |
# Real-time MSVC compilation on GitHub-hosted Windows is throttled by
# Defender; excluding the workspace is the standard, big win.
Add-MpPreference -ExclusionPath "$env:GITHUB_WORKSPACE" -ErrorAction SilentlyContinue
Add-MpPreference -ExclusionPath "$env:GITHUB_WORKSPACE\build" -ErrorAction SilentlyContinue

- name: Read the pinned mongo-c-driver version
id: pinned
shell: bash
run: |
set -euo pipefail
VERSION=$(python -c "import re,pathlib; print(re.search(r\"mcd_version\s*=\s*'([0-9.]+)'\", pathlib.Path('meson.build').read_text()).group(1))")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Restore/save mongo-c-driver tarball
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ github.workspace }}/.mongo-c-driver
key: mcd-${{ steps.pinned.outputs.version }}-${{ runner.os }}-${{ github.sha }}
restore-keys: mcd-${{ steps.pinned.outputs.version }}-${{ runner.os }}-

- name: Fetch and extract mongo-c-driver
shell: bash
run: python scripts/fetch_mongo_c_driver.py
54 changes: 54 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "CodeQL"

on:
push:
branches: ["master"]
pull_request:
schedule:
- cron: '17 10 * * 2'

concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
actions: read

strategy:
fail-fast: false
matrix:
include:
- language: c-cpp
build-mode: manual
# Configure with Meson so libbson's config.h/version.h are generated
# and the extension's compile flags are computed in one place, then
# compile bsonjs.c with the exact command recorded in
# compile_commands.json so the flags cannot drift from meson.build.
# CodeQL's tracer only extracts files the compiler is actually
# invoked on, so filtering to bsonjs.c keeps libbson out of scope.
manual-build-command: |
pip install "meson>=1.3" ninja
python3 scripts/fetch_mongo_c_driver.py
meson setup /tmp/codeql-build
cmd=$(jq -r '.[] | select(.file | endswith("bsonjs.c")) | .command' /tmp/codeql-build/compile_commands.json)
o=$(printf '%s' "$cmd" | grep -o '\-o [^ ]*' | cut -d' ' -f2)
(cd /tmp/codeql-build && mkdir -p "$(dirname "$o")" && bash -c "$cmd")
- language: python
build-mode: none
- language: actions
build-mode: none
steps:
- uses: mongodb-labs/drivers-github-tools/codeql@f137fdd28483af14ebf466ebc5aa789fbf867218 # v3
with:
language: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
manual-build-command: ${{ matrix.manual-build-command }}
config: |
paths-ignore:
- 'test/**'
56 changes: 49 additions & 7 deletions .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,61 @@ defaults:
run:
shell: bash -eux {0}

permissions:
contents: read

jobs:
build_wheels:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-24.04-arm, ubuntu-latest]
os: [macos-latest, windows-2022, ubuntu-24.04-arm, ubuntu-latest]
name: Build CPython-${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
- uses: actions/upload-artifact@v7
- name: Set up ccache
if: runner.os != 'Windows'
uses: ./.github/actions/setup-ccache
with:
key: ccache-${{ runner.os }}-${{ github.sha }}
restore-keys: ccache-${{ runner.os }}-
- name: Set up mongo-c-driver
uses: ./.github/actions/setup-mongo-c-driver
- name: Build wheels (macOS/Linux)
if: runner.os != 'Windows'
uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
- name: Build wheels (Windows AMD64)
if: runner.os == 'Windows'
uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
env:
CIBW_ARCHS: AMD64
# Meson's --vsenv activates only the x64 toolset, and its Python
# dependency check rejects a 32-bit Python against an x64 compiler
# ("Need python for x86_64, but found x86"). Exporting the x86 toolset
# environment here makes Meson skip its own activation (VSINSTALLDIR is
# set) and detect the x86 compiler instead, so the host machine reads
# as x86 and matches the 32-bit Python.
- name: Export the x86 MSVC environment
if: runner.os == 'Windows'
shell: powershell
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vcvarsall = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -find "VC\Auxiliary\Build\vcvarsall.bat" | Select-Object -First 1
if (-not $vcvarsall) { throw "vcvarsall.bat not found" }
cmd /s /c "`"$vcvarsall`" x86 && set" | ForEach-Object {
if ($_ -match '^([^=]+)=(.*)$') {
Add-Content -Path $env:GITHUB_ENV -Value "$($Matches[1])=$($Matches[2])"
}
}
- name: Build wheels (Windows x86)
if: runner.os == 'Windows'
uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
env:
CIBW_ARCHS: x86
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.os }}-wheel
path: ./wheelhouse/*.whl
Expand All @@ -50,12 +92,12 @@ jobs:
- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: 3.9
python-version: 3.11
- name: Build SDist
run: |
python -m pip install build
python -m build --sdist
- uses: actions/upload-artifact@v7
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: "sdist"
path: dist/*.tar.gz
Expand All @@ -65,13 +107,13 @@ jobs:
name: Download Wheels
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v8
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- name: Flatten directory
working-directory: .
run: |
find . -mindepth 2 -type f -exec mv {} . \;
find . -type d -empty -delete
- uses: actions/upload-artifact@v7
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: all-dist-${{ github.run_id }}
path: "./*"
5 changes: 4 additions & 1 deletion .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ defaults:
run:
shell: bash -eux {0}

permissions:
contents: read

jobs:
pre-publish:
environment: release
Expand Down Expand Up @@ -73,7 +76,7 @@ jobs:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v8
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: all-dist-${{ github.run_id }}
path: dist/
Expand Down
Loading
Loading