Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Build Python Dist

on:
workflow_dispatch:

jobs:
build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: windows-latest
- os: macos-15
deployment-target: '14.0'
- os: macos-15-intel
deployment-target: '13.0'

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Cache ITK build
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/itk-build
key: itk-5.4.5-${{ matrix.os }}
restore-keys: |
itk-5.4.5-${{ matrix.os }}

- name: Build ITK (macOS)
if: runner.os == 'macOS'
run: |
git clone --depth 1 --branch v5.4.5 https://github.com/InsightSoftwareConsortium/ITK.git /tmp/ITK
if [ ! -f ${{ github.workspace }}/itk-build/ITKConfig.cmake ]; then
cmake -S /tmp/ITK -B ${{ github.workspace }}/itk-build -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=OFF
cmake --build ${{ github.workspace }}/itk-build --parallel $(sysctl -n hw.ncpu)
fi

- name: Build ITK (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
git clone --depth 1 --branch v5.4.5 https://github.com/InsightSoftwareConsortium/ITK.git C:\ITK_src
if not exist "${{ github.workspace }}\itk-build\ITKConfig.cmake" (
cmake -S C:\ITK_src -B "${{ github.workspace }}\itk-build" -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -G "Visual Studio 17 2022" -A x64
cmake --build "${{ github.workspace }}\itk-build" --config Release --parallel
)

- name: Build wheels
uses: pypa/cibuildwheel@v3.4.0
env:
CIBW_BUILD: 'cp310-* cp311-* cp312-* cp313-* cp314-*'
CIBW_SKIP: '*-musllinux* *i686 *-win32'
CIBW_CONTAINER_ENGINE: "docker; create_args: --volume ${{ github.workspace }}/itk-build:/itk-build"
CIBW_BEFORE_ALL_LINUX: |
git clone --depth 1 --branch v5.4.5 https://github.com/InsightSoftwareConsortium/ITK.git /tmp/ITK
if [ ! -f /itk-build/ITKConfig.cmake ]; then
cmake -S /tmp/ITK -B /itk-build -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=OFF
cmake --build /itk-build --parallel $(nproc)
fi
CIBW_ENVIRONMENT_LINUX: ITK_DIR=/itk-build
CIBW_ENVIRONMENT_MACOS: ITK_DIR=${{ github.workspace }}/itk-build MACOSX_DEPLOYMENT_TARGET=${{ matrix.deployment-target }}
CIBW_ENVIRONMENT_WINDOWS: ITK_DIR='${{ github.workspace }}\itk-build' SKBUILD_BUILD_DIR='D:\b'

- uses: actions/upload-artifact@v6
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl

build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: actions/setup-python@v6
with:
python-version: '3.13'

- name: Install build
run: pip install build

- name: Build sdist
run: python -m build --sdist

- uses: actions/upload-artifact@v6
with:
name: sdist
path: dist/*.tar.gz

publish:
name: Publish to PyPI
needs: [build-wheels, build-sdist]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v8
with:
path: dist
pattern: '{wheels-*,sdist}'
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
99 changes: 0 additions & 99 deletions .github/workflows/linux.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .github/workflows/linux_build.sh

This file was deleted.

Loading