Skip to content

Build the release artifacts #33

Build the release artifacts

Build the release artifacts #33

# Build all the artifacts for a release (i.e. the source distribution file and the various wheels)
# 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
# https://cibuildwheel.readthedocs.io/en/stable/options/#options-summary
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.1.1
- 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@v4.3.0
with:
name: sdist__${{ github.sha }}
path: ./dist/*.gz
build_windows_wheels:
name: Build wheels on Windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v4.1.1
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_ARCHS_WINDOWS: "AMD64 x86"
# AMD64 and Intel32 wheels, but not ARM64 (yet)
CIBW_BUILD: "cp*-win_amd64* cp*-win32*"
- name: Upload wheels
uses: actions/upload-artifact@v4.3.0
with:
name: wheels_windows__${{ github.sha }}
path: ./wheelhouse/*.whl
build_ubuntu_wheels:
name: Build wheels on Ubuntu
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4.1.1
- name: Set up QEMU
# QEMU is needed for Linux aarch64 wheels
uses: docker/setup-qemu-action@v3.0.0
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
# 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
# Intel64 and aarch64 wheels, but not i686 or musllinux (yet)
CIBW_BUILD: "cp*-manylinux_x86_64* cp*-manylinux_aarch64*"
# 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}
- name: Upload wheels
uses: actions/upload-artifact@v4.3.0
with:
name: wheels_ubuntu__${{ github.sha }}
path: ./wheelhouse/*.whl
build_macos_x86_wheels:
name: Build wheels on macOS x86_64
# macos-12 is an Intel x86 runner
runs-on: macos-12
steps:
- uses: actions/checkout@v4.1.1
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
# https://cibuildwheel.readthedocs.io/en/stable/options/#options-summary
env:
CIBW_ARCHS_MACOS: x86_64
CIBW_BUILD: "cp*macosx_x86_64*"
# suppress the inclusion of the unixODBC dynamic libraries by disabling the repair command
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
- name: Upload wheels
uses: actions/upload-artifact@v4.3.0
with:
name: wheels_macos_x86__${{ github.sha }}
path: ./wheelhouse/*.whl
build_macos_arm64_wheels:
name: Build wheels on macOS ARM64
# macos-14 is an ARM64 (M1) runner
runs-on: macos-14
steps:
- uses: actions/checkout@v4.1.1
- name: Install unixODBC
# unixODBC is necessary for the SQL C header files, e.g. sql.h, but doesn't appear
# to be pre-installed on macos-14, hence make sure it really is installed
run: brew install unixodbc
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
# https://cibuildwheel.readthedocs.io/en/stable/options/#options-summary
env:
CIBW_ARCHS_MACOS: arm64
CIBW_BUILD: "cp*macosx_arm64*"
# suppress the inclusion of the unixODBC dynamic libraries by disabling the repair command
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
- name: Upload wheels
uses: actions/upload-artifact@v4.3.0
with:
name: wheels_macos_arm64__${{ github.sha }}
path: ./wheelhouse/*.whl