Skip to content

Commit 716181f

Browse files
ci: add release and continuous workflows
1 parent f907d61 commit 716181f

3 files changed

Lines changed: 229 additions & 0 deletions

File tree

.github/workflows/build-wheels.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: build-wheels
2+
description: Build Slicer Core and Slicer Core SDK for given platform
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
os:
8+
description: 'OS to run on, must be one of supported runner type'
9+
required: true
10+
type: string
11+
build-target:
12+
description: 'CIBW build target (e.g., cp310-manylinux_x86_64)'
13+
required: true
14+
type: string
15+
python-version:
16+
description: 'CIBW build target (e.g., 3.10)'
17+
required: true
18+
type: string
19+
platform-tag:
20+
description: 'Wheel platform tag to apply after building.'
21+
required: true
22+
type: string
23+
24+
jobs:
25+
build-test:
26+
runs-on: ${{ inputs.os }}
27+
28+
env:
29+
CIBW_BUILD: ${{ inputs.build-target }}
30+
# Install a compiler cache on each platform
31+
CIBW_BEFORE_ALL: "yum install -y mesa-libGL-devel glx-utils freeglut-devel"
32+
# Global test setup
33+
CIBW_TEST_REQUIRES: "pytest virtualenv"
34+
# Do not repair, everything is already put just as needed to make it work
35+
CIBW_REPAIR_WHEEL_COMMAND: "
36+
python -m pip install wheel &&
37+
python -m wheel tags --platform-tag ${{ inputs.platform-tag }} --remove {wheel} &&
38+
cp $(dirname {wheel})/slicer_core*.whl {dest_dir}"
39+
40+
steps:
41+
# Build and test wheels
42+
- uses: actions/checkout@v4
43+
44+
# This python is used to patch the project, not to build!
45+
- name: Set up Python
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: ${{ inputs.python-version }}
49+
50+
- name: Build wheel
51+
uses: pypa/cibuildwheel@v3.3.1
52+
env:
53+
CIBW_TEST_COMMAND: "python -m pytest {project}/LayerDM -m runtime --verbose"
54+
with:
55+
package-dir: LayerDM
56+
output-dir: wheelhouse
57+
58+
- name: Build wheel SDK
59+
uses: pypa/cibuildwheel@v3.3.1
60+
env:
61+
CIBW_TEST_COMMAND: "python -m pytest {project}/LayerDM -m sdk --verbose"
62+
with:
63+
package-dir: LayerDMSDK
64+
output-dir: wheelhouse
65+
66+
- name: Upload wheels
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: slicer_layer_md_sdk-${{ inputs.build-target }}
70+
path:
71+
wheelhouse/slicer_layer_md-*.whl
72+
wheelhouse/slicer_layer_md_sdk-*.whl

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI Slicer Core
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
7+
jobs:
8+
build-test:
9+
strategy:
10+
fail-fast: true
11+
matrix:
12+
os: [ubuntu-latest, windows-latest, macos-15]
13+
vtk-tag: ['9.6.0']
14+
py-abi: ['cp310']
15+
include:
16+
# Python version to install on host
17+
- py-abi: cp310
18+
python-version: '3.10'
19+
# OS name to ciwheelbuild platform name
20+
- os: ubuntu-latest
21+
platform-tag: manylinux_2_28_x86_64
22+
build-target: "manylinux_x86_64"
23+
- os: windows-latest
24+
platform-tag: win_amd64
25+
build-target: "win_amd64"
26+
- os: macos-15
27+
platform-tag: macosx_11_0_arm64
28+
build-target: "macosx_arm64"
29+
uses: ./.github/workflows/build-wheels.yml
30+
with:
31+
os: ${{ matrix.os }}
32+
build-target: ${{ matrix.py-abi }}-${{ matrix.build-target }}
33+
python-version: ${{ matrix.python-version }}
34+
platform-tag: ${{ matrix.platform-tag }}

