more sudo #913
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/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: check changed files | |
uses: tj-actions/[email protected] | |
id: changed-files | |
with: | |
files: .github/workflows/workflow_ci.yml | |
#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/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: check changed files | |
uses: tj-actions/[email protected] | |
id: changed-files | |
with: | |
files: | | |
.github/workflows/workflow_ci.yml | |
Current_Development_Tools.md | |
script | |
#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/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: check changed files | |
uses: tj-actions/[email protected] | |
id: changed-files | |
with: | |
files: src/dotnet | |
#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/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: check changed files | |
uses: tj-actions/[email protected] | |
id: changed-files | |
with: | |
files: | | |
src/bindings | |
src/CMakeLists.txt | |
#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] | |
if: ${{ needs.check_bindings.outputs.any_changed == 'true' || needs.check_workflow.outputs.any_changed == 'true' || needs.check_build_scripts.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/[email protected] | |
- 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 | |
run: python3 script/setup.py -p js -o -v -d | |
- name: build js | |
run: python3 script/build.py -p js -o -v | |
- name: minify js | |
uses: tinpotnick/[email protected] | |
with: | |
dir: src/build/javascript/artifacts_js | |
action: uglifyjs | |
filename: rhino3dm.js | |
output: src/build/javascript/artifacts_js/rhino3dm.min.js | |
- name: minify module | |
uses: tinpotnick/[email protected] | |
with: | |
dir: src/build/javascript/artifacts_js | |
action: uglifyjs | |
filename: rhino3dm.module.js | |
output: src/build/javascript/artifacts_js/rhino3dm.module.min.js | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
- name: docgen | |
shell: bash | |
run: | | |
dotnet build src/docgen | |
cd src/docgen/bin/Debug | |
./docgen | |
cd ../../../../ | |
patch src/docgen/out/js_tsdef/rhino3dm.d.ts < src/rhino3dm.d.ts.diff | |
cp src/docgen/out/js_tsdef/rhino3dm.d.ts src/build/javascript/artifacts_js | |
- name: copy files | |
shell: bash | |
run: | | |
cp package.json src/build/javascript/artifacts_js | |
cp docs/javascript/RHINO3DM.JS.md src/build/javascript/artifacts_js/README.md | |
- name: artifacts | |
uses: actions/[email protected] | |
with: | |
path: src/build/javascript/artifacts_js | |
name: rhino3dm.js | |
retention-days: ${{ env.RETENTION_DAYS }} | |
build_py_all_bdist: | |
name: build python ${{ matrix.python-version }} ${{ matrix.target }} bdist | |
runs-on: ${{ matrix.os }} | |
needs: [check_bindings, check_workflow, check_build_scripts] | |
if: ${{ needs.check_bindings.outputs.any_changed == 'true' || needs.check_workflow.outputs.any_changed == 'true' || needs.check_build_scripts.outputs.any_changed == 'true' }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-2019, macos-11] | |
python-version: [3.9, '3.10'] | |
include: | |
- os: ubuntu-latest | |
target: linux | |
- os: windows-2019 | |
target: windows | |
- os: macos-11 | |
target: macos | |
fail-fast: false | |
steps: | |
- name: set up python ${{ matrix.python-version }} | |
uses: actions/[email protected] | |
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/[email protected] | |
- name: update submodules | |
run: git submodule update --init | |
- name: build python ${{ matrix.python-version }} ${{ matrix.os }} | |
run: python setup.py bdist_wheel | |
- name: artifacts | |
uses: actions/[email protected] | |
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] | |
if: ${{ needs.check_bindings.outputs.any_changed == 'true' || needs.check_workflow.outputs.any_changed == 'true' || needs.check_build_scripts.outputs.any_changed == 'true' }} | |
steps: | |
- name: setup python | |
uses: actions/[email protected] | |
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/[email protected] | |
- 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/[email protected] | |
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] | |
if: ${{ needs.check_dotnet.outputs.any_changed == 'true' || needs.check_workflow.outputs.any_changed == 'true' || needs.check_build_scripts.outputs.any_changed == 'true' }} | |
steps: | |
- name: info | |
run: python3 --version && cmake --version && dotnet --version && git --version | |
- name: checkout | |
uses: actions/[email protected] | |
- 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: artifacts | |
uses: actions/[email protected] | |
with: | |
path: | | |
src/build/linux/dotnet/Rhino3dm.dll | |
src/build/linux/librhino3dm_native.so | |
name: rhino3dm.net | |
retention-days: ${{ env.RETENTION_DAYS }} |