Wheels #440
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: Wheels | |
on: | |
push: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
schedule: | |
# At 12:00 on every day-of-month | |
- cron: "0 12 */1 * *" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
env: | |
BLAZINGMQ_PYTHON_NO_PKGCONFIG: ’1’ | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-sdist | |
path: dist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: tests-sdist | |
path: tests | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: bin-sdist | |
path: bin | |
choose_architectures: | |
name: Decide which architectures to build wheels for | |
runs-on: ubuntu-latest | |
steps: | |
- id: x86_64 | |
run: echo "cibw_arch=x86_64" >> $GITHUB_OUTPUT | |
- id: aarch64 | |
if: github.event_name == 'release' && github.event.action == 'published' | |
run: echo "cibw_arch=aarch64" >> $GITHUB_OUTPUT | |
outputs: | |
cibw_arches: ${{ toJSON(steps.*.outputs.cibw_arch) }} | |
build_wheels: | |
needs: [build_sdist, choose_architectures] | |
name: Wheel for Linux-${{ matrix.cibw_python }}-${{ matrix.cibw_arch }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
cibw_python: | |
["cp39", "cp310", "cp311", "cp312"] | |
cibw_arch: ${{ fromJSON(needs.choose_architectures.outputs.cibw_arches) }} | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-sdist | |
path: dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: tests-sdist | |
path: tests | |
- uses: actions/download-artifact@v4 | |
with: | |
name: bin-sdist | |
path: bin | |
- uses: docker/setup-qemu-action@v3 | |
if: runner.os == 'Linux' | |
name: Set up QEMU | |
- name: Extract sdist | |
run: | | |
tar zxvf dist/*.tar.gz --strip-components=1 | |
- name: Disable ptrace security restrictions | |
run: | | |
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_ARCHS_LINUX: ${{ matrix.cibw_arch }} | |
CIBW_BUILD: ${{ matrix.cibw_python }}-* | |
CIBW_PRERELEASE_PYTHONS: True | |
CIBW_TEST_COMMAND: python3 -m pytest {project}/tests/unit | |
CIBW_TEST_REQUIRES: pytest mock pkgconfig | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-Linux-${{ matrix.cibw_python }}-${{ matrix.cibw_arch }} | |
path: ./wheelhouse/*.whl | |
build_wheels_macos: | |
needs: [build_sdist] | |
name: Wheel for MacOS-${{ matrix.cibw_python }}-${{ matrix.cibw_arch }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-14] | |
cibw_python: | |
["cp39", "cp310", "cp311", "cp312"] | |
cibw_arch: ["arm64"] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-sdist | |
path: dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: tests-sdist | |
path: tests | |
- uses: actions/download-artifact@v4 | |
with: | |
name: bin-sdist | |
path: bin | |
- name: Extract sdist | |
run: | | |
tar zxvf dist/*.tar.gz --strip-components=1 | |
- name: Sets env vars for compilation | |
if: matrix.cibw_arch == 'arm64' | |
run: | | |
echo "CFLAGS=-target arm64-apple-macos14" >> $GITHUB_ENV | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }} | |
CIBW_BUILD: ${{ matrix.cibw_python }}-* | |
CIBW_BUILD_VERBOSITY: 1 | |
CIBW_PRERELEASE_PYTHONS: True | |
CIBW_TEST_COMMAND: python3 -m pytest {project}/tests/unit | |
CIBW_TEST_REQUIRES: pytest mock pkgconfig | |
MACOSX_DEPLOYMENT_TARGET: "14.0" | |
MACOS_DEPLOYMENT_TARGET: "14.0" | |
SYSTEM_VERSION_COMPAT: 0 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-MacOS-${{ matrix.cibw_python }}-${{ matrix.cibw_arch }} | |
path: ./wheelhouse/*.whl | |
merge: | |
needs: [build_wheels, build_wheels_macos, build_sdist] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/upload-artifact/merge@v4 | |
with: | |
name: dist | |
pattern: dist-* | |
upload_pypi: | |
needs: merge | |
runs-on: ubuntu-latest | |
if: | | |
github.event_name == 'release' && github.event.action == 'published' | |
|| github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip_existing: true | |
password: ${{ secrets.PYPI_PASSWORD }} |