-
Notifications
You must be signed in to change notification settings - Fork 13
PYTHON-6050 Build libbson 2.5.3 from source with Meson #112
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
Draft
blink1073
wants to merge
70
commits into
mongodb-labs:main
Choose a base branch
from
blink1073:claude/python-6050-implementation-9cba3c
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
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 b7719f7
Vendor libbson 2.5.0 sources
blink1073 c5a0f14
Fix vendor.sh for libbson 2.x's common/src and mlib layout
blink1073 522e816
Fix build against vendored libbson 2.5.0
blink1073 658a703
Update docs for libbson 2.5.0 bump
blink1073 102e30c
Update README speed claim for libbson 2.5.0
blink1073 f1221dc
Address code review feedback on the libbson 2.5.0 bump
blink1073 3bb2f63
Add CodeQL analysis workflow
blink1073 1129253
Add .codeqlignore to exclude vendored sources from CodeQL
blink1073 9e2cd0c
Exclude vendored libbson/jsonsl sources from CodeQL by never compilin…
blink1073 138b1ba
Update CodeQL workflow permissions and timeout
blink1073 85f540f
Fix invalid CodeQL workflow YAML
blink1073 cfcaaea
Drop unused vendored sources from the build
blink1073 5782cce
Drop unused vendored sources at vendor time instead of build time
blink1073 8b1f702
Revert setup.py build-time filtering, now handled by vendor.sh
blink1073 0ef0b22
Merge remote-tracking branch 'upstream/main' into claude/python-6050-…
blink1073 c4f1775
Fix CodeQL c-cpp build after merging BSONJS_VERSION from main
blink1073 776a964
Add build-libbson.sh to build libbson 2.5.0 as a static library
blink1073 510c808
Add CMakeLists.txt for scikit-build-core with static libbson
blink1073 ae0a70a
Migrate from setuptools to scikit-build-core
blink1073 0cda5f4
Add cibw_before_build.sh to build libbson in cibuildwheel containers
blink1073 d5d3c98
Remove vendored libbson sources and obsolete build scripts
blink1073 a312847
Ignore libbson build artifacts
blink1073 9886831
Update CI workflows for build-time libbson checkout
blink1073 cdace52
Set both libbson include dirs so #include <bson/...> resolves
blink1073 e302ffc
Update docs for build-time libbson checkout
blink1073 a2ed673
Run CodeQL on the master branch
blink1073 e7acce1
Build libbson via CMake FetchContent instead of an install-time script
blink1073 70913a7
Add bump-libbson.sh to bump libbson and refresh README benchmark
blink1073 ea1f780
Detect latest mongo-c-driver and bail when libbson is current
blink1073 f3d7ce6
Update README for FetchContent build and bump libbson to 2.5.3
blink1073 714a1f4
Move build helpers into scripts/ and split bump-libbson Python into a…
blink1073 c5a0b40
Disable libmongoc in the CMake build and fix bump-libbson nits
blink1073 10d786b
Bump minimum supported Python to 3.11
blink1073 6525544
Build the extension as a Stable ABI module so abi3 wheels work everyw…
blink1073 84b95aa
Fetch mongo-c-driver via a shallow git clone for resilient downloads
blink1073 6d4986f
Add ccache to CI to speed up the repeated libbson build
blink1073 f67f86b
Build the wheel once per platform and test it against every Python ve…
blink1073 8a7e298
Fix zizmor findings in workflow changes
blink1073 0479548
Split the build into per-platform jobs so tests don't wait on each other
blink1073 5432797
Report ccache statistics after each wheel build
blink1073 9ecd0ef
Build in a deterministic directory so ccache hits across CI runs
blink1073 53d799c
Fetch mongo-c-driver from a retryable tarball instead of a git clone
blink1073 281c020
Only use ccache as the compiler launcher on GNU/Clang platforms
blink1073 9d4636d
Do not install ccache on Windows builds
blink1073 ffc7425
Make the mongo-c-driver download robust against CI stalls
blink1073 36d30aa
Normalize Windows paths for the cached mongo-c-driver archive
blink1073 aeb1858
Pre-fetch the mongo-c-driver tarball and fail fast if it's unavailable
blink1073 50ec861
Instrument the mongo-c-driver fetch and FetchContent with timing markers
blink1073 2fc905d
Build wheels with --no-build-isolation to rule out isolation overhead
blink1073 06512e6
Build only libbson: apply the minimal-build options before FetchContent
blink1073 67634c7
Exclude the workspace from Defender to speed up MSVC compilation
blink1073 e3e232d
Add a toolchain-detection step to confirm MSVC vs MinGW on runners
blink1073 8279038
Force MSVC in the Windows wheel build (was defaulting to MinGW)
blink1073 4868f00
Build libbson via meson-python instead of scikit-build-core
blink1073 8bb5846
Fix Linux and Windows builds of the Meson migration
blink1073 421bdfb
Fix action.yml YAML: extract mongo-c-driver with a one-line python call
blink1073 b060c0f
extract mongo-c-driver without python -c '--' (sys.argv[1] became '--')
blink1073 cf58640
Build Windows wheels on the windows-2022 runner (VS 2022/MSVC 17.x)
blink1073 59a71bd
Skip ccache setup on the Windows build job
blink1073 f5c3698
Link ws2_32 as an import library on Windows
blink1073 84c3663
Drop dead CMake build; point version tooling at meson.build
blink1073 1c90473
Address code review: bootstrap the sdist and wire CodeQL to Meson
blink1073 f8d0dca
Build 64-bit Windows wheels only
blink1073 b0586a8
Run the Python Dist Windows build on windows-2022
blink1073 73fa85c
Skip ccache setup on the dist Windows build
blink1073 fb2e873
Define _DEFAULT_SOURCE for the Linux build
blink1073 174cd9a
Define _XOPEN_SOURCE=700 for the Linux build
blink1073 c6c8583
Restore the 32-bit Windows wheel build
blink1073 3532a17
Fix zizmor findings in the workflows
blink1073 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
| - 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/**' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.