143 lines
4.3 KiB
YAML
143 lines
4.3 KiB
YAML
name: Build Wheels (cibuildwheel)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- develop
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
get_system_time:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
timestamp: ${{ steps.get_time.outputs.timestamp }}
|
|
steps:
|
|
- name: Get system time
|
|
id: get_time
|
|
run: echo "timestamp=$(date +'%Y%m%d%H%M')" >> "$GITHUB_OUTPUT"
|
|
|
|
build_wheels:
|
|
needs: get_system_time
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# Linux x86_64
|
|
- os: ubuntu-latest
|
|
python_version: "3.10"
|
|
cibw_python_version: 310
|
|
platform_id: manylinux_x86_64
|
|
manylinux_image: manylinux2014
|
|
- os: ubuntu-latest
|
|
python_version: "3.11"
|
|
cibw_python_version: 311
|
|
platform_id: manylinux_x86_64
|
|
manylinux_image: manylinux2014
|
|
- os: ubuntu-latest
|
|
python_version: "3.12"
|
|
cibw_python_version: 312
|
|
platform_id: manylinux_x86_64
|
|
manylinux_image: manylinux2014
|
|
- os: ubuntu-latest
|
|
python_version: "3.13"
|
|
cibw_python_version: 313
|
|
platform_id: manylinux_x86_64
|
|
manylinux_image: manylinux2014
|
|
|
|
# Linux aarch64
|
|
- os: ubuntu-24.04-arm
|
|
python_version: "3.10"
|
|
cibw_python_version: 310
|
|
platform_id: manylinux_aarch64
|
|
manylinux_image: manylinux2014
|
|
|
|
# MacOS x86_64
|
|
# - os: macos-13
|
|
# python_version: "3.10"
|
|
# cibw_python_version: 310
|
|
# platform_id: macosx_x86_64
|
|
# - os: macos-13
|
|
# python_version: "3.11"
|
|
# cibw_python_version: 311
|
|
# platform_id: macosx_x86_64
|
|
# - os: macos-13
|
|
# python_version: "3.12"
|
|
# cibw_python_version: 312
|
|
# platform_id: macosx_x86_64
|
|
# - os: macos-13
|
|
# python_version: "3.13"
|
|
# cibw_python_version: 313
|
|
# platform_id: macosx_x86_64
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python ${{ matrix.python_version }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python_version }}
|
|
|
|
- name: Set Develop Flag
|
|
run: |
|
|
echo "DEVELOP=1" >> $GITHUB_ENV
|
|
echo "TIMESTAMP=${{ needs.get_system_time.outputs.timestamp }}" >> $GITHUB_ENV
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
python3 -m pip install -r python/dev_requirements.txt
|
|
if [ "$RUNNER_OS" == "Linux" ]; then
|
|
sudo apt-get install -y wget libicu-dev python3-pip python3-setuptools libboost-all-dev ninja-build
|
|
elif [ "$RUNNER_OS" == "macOS" ]; then
|
|
brew install wget icu4c boost ninja python-setuptools
|
|
else
|
|
echo "$RUNNER_OS not supported"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Run CMake
|
|
run: |
|
|
cmake . -B build -DGTSAM_BUILD_PYTHON=1 -DGTSAM_PYTHON_VERSION=${{ matrix.python_version }}
|
|
|
|
- name: Build and test wheels
|
|
env:
|
|
CIBW_BUILD: cp${{ matrix.cibw_python_version }}-${{ matrix.platform_id }}
|
|
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
|
|
CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.manylinux_image }}
|
|
CIBW_ARCHS: all
|
|
CIBW_ENVIRONMENT_PASS_LINUX: DEVELOP TIMESTAMP
|
|
|
|
CIBW_BUILD_FRONTEND: "build"
|
|
CIBW_BEFORE_ALL: bash {project}/build_tools/wheels/cibw_before_all.sh ${{ matrix.python_version }} {project}
|
|
|
|
CIBW_BUILD_VERBOSITY: 1
|
|
|
|
run: bash build_tools/wheels/build_wheels.sh
|
|
|
|
- name: Store artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: cibw-wheels-cp${{ matrix.cibw_python_version }}-${{ matrix.platform_id }}
|
|
path: wheelhouse/*.whl
|
|
|
|
upload_all:
|
|
name: Upload All
|
|
needs: build_wheels
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
id-token: write
|
|
steps:
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: dist/
|
|
merge-multiple: true
|
|
|
|
- name: Publish to TestPyPI
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
verbose: true
|
|
packages-dir: dist/
|
|
repository-url: https://test.pypi.org/legacy/
|