-
Notifications
You must be signed in to change notification settings - Fork 139
271 lines (254 loc) · 8.91 KB
/
workflow_ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# 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
- 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 ../../../../
cp src/docgen/out/js_tsdef/rhino3dm.d.ts src/build/javascript/artifacts_js
patch src/build/javascript/artifacts_js/rhino3dm.d.ts < src/rhino3dm.d.ts.diff
- 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 }}