Skip to content

workflow release

workflow release #268

name: workflow release
on: [workflow_dispatch]
jobs:
build_py_sdist:
name: build python sdist
runs-on: ubuntu-latest
steps:
- name: setup python
uses: actions/setup-python@v5.0.0
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.7.x'
- name: info
run: python --version && cmake --version
- name: install dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: checkout
uses: actions/checkout@v4.1.1
- name: update submodules
run: git submodule update --init
- name: build python sdist
run: python setup.py sdist build --debug
- name: check sdist
run: |
# installs rhino3dm from the source distribution
# into a virtualenv and tries to import it
# set up directory
rm -rf test_install
mkdir test_install
cd test_install
# create virtualenv
python -m venv venv
. venv/bin/activate
pip install wheel
# install
pip install --verbose ../dist/*.tar.gz
# test
python -c "import rhino3dm; print(rhino3dm.__version__)"
#cd ..
#python -m unittest discover tests/python/
- name: list files
run: ls -R
- name: artifact name
id: artifactname
run: |
cd dist
echo "file=$(ls *.tar.gz| head -1)" >> $GITHUB_OUTPUT
- name: artifacts
uses: actions/upload-artifact@v4.3.1
with:
path: dist
name: ${{ steps.artifactname.outputs.file }}
build_py_manylinux:
name: build python ${{ matrix.python-version }} manylinux_2_28
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64 #manylinux2014_x86_64
strategy:
matrix:
python-version: [cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311, cp312-cp312]
fail-fast: false
steps:
- name: info
run: /opt/python/${{ matrix.python-version }}/bin/python --version
- name: checkout
uses: actions/checkout@v4.1.1 #needs to stay this version until we upgrade this os
- name: safe directory
run: git config --global --add safe.directory /__w/rhino3dm/rhino3dm
- name: update submodules
run: git submodule update --init
- name: build python manylinux
run: /opt/python/${{ matrix.python-version }}/bin/python setup.py bdist_wheel build --debug
- name: audit python wheel
run: auditwheel repair dist/*.whl
- name: list files
run: ls -R
- name: test python
shell: bash
run: |
find ./dist -type f -name "*.whl" -exec cp '{}' ./tests/python/lib \;
/opt/python/${{ matrix.python-version }}/bin/python -m pip install --no-index tests/python/lib/*.whl --force-reinstall
/opt/python/${{ matrix.python-version }}/bin/python -m unittest discover tests/python/
- name: artifact name
id: artifactname
run: |
cd wheelhouse
echo "file=$(ls *.whl| head -1)" >> $GITHUB_OUTPUT
- name: artifacts
uses: actions/upload-artifact@v4.3.1 #needs to stay this version until we upgrade this os
with:
path: wheelhouse/*.whl
name: ${{ steps.artifactname.outputs.file }}
build_py_all_bdist:
name: build python ${{ matrix.python-version }} ${{ matrix.target }} bdist
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019, macos-12, macos-14]
python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
include:
- os: windows-2019
target: windows
- os: macos-12
target: macos
- os: macos-14
target: macos
exclude:
- os: macos-14
python-version: 3.7
fail-fast: false
steps:
- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5.0.0
with:
python-version: ${{ matrix.python-version }}
- name: info
run: python --version && cmake --version
- name: install dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: checkout
uses: actions/checkout@v4.1.1
- name: update submodules
run: git submodule update --init
- name: build python ${{ matrix.python-version }} ${{ matrix.os }}
run: python setup.py bdist_wheel
- name: code-sign native libraries
env:
IDENTITY_ID: ${{ secrets.IDENTITY_ID }}
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_KEYCHAIN_TEMP_PWD: ${{ secrets.MACOS_KEYCHAIN_TEMP_PWD }}
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
./script/codesign-native.sh src/build
else
echo "$RUNNER_OS not supported for code-signing"
exit 0
fi
shell: bash
- name: list files
run: ls -R
- name: test python bdist
shell: bash
run: |
find ./dist -type f -name "*.whl" -exec cp '{}' ./tests/python/lib \;
pip install --no-index tests/python/lib/*.whl --force-reinstall
python -m unittest discover tests/python/
- name: artifact name
id: artifactname
shell: bash
run: |
cd dist
echo "file=$(ls *.whl| head -1)" >> $GITHUB_OUTPUT
- name: artifacts
uses: actions/upload-artifact@v4.3.1
with:
path: dist
name: ${{ steps.artifactname.outputs.file }}
build_dotnet_os:
name: build dotnet ${{ matrix.target }}
runs-on: ${{ matrix.os }}
#container:
#image: ${{ matrix.image }}
strategy:
matrix:
os: [ubuntu-latest, macos-14, windows-2022]
include:
- os: ubuntu-latest
target: linux
#image: mcneel/rhino3dm-dev-amzn2
artifact-path: src/build/linux/librhino3dm_native.so
- os: windows-2022
target: windows
#image: ""
artifact-path: src\build\windows\*\Release\librhino3dm_native.dll
- os: macos-14
target: macos
#image: ""
artifact-path: src/build/macos/Release/librhino3dm_native.dylib
fail-fast: false
steps:
#- name: setup dotnet
# if: ${{ matrix.target == 'macos'}}
# uses: actions/setup-dotnet@v4.0.0
# with:
# dotnet-version: '7.0.x'
- name: setup cmake
if: ${{ matrix.target != 'linux' }}
uses: jwlawson/actions-setup-cmake@v2.0.0
with:
cmake-version: '3.25.0'
- name: checkout
uses: actions/checkout@v4.1.1
- name: safe directory
run: git config --global --add safe.directory /__w/rhino3dm/rhino3dm
- name: update submodules
run: ls && git submodule update --init
- name: bootstrap dotnet ${{ matrix.target }}
run: python3 script/bootstrap.py -p ${{ matrix.target }}
- name: setup dotnet ${{ matrix.target }}
run: python3 script/setup.py -p ${{ matrix.target }} -v -l
- name: build dotnet ${{ matrix.target }}
run: python3 script/build.py -p ${{ matrix.target }} -v -l
- name: list
run: "ls -R src/build/${{ matrix.target }}"
- name: code-sign native libraries
if: ${{ matrix.target == 'macos' }}
env:
IDENTITY_ID: ${{ secrets.IDENTITY_ID }}
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_KEYCHAIN_TEMP_PWD: ${{ secrets.MACOS_KEYCHAIN_TEMP_PWD }}
shell: bash
run: ./script/codesign-native.sh src/build/macos/Release
- name: notarize native library
if: ${{ matrix.target == 'macos' }}
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MACDEV_PW: ${{ secrets.MACDEV_PW }}
shell: bash
run: ./script/notarize-native.sh src/build/macos/Release/librhino3dm_native.dylib
- name: artifacts
uses: actions/upload-artifact@v4.3.1
with:
path: ${{ matrix.artifact-path }}
name: rhino3dm.net ${{ matrix.target }}
build_dotnet_arm64:
name: build dotnet arm 64
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4.1.1
- name: safe directory
run: git config --global --add safe.directory /__w/rhino3dm/rhino3dm
- name: update submodules
run: ls && git submodule update --init
- name: setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: build rhino3dm native lib
uses: addnab/docker-run-action@v3
with:
image: mcneel/rhino3dm-dev-arm64
options: -v ${{ github.workspace }}:/src
run: |
uname -a
cd src
echo 'info'
python3 --version && cmake --version && dotnet --version && git --version
echo 'bootstrap'
python3 script/bootstrap.py -p linux
echo 'setup'
python3 script/setup.py -p linux -v -l
echo 'build'
python3 script/build.py -p linux -v -l
ldd src/build/linux/librhino3dm_native.so
- name: artifacts
uses: actions/upload-artifact@v4.3.1
with:
path: |
src/build/linux/librhino3dm_native.so
name: rhino3dm.net linux arm64
retention-days: ${{ env.RETENTION_DAYS }}
pack_dotnet:
name: pack dotnet
needs: [build_dotnet_os, build_dotnet_arm64]
runs-on: windows-2022
steps:
- name: set up python
uses: actions/setup-python@v5.0.0
with:
python-version: 3.7.x
- name: setup cmake
uses: jwlawson/actions-setup-cmake@v2.0.0
with:
cmake-version: '3.21.1'
- name: checkout
uses: actions/checkout@v4.1.1
- name: update submodules
run: ls && git submodule update --init
- name: bootstrap dotnet
run: python script/bootstrap.py -p windows
- name: setup dotnet
run: python script/setup.py -p windows -v
- name: build dotnet
run: dotnet build src/dotnet/Rhino3dm.csproj
- name: download rhino3dm.net linux
uses: actions/download-artifact@v4.1.7
with:
name: rhino3dm.net linux
path: src/build/linux/Release/
- name: download rhino3dm.net linux arm64
uses: actions/download-artifact@v4.1.7
with:
name: rhino3dm.net linux arm64
path: src/build/linux/arm64/Release/
- name: download rhino3dm.net macos
uses: actions/download-artifact@v4.1.7
with:
name: rhino3dm.net macos
path: src/build/macos/Release/
- name: download rhino3dm.net windows
uses: actions/download-artifact@v4.1.7
with:
name: rhino3dm.net windows
path: src/build/windows/
- name: list
run: "ls -R src/build/"
- name: pack dotnet
run: dotnet pack src/dotnet/Rhino3dm.csproj
- name: artifacts nupkg
uses: actions/upload-artifact@v4.3.1
with:
path: src/dotnet/bin/Release/Rhino3dm.*.nupkg #${{ matrix.artifact-path }}
name: rhino3dm.net nupkg
build_js:
name: build rhino3dm.js
runs-on: ubuntu-latest
container:
image: emscripten/emsdk:3.1.30
steps:
- name: info
run: python3 --version && emcc --version && cmake --version
- name: checkout
uses: actions/checkout@v4.1.1
- name: safe dir
run: git config --system --add safe.directory /__w/rhino3dm/rhino3dm
- name: update submodules
run: git submodule update --init
- name: bootstrap
run: python3 script/bootstrap.py -p js
- name: setup js module
run: python3 script/setup.py -p js -o -v -m
- name: build js
run: python3 script/build.py -p js -o -v
- name: copy files
shell: bash
run: |
mkdir src/build/javascript/artifacts
mv src/build/javascript/rhino3dm.js src/build/javascript/artifacts/rhino3dm.module.js
cp package.json src/build/javascript/artifacts
cp docs/javascript/RHINO3DM.JS.md src/build/javascript/artifacts/README.md
cp src/js/rhino3dm.d.ts src/build/javascript/artifacts/rhino3dm.d.ts
- name: setup js
run: python3 script/setup.py -p js -o -v
- name: build js
run: python3 script/build.py -p js -o -v
- name: copy files
shell: bash
run: |
mv src/build/javascript/rhino3dm.js src/build/javascript/artifacts
mv src/build/javascript/artifacts_js/rhino3dm.wasm src/build/javascript/artifacts
ls src/build/javascript/artifacts
#todo - minify
- name: artifacts
uses: actions/upload-artifact@v4.3.1
with:
path: src/build/javascript/artifacts
name: rhino3dm.js
retention-days: ${{ env.RETENTION_DAYS }}
# TESTS
test_javascript:
name: test javascript
runs-on: ubuntu-latest
needs: [build_js]
steps:
- name: info
run: python3 --version && cmake --version && node --version
- name: checkout
uses: actions/checkout@v4.1.1
- name: download artifact
uses: actions/download-artifact@v4.1.7
with:
name: rhino3dm.js
path: tests/javascript/lib
- name: test javascript
run: |
ls tests/javascript/lib
cd tests/javascript
npm i
npm test
test_dotnet:
name: test dotnet
runs-on: ubuntu-latest
needs: [pack_dotnet]
steps:
- name: checkout
uses: actions/checkout@v4.1.1
- name: download rhino3dm.net nuget
uses: actions/download-artifact@v4.1.7
with:
name: rhino3dm.net nupkg
path: tests/dotnet/lib
- name: test dotnet
run: |
NUGET_FILE="$(find tests/dotnet/lib -type f -name "*.nupkg")"
FILENAME=$(basename ${NUGET_FILE})
NAME=${FILENAME%.*}
VERSION=${NAME:9}
dotnet nuget add source $(pwd)/tests/dotnet/lib
cd tests/dotnet
dotnet add package Rhino3dm -v ${VERSION}
dotnet build
dotnet test
# pack_py:
# name: pack python
# needs: [build_py_manylinux2014, build_py_sdist, build_py_all_bdist]
# runs-on: ubuntu-latest
# steps:
# - name: download python artifacts dist
# uses: elonh/download-artifact-regexp@master
# with:
# pattern: ^.*\.(whl|tar.gz)$ #.*whl(:|$).*
# path: dist
# - name: Display structure of downloaded files
# run: ls -R
# #- name: unzip files
# # run: |
# # mkdir output
# # find dist -type f -print0 | xargs -0 mv -t output
# # cd output
# # ls
# - name: artifacts
# uses: actions/upload-artifact@v4.3.1
# with:
# path: dist
# name: rhino3dm.py all wheels
# build_dotnet_ios:
# name: build dotnet ios
# runs-on: macos-11
# steps:
# - name: setup cmake
# uses: jwlawson/actions-setup-cmake@v1.9
# with:
# cmake-version: '3.21.1'
# - name: setup xcode
# uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: '12.5'
# - name: info
# run: python3 --version && cmake --version
# - name: checkout
# uses: actions/checkout@v2
# - name: update submodules
# run: git submodule update --init
# #- name: setup-xamarin
# # uses: maxim-lobanov/setup-xamarin@v1
# # with:
# # mono-version: '6.12'
# # xamarin-ios-version: '14.14.2.5'
# - name: bootstrap
# run: python3 script/bootstrap.py -p ios
# - name: setup
# run: python3 script/setup.py -p ios -v
# - name: build dotnet ios
# run: python3 script/build.py -p ios -v
# - name: pack dotnet ios
# run: nuget pack src/dotnet/Rhino3dm.iOS.nuspec
# - name: artifacts nupkg
# uses: actions/upload-artifact@v2
# with:
# path: Rhino3dm.iOS.*.nupkg #src/build/ios/dotnet/Rhino3dm.iOS.dll
# name: rhino3dm.net ios nupkg
# - name: artifacts
# uses: actions/upload-artifact@v2
# with:
# path: src/build/ios/dotnet/Rhino3dm.iOS.dll
# name: rhino3dm.net ios
# build_dotnet_android:
# name: build dotnet android
# runs-on: macos-11
# steps:
# - name: set up python
# uses: actions/setup-python@v5.0.0
# with:
# python-version: 3.7.1
# - name: setup cmake
# uses: jwlawson/actions-setup-cmake@v1.9
# with:
# cmake-version: '3.21.1'
# - name: setup xcode
# uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: '12.5'
# - name: setup-xamarin
# uses: maxim-lobanov/setup-xamarin@v1
# with:
# mono-version: '6.12' # specify version in '<major>.<minor>' format
# xamarin-android-version: '11.3.0.4' # specify full version; it is not recomended option because your pipeline can be broken suddenly in future
# - name: setup android ndk
# uses: maxim-lobanov/setup-android-tools@v1
# with:
# packages: ndk;21.0.6113669
# cache: true
# - name: info
# run: python3 --version && cmake --version
# - name: checkout
# uses: actions/checkout@v2
# - name: update submodules
# run: git submodule update --init
# - name: bootstrap
# run: python3 script/bootstrap.py -p android
# - name: setup
# run: python3 script/setup.py -p android -v
# - name: build dotnet android
# run: python3 script/build.py -p android -v
# - name: pack dotnet android
# run: nuget pack src/dotnet/Rhino3dm.Android.nuspec
# - name: artifacts nupkg
# uses: actions/upload-artifact@v2
# with:
# path: Rhino3dm.Android.*.nupkg #src/build/android/dotnet/Rhino3dm.Android.dll
# name: rhino3dm.net android nupkg
# - name: artifacts
# uses: actions/upload-artifact@v2
# with:
# path: src/build/android/dotnet/Rhino3dm.Android.dll
# name: rhino3dm.net android