CI: build sdist and wheels (Linux & MacOS) #10
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: 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-20.04 | |
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 Directory | |
id: cache-build | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/3rd-party | |
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ env.ABSL_VERSION }}-${{ env.S2GEOMETRY_VERSION }}-${{ env.S2GEOGRAPHY_VERSION }}-${{ hashFiles('ci/*') }} | |
- name: Fetch absl | |
if: steps.cache-build.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: abseil/abseil-cpp | |
ref: ${{ env.ABSL_VERSION }} | |
path: ${{ github.workspace }}/3rd-party/absl-src-${{ env.ABSL_VERSION }} | |
fetch-depth: 0 | |
- name: Fetch s2geometry | |
if: steps.cache-build.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: google/s2geometry | |
ref: v${{ env.S2GEOMETRY_VERSION }} | |
path: ${{ github.workspace }}/3rd-party/s2geometry-src-${{ env.S2GEOMETRY_VERSION }} | |
fetch-depth: 0 | |
- name: Fetch s2geography | |
if: steps.cache-build.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: paleolimbot/s2geography | |
ref: ${{ env.S2GEOGRAPHY_VERSION }} | |
path: ${{ github.workspace }}/3rd-party/s2geography-src-${{ env.S2GEOGRAPHY_VERSION }} | |
fetch-depth: 0 | |
- 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: | |
DEPENDENCIES_DIR=${{ github.workspace }}/3rd-party | |
ABSL_VERSION=${{ env.ABSL_VERSION }} | |
S2GEOMETRY_VERSION=${{ env.S2GEOMETRY_VERSION }} | |
S2GEOGRAPHY_VERSION=${{ env.S2GEOGRAPHY_VERSION }} | |
CXXSTANDARD=${{ env.CXXSTANDARD }} | |
CIBW_ENVIRONMENT_MACOS: | |
MACOSX_DEPLOYMENT_TARGET=10.9 | |
CMAKE_OSX_ARCHITECTURES='${{ matrix.cmake_osx_architectures }}' | |
CIBW_BEFORE_ALL: ./ci/install_3rdparty.sh | |
CIBW_BEFORE_ALL_WINDOWS: ci\install_geos.cmd | |
# CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel | |
# 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 . |