Build the release artifacts #29
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
# Build all the artifacts for a release (i.e. the source distribution file and the various wheels) | |
name: Build the release artifacts | |
# include "workflow_dispatch" so this workflow can be run manually from the Actions portal | |
on: [workflow_dispatch] | |
jobs: | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip build | |
- name: Build sdist | |
run: python -m build --sdist --no-isolation | |
- name: Upload sdist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sdist_${{ github.sha }} | |
path: ./dist/*.gz | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job | |
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json | |
os: [windows-2019, macos-11, ubuntu-22.04] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
# QEMU is needed for Linux aarch64 wheels | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.15.0 | |
# https://cibuildwheel.readthedocs.io/en/stable/options/#options-summary | |
env: | |
# Windows - both 64-bit and 32-bit builds | |
CIBW_ARCHS_WINDOWS: "AMD64 x86" | |
# macOS | |
# | |
# At the time of this writing, Github actions still do not support ARM macs - all | |
# runners are Intel. You can cross-compile on Intel to ARM, however, which is good | |
# enough us. | |
# | |
# https://cibuildwheel.readthedocs.io/en/stable/faq/#how-to-cross-compile | |
CIBW_ARCHS_MACOS: x86_64 arm64 | |
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" | |
# Disable the inclusion of unixODBC dylibs because they will be *Intel* ones. | |
# Unfortunately, this means no one can use the ARM wheels right now. | |
# Linux - based on CentOS 7; glibc 64-bit builds only; no bundled libraries | |
# https://github.com/pypa/manylinux#docker-images | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_ARCHS_LINUX: x86_64 aarch64 | |
# this installs unixODBC 2.3.1 which is quite old but it has the latest ABI so should be fine | |
CIBW_BEFORE_ALL_LINUX: yum -y install unixODBC-devel | |
# the raw wheel filename is not PyPi compliant so the wheel must be repaired but | |
# suppress the addition of unixODBC libs to the wheel with --exclude's | |
CIBW_REPAIR_WHEEL_COMMAND_LINUX: | |
auditwheel repair | |
--exclude libodbc.so.2 | |
--exclude libltdl.so.7 | |
--wheel-dir {dest_dir} | |
{wheel} | |
# Build choices - disable musl Linux and PyPy builds | |
CIBW_SKIP: "*-musllinux_* pp*" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels_${{ github.sha }} | |
path: ./wheelhouse/*.whl |