Skip to content

Update pylibczirw.yml #201

Update pylibczirw.yml

Update pylibczirw.yml #201

Workflow file for this run

name: pylibCZIrw
on:
push:
workflow_dispatch:
inputs:
pylibczirwVersion:
description: "pylibCZIrw version"
required: true
default: "4.1.3"
cibwVersion:
description: "cibuildwheel version"
default: "2.21.3"
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*"
CIBW_VERSION: ${{ inputs.cibwVersion || '2.18.1'}}
PYLIBCZIRW_VERSION: ${{ inputs.pylibczirwVersion || '4.1.1'}}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
fail-fast: false
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Download pylibCZIrw
run: |
curl -o pypi.json "https://pypi.org/pypi/pylibczirw/${PYLIBCZIRW_VERSION}/json"
URL=$(python -c "import json, sys; print([u for u in json.load(sys.stdin)['urls'] if u['url'].endswith('.tar.gz')][0]['url'])" < pypi.json)
curl -o pylibCZIrw.tar.gz $URL
tar -xvf pylibCZIrw.tar.gz
mv pylibCZIrw-${PYLIBCZIRW_VERSION} pylibCZIrw
- name: Patch to include Python3.12 in Linux
if: ${{ matrix.os == 'ubuntu-latest'}}
run: |
sed -i 's/python_requires=">=3.7,<3.12",/python_requires=">=3.7,<4",/g' pylibCZIrw/setup.py
- name: Patch to include Python3.12 in MacOS
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14'}}
run: |
sed -i '' 's/python_requires=">=3.7,<3.12",/python_requires=">=3.7,<4",/g' pylibCZIrw/setup.py
- name: Patch to include Python3.12 in Windows
if: ${{ matrix.os == 'windows-latest'}}
run: |
powershell -command "(Get-Content pylibCZIrw\\setup.py) -replace 'python_requires=\">=3.7,<3.12', 'python_requires=\">=3.7,<4' | Set-Content pylibCZIrw\\setup.py"
- name: Fix cmake and triplet for Mac Intel
if: ${{ matrix.os == 'macos-13'}}
run: |
sed -i '' 's/project(\(.*\))/project\(\1\)\n\nset(CMAKE_OSX_DEPLOYMENT_TARGET "12.0")\nset(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Architectures for OS X" FORCE)\n/g' pylibCZIrw/CMakeLists.txt
sed -i '' 's/x64-linux/x64-osx/g' pylibCZIrw/setup.py
- name: Fix cmake and triplet for Mac ARM
if: ${{matrix.os == 'macos-14'}}
run: |
sed -i '' 's/project(\(.*\))/project\(\1\)\n\nset(CMAKE_OSX_DEPLOYMENT_TARGET "14.0")\nset(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "Architectures for OS X" FORCE)\n/g' pylibCZIrw/CMakeLists.txt
sed -i '' 's/x64-linux/arm64-osx/g' pylibCZIrw/setup.py
- name: Install vcpkg on Mac
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14'}}
run: |
git clone https://github.com/microsoft/vcpkg
./vcpkg/bootstrap-vcpkg.sh
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
CIBW_ARCHS_MACOS: ${{ matrix.os == 'macos-13' && 'x86_64' || 'arm64' }}
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_WINDOWS: "AMD64"
CIBW_MANYLINUX_X86_64_IMAGE: "quay.io/pypa/manylinux2014_x86_64:2024.09.22-4"
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os == 'macos-13' && '12.0' || '14.0' }}
with:
package-dir: ./pylibCZIrw
output-dir: wheelhouse
config-file: "pyproject.toml"
- name: Fix platform tags for Mac
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14'}}
run: |
for f in ./wheelhouse/*.whl ; do mv $f ${f//macosx_12_0/macosx_10_9} ; done
- uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl
publish:
name: Publish wheels to pypi.scm.io
needs: [build_wheels]
runs-on: ubuntu-latest
steps:
- name: Get wheels
uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- name: Publish to pypy.scm.io
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_SCM_USERNAME }}
password: ${{ secrets.PYPI_SCM_PASSWORD }}
repository-url: https://pypi.scm.io/simple/
skip-existing: true