pylibCZIrw #37
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: pylibCZIrw | |
on: | |
workflow_dispatch: | |
inputs: | |
pylibczirwVersion: | |
description: "pylibCZIrw version" | |
required: true | |
default: "3.5.2" | |
cibwVersion: | |
description: "cibuildwheel version" | |
default: "2.16.2" | |
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 }} | |
PYLIBCZIRW_VERSION: ${{ inputs.pylibczirwVersion }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
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: Install cibuildwheel | |
run: python -m pip install cibuildwheel==${CIBW_VERSION} | |
- name: Fix cmake for Mac | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: | | |
sed -i '' 's/CMAKE_OSX_DEPLOYMENT_TARGET "10.9"/CMAKE_OSX_DEPLOYMENT_TARGET "12.0"/g' pylibCZIrw/CMakeLists.txt | |
sed -i '' 's/ENDIF(APPLE)/ set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Architectures for OS X" FORCE)\r\nENDIF(APPLE)/g' pylibCZIrw/CMakeLists.txt | |
- name: Build wheels | |
env: | |
CIBW_SKIP: "*-musllinux*" | |
CIBW_ARCHS_MACOS: "universal2" | |
CIBW_ARCHS_LINUX: "x86_64" | |
CIBW_ARCHS_WINDOWS: "AMD64" | |
run: | | |
cd pylibCZIrw | |
python -m cibuildwheel --output-dir wheelhouse | |
- name: Fix platform tags for Mac | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: | | |
for f in ./pylibCZIrw/wheelhouse/*.whl ; do mv $f ${f//macosx_12_0/macosx_10_9} ; done | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ./pylibCZIrw/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 |