Skip to content

Build OCP with pypi VTK V2 #257

Build OCP with pypi VTK V2

Build OCP with pypi VTK V2 #257

Workflow file for this run

name: Build OCP with pypi VTK V2
on: workflow_dispatch
# on:
# push:
# branches:
# - v7.9
env:
OCP: 7.9.2.0
WHEEL: 7.9.2.0.dev0
VTK: 9.5.2
VTK_MAJOR: 9.5
OCCT: 7.9.2
PYBIND11: 2.13
PYWRAP: false
# OCP source download URL (default: https://github.com/CadQuery/OCP/releases/download)
SOURCE_URL: https://github.com/bernhard-42/__temp_artefacts__/releases/download
RELEASE_TO_REPO: false
jobs:
# ================================================================================
# Build SDKs for OCCT and VTK
# ================================================================================
sdks-ubuntu:
name: Build OCCT SDK for ${{ matrix.python-version }} on ${{ matrix.os }} (${{ matrix.use-vtk }})
runs-on: ${{ matrix.runner }}
container:
image: ubuntu:20.04
options: --name ci-ubuntu-20 # needed for manylinux_2_31
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "ubuntu-22.04-arm"]
python-version: [
# "3.10",
# "3.11",
# "3.12",
"3.13",
"3.14"
]
use-vtk: ["vtk", "novtk"]
exclude:
- python-version: "3.14"
use-vtk: "vtk"
include:
- os: "ubuntu-22.04"
runner: ubuntu-latest
- os: "ubuntu-22.04-arm"
runner: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Build SDKs
id: build-sdks
uses: ./.github/actions/build-sdks
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
use-vtk: ${{ matrix.use-vtk }}
vtk-libs: "libvtk*.so"
vtk-suffix: "/vtk-${{ env.VTK_MAJOR }}/"
vtk-prefix: ""
shells: "bash"
sdks-win-mac:
name: Build OCCT SDK for ${{ matrix.python-version }} on ${{ matrix.os }} (${{ matrix.use-vtk }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-15-intel", "macos-15", "windows-2022"]
python-version: [
# "3.10",
# "3.11",
# "3.12",
"3.13",
"3.14"
]
use-vtk: ["vtk", "novtk"]
exclude:
- python-version: "3.14"
use-vtk: "vtk"
include:
- os: "macos-15"
vtk-libs: ".dylibs/libvtk*.dylib"
vtk-suffix: "/"
vtk-prefix: ""
shells: "bash"
- os: "macos-15-intel"
vtk-libs: ".dylibs/libvtk*.dylib"
vtk-suffix: "/"
vtk-prefix: ""
shells: "bash"
- os: "windows-2022"
vtk-libs: "vtk*.dll"
vtk-suffix: "/"
vtk-prefix: "Library/"
shells: "bash cmd.exe"
steps:
- uses: actions/checkout@v4
- name: Build SDKs
id: build-sdks
uses: ./.github/actions/build-sdks
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
use-vtk: ${{ matrix.use-vtk }}
vtk-libs: ${{ matrix.vtk-libs }}
vtk-suffix: ${{ matrix.vtk-suffix }}
vtk-prefix: ${{ matrix.vtk-prefix }}
shells: ${{ matrix.shells }}
# ================================================================================
# Generate OCP sources
# This follows exactly the azure pipeline defined in the OCP repo and uses a
# micromamba env based approach for all packages.
# ================================================================================
sources-ubuntu:
name: Build OCP source on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
container:
image: ubuntu:20.04
options: --name ci-ubuntu-20 # needed for manylinux_3_31
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04"]
python-version: ["3.13"]
steps:
- uses: actions/checkout@v4
- name: Build or download OCP Source
id: build-ocp-source
uses: ./.github/actions/build-ocp-source
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
sources-win-mac:
name: Build OCP source on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-15", "windows-2022"]
python-version: ["3.13"]
steps:
- uses: actions/checkout@v4
- name: Build or download OCP Source
id: build-ocp-source
uses: ./.github/actions/build-ocp-source
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
# ================================================================================
# Build OCP proxy
# ================================================================================
ocp-proxy:
name: Build OCP proxy for ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [
# "3.10",
# "3.11",
# "3.12",
"3.13",
"3.14"
]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
# Create & activate a venv for you
activate-environment: true
- name: Build OCP proxy
shell: bash -l {0}
run: |
cd cadquery_ocp_proxy
# Patch version from env.WHEEL
sed -i.bak 's/^version = .*/version = "${{ env.WHEEL }}"/' pyproject.toml
echo "# Don't edit, will be overwritten during build" > src/cadquery_ocp_proxy/_version.py
echo "__version__ = \"${{ env.WHEEL }}\"" >> src/cadquery_ocp_proxy/_version.py
uv build
- name: Upload cadquery_ocp_proxy wheel
uses: actions/upload-artifact@v4
with:
name: cadquery-ocp-proxy-${{ env.WHEEL }}-cp-${{ matrix.python-version }}
path: cadquery_ocp_proxy/dist/*.whl
# ================================================================================
# Build OCP
# ================================================================================
ocp-ubuntu:
name: Build OCP for ${{ matrix.python-version }} on ${{ matrix.os }} (${{ matrix.use-vtk }})
runs-on: ${{ matrix.runner }}
container:
image: ubuntu:20.04
options: --name ci-ubuntu-20 # needed for manylinux_2_31
needs: [sdks-ubuntu, sources-ubuntu, ocp-proxy]
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "ubuntu-22.04-arm"]
python-version: [
# "3.10",
# "3.11",
# "3.12",
"3.13",
"3.14"
]
use-vtk: ["vtk", "novtk"]
exclude:
- python-version: "3.14"
use-vtk: "vtk"
include:
- os: "ubuntu-22.04"
runner: ubuntu-latest
plat: manylinux_2_31_x86_64
- os: "ubuntu-22.04-arm"
runner: ubuntu-24.04-arm
plat: manylinux_2_31_aarch64
steps:
- uses: actions/checkout@v4
- name: Build OCP
id: build-ocp
uses: ./.github/actions/build-ocp
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
use-vtk: ${{ matrix.use-vtk }}
shells: "bash"
delocate: auditwheel patchelf
plat: ${{ matrix.plat }}
module: "OCP.*.so"
env: "DUMMY=0"
ocp-source-tag: "ubuntu-22.04"
ocp-win-mac:
name: Build OCP for ${{ matrix.python-version }} on ${{ matrix.os }} (${{ matrix.use-vtk }})
runs-on: ${{ matrix.os }}
needs: [sdks-win-mac, sources-win-mac, ocp-proxy]
strategy:
fail-fast: false
matrix:
os: ["macos-15-intel", "macos-15", "windows-2022"]
python-version: [
# "3.10",
# "3.11",
# "3.12",
"3.13",
"3.14"
]
use-vtk: ["vtk", "novtk"]
exclude:
- python-version: "3.14"
use-vtk: "vtk"
include:
- os: "macos-15"
delocate: delocate
plat: macosx_11_1_arm64
module: "OCP.*.so"
env: "MACOSX_DEPLOYMENT_TARGET=11.1"
shells: "bash"
ocp-source-tag: "macos-15"
- os: "macos-15-intel"
delocate: delocate
plat: macosx_11_1_x86_64
module: "OCP.*.so"
env: "MACOSX_DEPLOYMENT_TARGET=11.1"
shells: "bash"
ocp-source-tag: "macos-15"
- os: "windows-2022"
delocate: delvewheel
plat: win_amd64
shells: "bash cmd.exe"
module: "OCP.*.pyd"
ocp-source-tag: "windows-2022"
steps:
- uses: actions/checkout@v4
- name: Build OCP
id: build-ocp
uses: ./.github/actions/build-ocp
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
use-vtk: ${{ matrix.use-vtk }}
shells: ${{ matrix.shells }}
delocate: ${{ matrix.delocate }}
plat: ${{ matrix.plat }}
module: ${{ matrix.module }}
env: ${{ matrix.env }}
ocp-source-tag: ${{ matrix.ocp-source-tag }}
# ================================================================================
# Tests
# ================================================================================
tests:
name: Test OCP on ${{ matrix.os }} for Python ${{ matrix.python-version }} with ${{ matrix.use-vtk }}
runs-on: ${{ matrix.runner }}
needs: [ocp-ubuntu, ocp-win-mac]
strategy:
fail-fast: false
matrix:
os:
[
"macos-15-intel",
"macos-15",
"ubuntu-22.04",
"ubuntu-22.04-arm",
"windows-2022",
]
python-version: [
# "3.10",
# "3.11",
# "3.12",
"3.13",
"3.14"
]
use-vtk: ["vtk", "novtk"]
exclude:
- python-version: "3.14"
use-vtk: "vtk"
include:
- os: "macos-15-intel"
runner: macos-15-intel
- os: "macos-15"
runner: macos-15
- os: "ubuntu-22.04"
runner: ubuntu-22.04
- os: "ubuntu-22.04-arm"
runner: ubuntu-24.04-arm
- os: "windows-2022"
runner: windows-2022
steps:
- uses: actions/checkout@v4
- name: Test OCP
id: test-ocp
uses: ./.github/actions/test-ocp
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
use-vtk: ${{ matrix.use-vtk }}
# ================================================================================
# Release wheels to repo
# ================================================================================
release:
name: Release wheels to repo
runs-on: ubuntu-latest
needs: [tests]
steps:
- uses: actions/checkout@v4
if: env.RELEASE_TO_REPO == 'true'
- name: Download all wheel artifacts
if: env.RELEASE_TO_REPO == 'true'
uses: actions/download-artifact@v4
with:
path: wheels
pattern: cadquery-*
merge-multiple: true
- name: Create release
if: env.RELEASE_TO_REPO == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.WHEEL }}
name: Release ${{ env.WHEEL }}
files: wheels/*.whl
fail_on_unmatched_files: true