Skip to content

build pycddlib wheels #21

build pycddlib wheels

build pycddlib wheels #21

name: build pycddlib wheels
on:
workflow_dispatch:
jobs:
build_wheel:
strategy:
fail-fast: false
matrix:
os: [
"windows-latest",
"ubuntu-22.04",
"macos-14", # macOS arm64
"macos-13", # macOS x86_64
]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
repository: mcmtroffaes/pycddlib
ref: 3.0.2
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Set up Python
run: uv python install 3.12
- name: Install Python dependencies
run: uv venv && uv pip install cibuildwheel
- name: Build wheel (Linux)
if: matrix.os == 'ubuntu-22.04'
run: source .venv/bin/activate && python -m cibuildwheel --output-dir dist
env:
CIBW_PLATFORM: linux
CIBW_BUILD: cp312-*
CIBW_BEFORE_ALL: yum install -y curl zip unzip tar && git clone https://github.com/Microsoft/vcpkg.git && ./vcpkg/bootstrap-vcpkg.sh && ./vcpkg/vcpkg install cddlib
CIBW_ENVIRONMENT: CFLAGS="-I./vcpkg/installed/x64-linux/include" LDFLAGS="-L./vcpkg/installed/x64-linux/lib"
- name: Install dependencies (macOS)
if: matrix.os == 'macos-13' || matrix.os == 'macos-14'
run: brew install cddlib gmp
- name: Build wheel (macOS 13)
if: matrix.os == 'macos-13'
run: source .venv/bin/activate && python -m cibuildwheel --output-dir dist
env:
CIBW_PLATFORM: macos
CIBW_BUILD: cp312-*
CIBW_ENVIRONMENT: CFLAGS="-I$(brew --prefix)/include -L$(brew --prefix)/lib" MACOSX_DEPLOYMENT_TARGET=13.0
- name: Build wheel (macOS 14)
if: matrix.os == 'macos-14'
run: source .venv/bin/activate && python -m cibuildwheel --output-dir dist
env:
CIBW_PLATFORM: macos
CIBW_BUILD: cp312-*
CIBW_ENVIRONMENT: CFLAGS="-I$(brew --prefix)/include -L$(brew --prefix)/lib" MACOSX_DEPLOYMENT_TARGET=14.0
- name: Download pre-built wheel from PyPI (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$uri = 'https://files.pythonhosted.org/packages/95/5f/2c75a27084adccb3312d9db9046daa2e82e6918e40835008122e6edead10/pycddlib-3.0.2-cp312-cp312-win_amd64.whl'
New-Item -ItemType Directory -Force -Path dist | Out-Null
$out = 'dist/pycddlib-3.0.2-cp312-cp312-win_amd64.whl'
Invoke-WebRequest -Uri $uri -OutFile $out -UseBasicParsing
if (-not (Test-Path $out)) { throw "Download failed: file not found at $out" }
- name: Release current commit
uses: ncipollo/release-action@v1.18.0
with:
artifacts: "dist/*.whl"
tag: "pycddlib_wheels"
name: "pycddlib_wheels"
removeArtifacts: false
allowUpdates: true
replacesArtifacts: true
makeLatest: false