Skip to content

CI: build sdist and wheels (Linux & MacOS) #31

CI: build sdist and wheels (Linux & MacOS)

CI: build sdist and wheels (Linux & MacOS) #31

Workflow file for this run

name: Build and publish
on:
# trigger action from GitHub GUI (testing, no publish)
workflow_dispatch:
release:
types:
- published
pull_request: # also build on PRs touching this file
paths:
- ".github/workflows/release.yml"
- "MANIFEST.in"
- "pyproject.toml"
- "setup.py"
jobs:
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: release-sdist
path: ./dist/*
- name: Check metadata
run: pipx run twine check dist/*
build_wheels:
name: Build binary wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
ABSL_VERSION: "20240722.0"
S2GEOMETRY_VERSION: "0.11.1"
S2GEOGRAPHY_VERSION: "0.1.2"
CXX_STANDARD: 17
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: x86_64
# - os: windows-2019
# arch: x86
# msvc_arch: x86
# - os: windows-2019
# arch: AMD64
# msvc_arch: x64
- os: macos-13
arch: x86_64
cmake_osx_architectures: x86_64
- os: macos-14
arch: arm64
cmake_osx_architectures: arm64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache 3rd-party install directory
id: cache-build
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/3rd-party/dist
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ env.ABSL_VERSION }}-${{ env.S2GEOMETRY_VERSION }}-${{ env.S2GEOGRAPHY_VERSION }}-${{ hashFiles('ci/*') }}
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_SKIP: cp36-* pp* *musllinux* *-manylinux_i686
CIBW_TEST_SKIP: "cp38-macosx_arm64"
CIBW_ENVIRONMENT_LINUX:
DEPENDENCIES_DIR=/host${{ runner.temp }}/3rd-party
CMAKE_PREFIX_PATH=/host${{ runner.temp }}/3rd-party/dist
ABSL_VERSION=${{ env.ABSL_VERSION }}
S2GEOMETRY_VERSION=${{ env.S2GEOMETRY_VERSION }}
S2GEOGRAPHY_VERSION=${{ env.S2GEOGRAPHY_VERSION }}
CXX_STANDARD=${{ env.CXX_STANDARD }}
CIBW_ENVIRONMENT_MACOS:
PROJECT_DIR=${{ github.workspace }}
DEPENDENCIES_DIR=${{ runner.temp }}/3rd-party
CMAKE_PREFIX_PATH=${{ runner.temp }}/3rd-party/dist
ABSL_VERSION=${{ env.ABSL_VERSION }}
S2GEOMETRY_VERSION=${{ env.S2GEOMETRY_VERSION }}
S2GEOGRAPHY_VERSION=${{ env.S2GEOGRAPHY_VERSION }}
CXX_STANDARD=${{ env.CXX_STANDARD }}
MACOSX_DEPLOYMENT_TARGET=10.9
CMAKE_OSX_ARCHITECTURES='${{ matrix.cmake_osx_architectures }}'
CIBW_ENVIRONMENT_WINDOWS:
DEPENDENCIES_DIR='${{ runner.temp }}\3rd-party'
ABSL_VERSION=${{ env.ABSL_VERSION }}
S2GEOMETRY_VERSION=${{ env.S2GEOMETRY_VERSION }}
S2GEOGRAPHY_VERSION=${{ env.S2GEOGRAPHY_VERSION }}
CXX_STANDARD=${{ env.CXX_STANDARD }}
CIBW_BEFORE_ALL: ./ci/install_3rdparty.sh
CIBW_BEFORE_ALL_WINDOWS: ci\install_3rdparty.cmd
# CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel
CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'LD_LIBRARY_PATH=/host${{ runner.temp }}/3rd-party/dist/lib64 auditwheel repair -w {dest_dir} {wheel}'
CIBW_REPAIR_WHEEL_COMMAND_MACOS: 'DYLD_LIBRARY_PATH=${{ runner.temp }}/3rd-party/dist/lib delocate-wheel --require-archs=${{ matrix.arch }} -w {dest_dir} -v {wheel}'
# CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair --add-path ${{ runner.temp }}\geos-${{ env.GEOS_VERSION }}\bin -w {dest_dir} {wheel}
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: pytest spherely