-
Notifications
You must be signed in to change notification settings - Fork 17
INTPYTHON-589 Add automated release support for pymongoarrow #293
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
Changes from 5 commits
ef3bdb2
25b3434
28abb2c
76714cf
2e91d73
54185ba
de475bd
c603f8a
b20a615
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| name: Python Dist | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "[0-9]+.[0-9]+.[0-9]+" | ||
| - "[0-9]+.[0-9]+.[0-9]+.post[0-9]+" | ||
| - "[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+" | ||
| - "[0-9]+.[0-9]+.[0-9]+rc[0-9]+" | ||
| workflow_dispatch: | ||
| pull_request: | ||
| workflow_call: | ||
| inputs: | ||
| ref: | ||
| required: true | ||
| type: string | ||
|
|
||
| concurrency: | ||
| group: dist-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: ./bindings/python | ||
| shell: bash -eux {0} | ||
|
|
||
| jobs: | ||
| build_wheels: | ||
| name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }} | ||
| runs-on: ${{ matrix.buildplat[0] }} | ||
| strategy: | ||
| # Ensure that a wheel builder finishes even if another fails | ||
| fail-fast: false | ||
| matrix: | ||
| # Github Actions doesn't support pairing matrix values together, let's improvise | ||
| # https://github.com/github/feedback/discussions/7835#discussioncomment-1769026 | ||
| buildplat: | ||
| - [ubuntu-24.04, manylinux_x86_64] | ||
| - [ubuntu-24.04, manylinux_aarch64] | ||
| - [macos-14, macosx_*] | ||
| - [windows-2019, win_amd64] | ||
| python: ["cp39", "cp310", "cp311", "cp312", "cp313"] | ||
| exclude: | ||
| - buildplat: [macos-14, macosx_*] | ||
| python: "cp39" | ||
| include: | ||
| - buildplat: [macos-13, macosx_*] | ||
| python: "cp39" | ||
|
|
||
| steps: | ||
| - name: Checkout pymongoarrow | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up python version | ||
| run: | | ||
| export PYTHON_VERSION=$(sed 's/^cp3/3./' <<< ${{ matrix.python }} ) | ||
| echo "PYTHON_VERSION=$PYTHON_VERSION" >> $GITHUB_ENV | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{env.PYTHON_VERSION}} | ||
| cache: 'pip' | ||
| cache-dependency-path: 'bindings/python/pyproject.toml' | ||
| allow-prereleases: true | ||
|
|
||
| - name: Set up QEMU | ||
| if: matrix.buildplat[1] == 'manylinux_aarch64' | ||
| uses: docker/setup-qemu-action@v3 | ||
| with: | ||
| # setup-qemu-action by default uses `tonistiigi/binfmt:latest` image, | ||
| # which is out of date. This causes seg faults during build. | ||
| # Here we manually fix the version. | ||
| image: tonistiigi/binfmt:qemu-v8.1.5 | ||
| platforms: arm64 | ||
|
|
||
| - name: Install pkg-config on MacOS | ||
| if: runner.os == 'macOS' | ||
| run: brew install pkg-config | ||
|
|
||
| - name: Install cibuildwheel | ||
| run: python -m pip install "cibuildwheel>=2.4,<3" | ||
|
|
||
| - name: Build MacOS Py39 Wheels | ||
| if: ${{ matrix.python == 'cp39' && matrix.buildplat[0] == 'macos-11' }} | ||
| env: | ||
| MACOS_TEST_SKIP: "*arm64" | ||
| CIBW_BUILD: cp39-macosx_* | ||
| MACOSX_DEPLOYMENT_TARGET: "10.14" | ||
| run: python -m cibuildwheel --output-dir wheelhouse | ||
|
|
||
| - name: Build wheels | ||
| if: ${{ matrix.buildplat[0] != 'macos-11' }} | ||
| env: | ||
| CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} | ||
| MACOSX_DEPLOYMENT_TARGET: "12.0" | ||
| run: python -m cibuildwheel --output-dir wheelhouse | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }} | ||
| path: ./bindings/python/wheelhouse/*.whl | ||
| if-no-files-found: error | ||
|
||
|
|
||
| make_sdist: | ||
| name: Make SDist | ||
| runs-on: macos-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| # Build sdist on lowest supported Python | ||
| python-version: '3.9' | ||
|
|
||
| - name: Install tox | ||
| run: | | ||
| python -m pip install tox | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we planning to standardize all our projects to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally yes. 😄
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you open a ticket to track that work?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| - name: Build SDist | ||
| working-directory: ./bindings/python | ||
| run: | | ||
| set -ex | ||
| export LIBBSON_INSTALL_DIR="$(pwd)/libbson" | ||
| tox -e build-libbson | ||
| tox -e build-dist -- --sdist | ||
| - name: Test Sdist | ||
| working-directory: ./bindings/python | ||
| run: | | ||
| export LIBBSON_INSTALL_DIR="$(pwd)/libbson" | ||
| python -m pip install dist/*.gz | ||
| cd .. | ||
| python -c "from pymongoarrow.lib import libbson_version" | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: "sdist" | ||
| path: ./bindings/python/dist/*.tar.gz | ||
|
||
|
|
||
| collect_dist: | ||
| runs-on: ubuntu-latest | ||
| needs: [build_wheels, make_sdist] | ||
| name: Download Wheels | ||
| steps: | ||
| - name: Download all workflow run artifacts | ||
| uses: actions/download-artifact@v4 | ||
| - name: Flatten directory | ||
| working-directory: . | ||
| run: | | ||
| find . -mindepth 2 -type f -exec mv {} . \; | ||
| find . -type d -empty -delete | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: all-dist-${{ github.run_id }} | ||
| path: "./*" | ||
Uh oh!
There was an error while loading. Please reload this page.