Skip to content

v2.9a1.post12

v2.9a1.post12 #3168

Workflow file for this run

# SPDX-FileCopyrightText: 2024 Howetuft
#
# SPDX-License-Identifier: Apache-2.0
name: LuxCore Python wheels
on:
pull_request:
push:
branches:
- work
- cache
workflow_dispatch:
release:
types:
- published
jobs:
build_wheels:
name: Build wheel ${{ matrix.os }}-3.${{ matrix.python-minor }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-minor: [8, 9, 10, 11, 12, 13]
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
#python-minor: [ 12]
#os: [ubuntu-latest]
#python-minor: [ 11]
#os: [windows-latest]
exclude:
- os: macos-14
python-minor: 8
env:
# Reminder: report all variables here to CIBW_ENVIRONMENT_PASS_LINUX
GH_TOKEN: ${{ github.token }}
PYTHON_MINOR: ${{ matrix.python-minor }}
BOOST_INSTALL_LAYOUT: system
SPDLOG_FMT_EXTERNAL: on
# Versions
CXX_VERSION: 17
BOOST_VERSION: 1.84.0
OIIO_VERSION: 2.5.16.0
OCIO_VERSION: 2.4.0
OIDN_VERSION: 2.3.1
TBB_VERSION: 2021.12.0
OPENEXR_VERSION: 3.3.2
BLENDER_VERSION: 4.2.3
OPENVDB_VERSION: 11.0.0
SPDLOG_VERSION: 1.15.0
EMBREE3_VERSION: 3.13.5
FMT_VERSION: 11.0.2
steps:
- name: Configure git for long paths
shell: bash
if: runner.os == 'Windows'
run: git config --system core.longpaths true
- name: Checkout main repository (LuxCoreWheel)
uses: actions/checkout@v4
- name: Checkout LuxCoreRender
uses: actions/checkout@v4
with:
repository: LuxCoreRender/LuxCore
path: LuxCore
submodules: recursive
ref: luxcorerender-v2.9alpha1
- name: Find workspace
shell: bash
run: |
case ${{ runner.os }} in
Linux) _workspace="/project";;
Windows) _workspace=$(cygpath -u $GITHUB_WORKSPACE);;
macOS) _workspace="$GITHUB_WORKSPACE";;
*) echo "Unhandled os ${{ runner.os }}";exit 64;;
esac
echo "WORKSPACE=${_workspace}" >> "$GITHUB_ENV"
- name: Configure ccache
uses: actions/github-script@v7
with:
script: |
core.exportVariable('cache-variant', 'ccache')
core.exportVariable('CMAKE_CXX_COMPILER_LAUNCHER', 'ccache');
core.exportVariable('CMAKE_C_COMPILER_LAUNCHER', 'ccache');
core.exportVariable('CCACHE_CONFIGPATH', String.raw`${{ github.workspace }}/ccache.conf`);
core.exportVariable('CCACHE_DIR', String.raw`${{ github.workspace }}/.ccache`);
core.exportVariable('CCACHE_DEBUGDIR', String.raw`${{ github.workspace }}/ccache-debug`);
core.exportVariable('CCACHE_LOGFILE', String.raw`${{ github.workspace }}/ccache.log`);
- name: ccache
uses: hendrikmuhs/[email protected]
with:
create-symlink: false
variant: ${{ env.cache-variant }}
key: cpl-${{ matrix.os }}-${{ matrix.python-minor}}
restore-keys: cpl-${{ matrix.os }}-${{ matrix.python-minor}}-
max-size: 5G
verbose: 1
- name: Get cmake
if: runner.os == 'macOS' || runner.os == 'Windows'
uses: lukka/get-cmake@latest
- name: Install ISPC
if: runner.os == 'macOS' || runner.os == 'Windows'
uses: ispc/install-ispc-action@main
- name: Prepare msvc
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Set MacOS deployment target
if: runner.os == 'macOS'
uses: actions/github-script@v7
with:
script: |
if ('${{ runner.arch }}' == 'X64') {
target = '10.13';
arch='x86_64';
}
else if ('${{ env.PYTHON_MINOR }}' != '8') {
target = '11.0';
arch='armv8';
}
else {
target = '12.0';
arch='armv8';
}
core.exportVariable('MACOSX_DEPLOYMENT_TARGET', target);
core.exportVariable('PKG_ARCH', arch);
- name: Patch source tree
shell: bash
run: source $GITHUB_WORKSPACE/scripts/patch_source_tree.sh
- name: Retrieve cached dependencies
id: retrieve-cache-deps
uses: actions/cache/restore@v4
with:
path: conan-cache
key: deps-${{ matrix.os }}-${{ matrix.python-minor}}-
restore-keys: deps-${{ matrix.os }}-${{ matrix.python-minor}}-
# Build wheel
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD_FRONTEND: build
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: cp3${{ matrix.python-minor }}-*
CIBW_SKIP: "*musllinux*"
CIBW_ARCHS: auto64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_ENVIRONMENT: >
SKBUILD_CMAKE_ARGS='--preset conan-release;-G Ninja;--log-level=VERBOSE'
CIBW_ENVIRONMENT_PASS_LINUX: |
RUNNER_OS
RUNNER_ARCH
WORKSPACE
CMAKE_CXX_COMPILER_LAUNCHER
CMAKE_C_COMPILER_LAUNCHER
PYTHON_MINOR
BOOST_INSTALL_LAYOUT
SPDLOG_FMT_EXTERNAL
CXX_VERSION
BOOST_VERSION
OIIO_VERSION
OCIO_VERSION
OIDN_VERSION
TBB_VERSION
OPENEXR_VERSION
BLENDER_VERSION
OPENVDB_VERSION
SPDLOG_VERSION
EMBREE3_VERSION
FMT_VERSION
CIBW_BEFORE_ALL_LINUX: |
dnf config-manager --set-enabled powertools
dnf install -y epel-release
dnf install -y ninja-build bison flex wget ccache perl-IPC-Cmd perl-Digest-SHA
ccache --show-config
# Install git-lfs
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash
dnf install -y git-lfs
# Install ispc
# https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-linux/2023-0/yum-dnf-zypper.html
tee > /tmp/oneAPI.repo << EOF
[oneAPI]
name=Intel® oneAPI repository
baseurl=https://yum.repos.intel.com/oneapi
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
EOF
mv /tmp/oneAPI.repo /etc/yum.repos.d
dnf install -y intel-oneapi-ispc
source /opt/intel/oneapi/ispc/latest/env/vars.sh
# TODO
## Install Cuda
#dnf install -y --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E %rhel).noarch.rpm
#dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm
#subscription-manager repos --enable "codeready-builder-for-rhel-8-$(uname -m)-rpms"
#dnf install -y xorg-x11-drv-nvidia-470xx-cuda-libs
CIBW_BEFORE_ALL_MACOS: |
brew install bison flex ispc
CIBW_BEFORE_BUILD: bash ${{ env.WORKSPACE }}/scripts/install_conan.sh
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
TBB=/project/full_deploy/host/onetbb/$TBB_VERSION/Release/x86_64/lib
OIDN=/project/full_deploy/host/oidn/$OIDN_VERSION/Release/x86_64/lib
HWLOC=/project/full_deploy/host/hwloc/2.9.3/Release/x86_64/lib
LEVEL_ZERO=/project/full_deploy/host/level-zero/1.17.39/Release/x86_64/lib
LD_LIBRARY_PATH=$TBB:$HWLOC:$LEVEL_ZERO:$OIDN:$LD_LIBRARY_PATH
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH
auditwheel \
--verbose repair -w {dest_dir} {wheel} \
--strip
pip install wheel
WHEEL=$(ls -1 {dest_dir}/*.whl)
python ${{ env.WORKSPACE }}/scripts/recompose_wheel_linux.py -- $WHEEL
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: |
bash.exe ${{ env.WORKSPACE }}/scripts/repair_wheel_windows.sh '{wheel}' '{dest_dir}' '%VCToolsRedistDir%%Platform%'
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
cp {wheel} ${{ env.WORKSPACE }}
BASE=${{ env.WORKSPACE }}/full_deploy/host
TBB=$BASE/onetbb/${{ env.TBB_VERSION }}/Release/${{ env.PKG_ARCH }}/lib
OIDN=$BASE/oidn/${{ env.OIDN_VERSION }}/Release/${{ env.PKG_ARCH }}/lib
EMBREE3=$BASE/embree3/${{ env.EMBREE3_VERSION }}/Release/${{ env.PKG_ARCH }}/lib
export DYLD_LIBRARY_PATH=$TBB:$OIDN:$EMBREE3
delocate-listdeps -v {wheel}
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
CIBW_TEST_COMMAND_LINUX: pyluxcoretest
CIBW_TEST_COMMAND_WINDOWS: pyluxcoretest
CIBW_TEST_COMMAND_MACOS: |
if [[ ${{ matrix.os }} == 'macos-13' ]]; then
# Only for Intel: ARM runner raises an OpenCL driver error
pyluxcoretest
fi
CIBW_CONTAINER_ENGINE: >
docker;
create_args:
--mount type=bind,source=${{ github.workspace }}/conan-cache,target=/conan-cache
--mount type=bind,source=${{ env.CCACHE_DIR }},target=/root/.ccache
with:
package-dir: .
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"
- name: Save dependency cache
if: always()
id: cache-deps-save
uses: actions/cache/save@v4
with:
path: conan-cache
key: deps-${{ matrix.os }}-${{ matrix.python-minor}}-${{ hashFiles('**/conan-cache') }}
#- name: Setup tmate session
#uses: mxschmitt/action-tmate@v3
#- name: Setup tmate session (debug)
#if: ${{ failure() }}
#uses: mxschmitt/action-tmate@v3
# Upload artifacts
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.python-minor }}
path: ./wheelhouse/*.whl
upload_test:
needs: [build_wheels]
environment:
name: testpypi
url: https://test.pypi.org/p/pyluxcore
permissions:
id-token: write
attestations: write
contents: read
runs-on: ubuntu-latest
if: ${{ github.ref_name }} == 'work'
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
verify-metadata: true
skip-existing: true
upload_prod:
needs: [build_wheels]
environment:
name: pypi
url: https://pypi.org/p/pyluxcore
permissions:
id-token: write
attestations: write
contents: read
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Generate artifact attestations
uses: actions/[email protected]
with:
subject-path: "dist/*"
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1