.github/workflows/release.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Release
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
semantic-release:
7+
runs-on: ubuntu-latest
8+
environment:
9+
name: pypi
10+
url: https://pypi.org/p/trame-slicer
11+
permissions:
12+
id-token: write # IMPORTANT: mandatory for trusted publishing
13+
contents: write # IMPORTANT: mandatory for making GitHub Releases
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Python Semantic Release
22+
id: release
23+
uses: python-semantic-release/python-semantic-release@master
24+
with:
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
changelog: true
27+
build: false # build is too complex to be handled by semantic release
28+
29+
release-build:
30+
needs: [semantic-release]
31+
strategy:
32+
fail-fast: true
33+
matrix:
34+
os: [ubuntu-latest, windows-latest, macos-15]
35+
py-abi: ['cp310', 'cp311', 'cp312', 'cp313']
36+
include:
37+
# Python version to install on host
38+
- py-abi: cp310
39+
python-version: '3.10'
40+
- py-abi: cp311
41+
python-version: '3.11'
42+
- py-abi: cp312
43+
python-version: '3.12'
44+
- py-abi: cp313
45+
python-version: '3.13'
46+
# OS name to ciwheelbuild platform name
47+
- os: ubuntu-latest
48+
platform-tag: manylinux_2_28_x86_64
49+
build-target: "manylinux_x86_64"
50+
- os: windows-latest
51+
platform-tag: win_amd64
52+
build-target: "win_amd64"
53+
- os: macos-15
54+
platform-tag: macosx_11_0_arm64
55+
build-target: "macosx_arm64"
56+
uses: ./.github/workflows/build-wheels.yml
57+
with:
58+
os: ${{ matrix.os }}
59+
build-target: ${{ matrix.py-abi }}-${{ matrix.build-target }}
60+
python-version: ${{ matrix.python-version }}
61+
platform-tag: ${{ matrix.platform-tag }}
62+
63+
upload-pypi:
64+
name: Push runtime wheel on PyPi
65+
needs: [release-build]
66+
runs-on: ubuntu-latest
67+
environment:
68+
name: pypi
69+
url: https://pypi.org/p/slicer-layer-dm
70+
permissions:
71+
id-token: write # IMPORTANT: mandatory for trusted publishing
72+
contents: write # IMPORTANT: mandatory for making GitHub Releases
73+
74+
steps:
75+
- name: Checkout
76+
uses: actions/checkout@v4
77+
78+
- name: Download all wheel artifacts
79+
uses: actions/download-artifact@v4
80+
with:
81+
path: ./wheelhouse
82+
pattern: slicer_layer_dm-*
83+
merge-multiple: true # Flattens them into one directory
84+
85+
- name: Show downloaded wheels
86+
run: ls ./wheelhouse
87+
88+
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
89+
- name: Publish package distributions to PyPI
90+
uses: pypa/gh-action-pypi-publish@release/v1
91+
with:
92+
packages-dir: ./wheelhouse
93+
94+
upload-pypi-sdk:
95+
name: Push SDK wheel on PyPi
96+
needs: [release-build]
97+
runs-on: ubuntu-latest
98+
environment:
99+
name: pypi
100+
url: https://pypi.org/p/slicer-layer-dm-sdk
101+
permissions:
102+
id-token: write # IMPORTANT: mandatory for trusted publishing
103+
contents: write # IMPORTANT: mandatory for making GitHub Releases
104+
105+
steps:
106+
- name: Checkout
107+
uses: actions/checkout@v4
108+
109+
- name: Download all wheel artifacts
110+
uses: actions/download-artifact@v4
111+
with:
112+
path: ./wheelhouse
113+
pattern: slicer_layer_dm_sdk-*
114+
merge-multiple: true # Flattens them into one directory
115+
116+
- name: Show downloaded wheels
117+
run: ls ./wheelhouse
118+
119+
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
120+
- name: Publish package distributions to PyPI
121+
uses: pypa/gh-action-pypi-publish@release/v1
122+
with:
123+
packages-dir: ./wheelhouse

0 commit comments

Comments
 (0)