Some ifdefs to make it easier to switch between oybind and nanobind #1425
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for a list of available software on the different virtual environments, please see: | |
# https://github.com/actions/virtual-environments/tree/main/images | |
name: workflow ci | |
on: [push, pull_request] | |
env: | |
RETENTION_DAYS: 15 | |
jobs: | |
#checks if this file has changed | |
check_workflow: | |
name: check workflow_ci | |
runs-on: ubuntu-latest | |
outputs: | |
any_changed: ${{ steps.changed-files.outputs.any_changed }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 2 | |
- name: check changed files | |
uses: tj-actions/changed-files@v42 | |
id: changed-files | |
with: | |
files: .github/workflows/workflow_ci.yml | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
done | |
#checks if build scripts have changed | |
check_build_scripts: | |
name: check build scripts and tools | |
runs-on: ubuntu-latest | |
outputs: | |
any_changed: ${{ steps.changed-files.outputs.any_changed }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 2 | |
- name: check changed files | |
uses: tj-actions/changed-files@v42 | |
id: changed-files | |
with: | |
files: | | |
.github/workflows/workflow_ci.yml | |
Current_Development_Tools.md | |
script/** | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
done | |
check_tests_dotnet: | |
name: check if dotnet tests changed | |
runs-on: ubuntu-latest | |
outputs: | |
any_changed: ${{ steps.changed-files.outputs.any_changed }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 2 | |
- name: check changed files | |
uses: tj-actions/changed-files@v42 | |
id: changed-files | |
with: | |
files: | | |
tests/dotnet/** | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
done | |
check_tests_js: | |
name: check if js tests changed | |
runs-on: ubuntu-latest | |
outputs: | |
any_changed: ${{ steps.changed-files.outputs.any_changed }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 2 | |
- name: check changed files | |
uses: tj-actions/changed-files@v42 | |
id: changed-files | |
with: | |
files: | | |
tests/javascript/** | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
done | |
check_tests_py: | |
name: check if py tests changed | |
runs-on: ubuntu-latest | |
outputs: | |
any_changed: ${{ steps.changed-files.outputs.any_changed }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 2 | |
- name: check changed files | |
uses: tj-actions/changed-files@v42 | |
id: changed-files | |
with: | |
files: | | |
tests/python/** | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
done | |
#checks if src/dotnet files have changed | |
check_dotnet: | |
name: check src/dotnet | |
runs-on: ubuntu-latest | |
outputs: | |
any_changed: ${{ steps.changed-files.outputs.any_changed }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 2 | |
- name: check changed files | |
uses: tj-actions/changed-files@v42 | |
id: changed-files | |
with: | |
files: src/dotnet/** | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
done | |
#checks if src/bindings have changed | |
check_bindings: | |
name: check src/bindings | |
runs-on: ubuntu-latest | |
outputs: | |
any_changed: ${{ steps.changed-files.outputs.any_changed }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 2 | |
- name: check changed files | |
uses: tj-actions/changed-files@v42 | |
id: changed-files | |
with: | |
files: | | |
src/bindings/** | |
src/CMakeLists.txt | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
done | |
#only run if src files have changed. | |
build_js: | |
name: build rhino3dm.js | |
runs-on: ubuntu-latest | |
needs: [check_bindings, check_workflow, check_build_scripts, check_tests_js] | |
if: ${{ needs.check_bindings.outputs.any_changed == 'true' || needs.check_workflow.outputs.any_changed == 'true' || needs.check_build_scripts.outputs.any_changed == 'true' || needs.check_tests_js.outputs.any_changed == 'true' }} | |
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 -d -m | |
- name: build js module | |
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 -d | |
- 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 | |
npm install -g uglify-js | |
cd src/build/javascript/artifacts | |
uglifyjs rhino3dm.module.js --compress -o rhino3dm.module.min.js | |
uglifyjs rhino3dm.js --compress -o rhino3dm.min.js | |
- name: artifacts | |
uses: actions/upload-artifact@v4.3.1 | |
with: | |
path: src/build/javascript/artifacts | |
name: rhino3dm.js | |
retention-days: ${{ env.RETENTION_DAYS }} | |
build_py_all_bdist: | |
name: build python ${{ matrix.python-version }} ${{ matrix.target }} ${{ matrix.os }} bdist | |
runs-on: ${{ matrix.os }} | |
needs: [check_bindings, check_workflow, check_build_scripts, check_tests_py] | |
if: ${{ needs.check_bindings.outputs.any_changed == 'true' || needs.check_workflow.outputs.any_changed == 'true' || needs.check_build_scripts.outputs.any_changed == 'true' || needs.check_tests_py.outputs.any_changed == 'true' }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-2019, macos-12, macos-14] | |
python-version: ['3.10', '3.11', '3.12'] | |
include: | |
- os: ubuntu-latest | |
target: linux | |
- os: windows-2019 | |
target: windows | |
- os: macos-12 | |
target: macos | |
- os: macos-14 | |
target: macos | |
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 build --debug | |
- name: artifacts | |
uses: actions/upload-artifact@v4.3.1 | |
with: | |
path: dist | |
name: rhino3dm.py ${{ matrix.python-version }} ${{ matrix.os }} | |
retention-days: ${{ env.RETENTION_DAYS }} | |
build_py_sdist: | |
name: build python sdist | |
runs-on: ubuntu-latest | |
needs: [check_bindings, check_workflow, check_build_scripts, check_tests_py] | |
if: ${{ needs.check_bindings.outputs.any_changed == 'true' || needs.check_workflow.outputs.any_changed == 'true' || needs.check_build_scripts.outputs.any_changed == 'true' || needs.check_tests_py.outputs.any_changed == 'true' }} | |
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.9.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 | |
- 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__)" | |
- 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_dotnet: | |
name: build dotnet | |
runs-on: ubuntu-latest | |
#container: | |
#image: mcneel/rhino3dm-dev-amzn2 | |
needs: [check_dotnet, check_workflow, check_build_scripts, check_tests_dotnet] | |
if: ${{ needs.check_dotnet.outputs.any_changed == 'true' || needs.check_workflow.outputs.any_changed == 'true' || needs.check_build_scripts.outputs.any_changed == 'true' || needs.check_tests_dotnet.outputs.any_changed == 'true'}} | |
steps: | |
- name: info | |
run: python3 --version && cmake --version && dotnet --version && git --version | |
- 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 | |
run: python3 script/bootstrap.py -p linux | |
- name: setup | |
run: python3 script/setup.py -p linux -v | |
- name: build dotnet | |
run: python3 script/build.py -p linux -v | |
- name: pack dotnet | |
run: dotnet pack src/dotnet/Rhino3dm.csproj -c Debug | |
- name: artifacts | |
uses: actions/upload-artifact@v4.3.1 | |
with: | |
path: | | |
src/build/linux/dotnet/Rhino3dm.dll | |
src/build/linux/librhino3dm_native.so | |
src/dotnet/bin/Debug/*.nupkg | |
name: rhino3dm.net | |
retention-days: ${{ env.RETENTION_DAYS }} | |
#tests | |
test_dotnet: | |
name: test dotnet | |
runs-on: ubuntu-latest | |
needs: [build_dotnet] | |
steps: | |
- name: info | |
run: python3 --version && cmake --version && dotnet --version && git --version | |
- name: checkout | |
uses: actions/checkout@v4.1.1 | |
- name: safe directory | |
run: git config --global --add safe.directory /__w/rhino3dm/rhino3dm | |
- name: download artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: rhino3dm.net | |
path: tests/dotnet/lib | |
- name: test dotnet | |
run: | | |
NUGET_FILE="$(find tests/dotnet/lib/dotnet/bin/Debug -type f -name "*.nupkg")" | |
FILENAME=$(basename ${NUGET_FILE}) | |
NAME=${FILENAME%.*} | |
VERSION=${NAME:9} | |
dotnet nuget add source $(pwd)/tests/dotnet/lib/dotnet/bin/Debug | |
cd tests/dotnet | |
dotnet add package Rhino3dm -v ${VERSION} | |
dotnet build | |
dotnet test | |
test_python_bdist: | |
name: build python ${{ matrix.python-version }} ${{ matrix.target }} ${{ matrix.os }} bdist | |
runs-on: ${{ matrix.os }} | |
needs: [build_py_all_bdist] | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-2019, macos-12, macos-14] | |
python-version: ['3.10', '3.11', '3.12'] | |
include: | |
- os: ubuntu-latest | |
target: linux | |
- os: windows-2019 | |
target: windows | |
- os: macos-12 | |
target: macos | |
- os: macos-14 | |
target: macos | |
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: checkout | |
uses: actions/checkout@v4.1.1 | |
- name: download artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: rhino3dm.py ${{ matrix.python-version }} ${{ matrix.os }} | |
path: tests/python/lib | |
- name: install whl | |
shell: bash | |
run: pip install --no-index tests/python/lib/*.whl --force-reinstall | |
- name: test python bdist | |
run: | | |
cd tests/python | |
python -m unittest discover . | |
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 | |