PYTHON-4168 [python-bsonjs] Release 0.4 #94
Workflow file for this run
This file contains 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
name: Python Wheels | |
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]+" | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: wheels-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build_wheels: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, windows-2019, ubuntu-latest] | |
name: Build CPython ${{ matrix.python-version }}-${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pypa/cibuildwheel@v2.11.2 | |
env: | |
CIBW_ARCHS_MACOS: x86_64 universal2 | |
CIBW_TEST_SKIP: '*universal2:arm64' | |
CIBW_BUILD: "cp37-macosx_x86_64 cp38-macosx_universal2 cp37-win* cp37-manylinux_{x86_64,i686}" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: python_bsonjs-3.7-${{ matrix.os }}-wheel | |
path: ./wheelhouse/*.whl | |
if-no-files-found: error | |
test_non_linux_wheels: | |
needs: build_wheels | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, windows-2019] | |
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"] | |
name: Test CPython ${{ matrix.python-version }}-${{ matrix.os }} | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Download a previously created wheel | |
uses: actions/download-artifact@v2 | |
with: | |
name: python_bsonjs-3.7-${{ matrix.os }}-wheel | |
- name: Test wheel | |
shell: bash | |
run: | | |
python -m pip install -U pip | |
python -m pip install --no-index --find-links=./ python_bsonjs | |
python -m pip list | grep python-bsonjs | |
python -c "from bsonjs import dumps" | |
# Linux | |
test_manylinux_wheels: | |
runs-on: ${{ matrix.os }} | |
needs: build_wheels | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
container: ['manylinux2014_i686', 'manylinux2014_x86_64'] | |
python-version: ['cp37-cp37m', 'cp38-cp38', | |
'cp39-cp39', 'cp310-cp310', 'cp311-cp311', 'cp312-cp312'] | |
name: Test CPython ${{ matrix.python-version }}-${{ matrix.container }} | |
steps: | |
- name: Download a previously created wheel | |
uses: actions/download-artifact@v2 | |
with: | |
name: python_bsonjs-3.7-${{ matrix.os }}-wheel | |
- name: Test wheel | |
run: | | |
docker run --rm --volume `pwd`:/python quay.io/pypa/${{ matrix.container }} /bin/bash -c "/opt/python/${{ matrix.python-version }}/bin/python -m pip install -U pip && /opt/python/${{ matrix.python-version }}/bin/python -m pip install --find-links=/python/ --no-index python_bsonjs && /opt/python/${{ matrix.python-version }}/bin/python -m pip list | grep python-bsonjs && /opt/python/${{ matrix.python-version }}/bin/python -c 'from bsonjs import dumps'" | |
make_sdist: | |
name: Make SDist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- name: Build SDist | |
run: | | |
python -m pip install build | |
python -m build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: "sdist" | |
path: 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@v3 | |
- name: Flatten directory | |
working-directory: . | |
run: | | |
find . -mindepth 2 -type f -exec mv {} . \; | |
find . -type d -empty -delete | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: all-dist-${{ github.head_ref || github.ref_name }} | |
path: "./*" | |
publish: | |
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#publishing-the-distribution-to-pypi | |
needs: [collect_dist] | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
environment: release | |
permissions: | |
id-token: write | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: all-dist-${{ github.head_ref || github.ref_name }} | |
path: dist/ | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |