forked from openvdb/fvdb-core
-
Notifications
You must be signed in to change notification settings - Fork 0
414 lines (374 loc) · 15.1 KB
/
tests.yml
File metadata and controls
414 lines (374 loc) · 15.1 KB
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
name: fVDB Unit Tests
on:
pull_request_target:
branches:
- '**'
paths-ignore:
- 'CODEOWNERS'
- '**.md'
- 'debug/**'
- 'examples/**'
- 'notebooks/**'
- 'scripts/**'
workflow_dispatch:
inputs:
branch:
description: "Branch to build"
required: true
default: "main"
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
deployments: read
pull-requests: read
issues: read
# Need ID token write permission to use OIDC
id-token: write
jobs:
##############################################################################
# BUILD FVDB
##############################################################################
start-build-runner:
name: Start CPU-only EC2 runner for build
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false || github.event_name != 'pull_request_target'
outputs:
label: ${{ steps.start-build-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-build-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::420032683002:role/openvdb-fvdb-github-actions-role
aws-region: us-east-2
- name: Start EC2 runner
id: start-build-runner
uses: machulav/ec2-github-runner@v2.4.3
with:
mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
ec2-image-id: ami-0e14a711dad782a70
ec2-instance-type: m6a.8xlarge
subnet-id: subnet-03f2320d6e6e0005b
security-group-id: sg-0cd08bd89d6212223
fvdb-build:
name: fVDB Build
needs: start-build-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-build-runner.outputs.label }} # run the job on the newly created runner
container:
image: aswf/ci-openvdb:2024-clang17.2
env:
PYTHONPATH: ""
CPM_SOURCE_CACHE: "/__w/cpm_cache"
CONDA_OVERRIDE_CUDA: "12.9" # this is to build an environment on machines that lack a CUDA device and needs to be >= the CUDA version in the build_environment.yml file
options: --rm
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.base.ref || github.ref }}
- name: Fetch PR branch
if: github.event_name == 'pull_request_target'
run: |
cd $GITHUB_WORKSPACE
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config --global --add safe.directory "$(pwd)"
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_branch
- name: Merge PR branch into base
if: github.event_name == 'pull_request_target'
run: |
cd $GITHUB_WORKSPACE
git merge pr_branch
# - name: Simulate merge for push events
# if: github.event_name == 'push'
# run: |
# echo "Push event detected - simulating merge with target branch"
# git config --global user.name "github-actions[bot]"
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# git config --global --add safe.directory "$(pwd)"
# # Get the target branch (main in this case, since push is only on main)
# TARGET_BRANCH="main"
# CURRENT_COMMIT="${{ github.sha }}"
# echo "Creating merge simulation: merging $CURRENT_COMMIT into $TARGET_BRANCH"
# git fetch origin $TARGET_BRANCH
# git checkout $TARGET_BRANCH
# git merge --no-ff $CURRENT_COMMIT --message "CI: Simulating merge of $CURRENT_COMMIT into $TARGET_BRANCH"
- name: Set up fvdb_build Conda env
uses: mamba-org/setup-micromamba@v2
with:
post-cleanup: 'all'
environment-name: fvdb_build
environment-file: env/build_environment.yml
- name: Build fvdb
run: |
micromamba activate fvdb_build
./build.sh wheel verbose gtests benchmarks --cuda-arch-list '8.9+PTX'
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: fvdb-test-package
path: dist/*.whl
retention-days: 2
#NOTE: This tar step is here because directly uploading the build directory
# wasn't working due to losing executable permissions on the files.
- name: Tar build directory
run: tar -cvf fvdb-gtest.tar build/
- name: Upload gtests
uses: actions/upload-artifact@v4
with:
name: fvdb-gtest
path: fvdb-gtest.tar
retention-days: 2
fvdb-build-stop-runner:
name: Stop CPU-only EC2 runner for build
needs:
- start-build-runner # required to get output from the start-build-runner job
- fvdb-build # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::420032683002:role/openvdb-fvdb-github-actions-role
aws-region: us-east-2
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2.4.3
with:
mode: stop
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
label: ${{ needs.start-build-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-build-runner.outputs.ec2-instance-id }}
##############################################################################
# START FVDB TESTS GPU RUNNER
##############################################################################
start-tests-gpu-runner:
name: Start EC2 GPU runner for tests
needs: fvdb-build
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-tests-gpu-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-tests-gpu-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::420032683002:role/openvdb-fvdb-github-actions-role
aws-region: us-east-2
- name: Start EC2 GPU runner
id: start-tests-gpu-runner
uses: machulav/ec2-github-runner@v2.4.3
with:
mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
ec2-image-id: ami-0f5c0b65fde08ae43
ec2-instance-type: g6.xlarge # 4 CPU-core, L4 GPU
subnet-id: subnet-03f2320d6e6e0005b
security-group-id: sg-0cd08bd89d6212223
##############################################################################
# RUN FVDB GTESTS
##############################################################################
fvdb-gtests:
needs: start-tests-gpu-runner # required to start the main job when the runner is ready
name: fVDB GTests
runs-on: ${{ needs.start-tests-gpu-runner.outputs.label }} # run the job on the newly created runner
container:
image: aswf/ci-openvdb:2024-clang17.2
env:
PYTHONPATH: ""
CPM_SOURCE_CACHE: "/__w/cpm_cache"
options: --rm
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.base.ref || github.ref }}
- name: Fetch PR branch
if: github.event_name == 'pull_request_target'
run: |
cd $GITHUB_WORKSPACE
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config --global --add safe.directory "$(pwd)"
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_branch
- name: Merge PR branch into base
if: github.event_name == 'pull_request_target'
run: |
cd $GITHUB_WORKSPACE
git merge pr_branch
- name: Set up fvdb_test Conda env
uses: mamba-org/setup-micromamba@v2
with:
cache-environment: false
post-cleanup: 'all'
environment-name: fvdb_test
environment-file: env/test_environment.yml
- name: Download package with nanovdb_editor
uses: actions/download-artifact@v4
with:
name: fvdb-test-package
path: ./dist
- name: Install nanovdb_editor
run: |
micromamba activate fvdb_test
pip install ./dist/nanovdb_editor*.whl
- name: Download gtests
uses: actions/download-artifact@v4
with:
name: fvdb-gtest
path: .
- name: Extract tar
run: |
tar -xvf fvdb-gtest.tar
- name: Run tests
run: |
micromamba activate fvdb_test
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib
./build.sh ctest
##############################################################################
# RUN FVDB UNIT TESTS
##############################################################################
fvdb-unit-tests:
needs: start-tests-gpu-runner # required to start the main job when the runner is ready
name: fVDB Unit Tests
runs-on: ${{ needs.start-tests-gpu-runner.outputs.label }} # run the job on the newly created runner
container:
image: aswf/ci-openvdb:2024-clang17.2
env:
PYTHONPATH: ""
CPM_SOURCE_CACHE: "/__w/cpm_cache"
options: --rm
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.base.ref || github.ref }}
- name: Fetch PR branch
if: github.event_name == 'pull_request_target'
run: |
cd $GITHUB_WORKSPACE
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config --global --add safe.directory "$(pwd)"
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_branch
- name: Merge PR branch into base
if: github.event_name == 'pull_request_target'
run: |
cd $GITHUB_WORKSPACE
git merge pr_branch
- name: Set up fvdb_test Conda env
uses: mamba-org/setup-micromamba@v2
with:
cache-environment: false
post-cleanup: 'all'
environment-name: fvdb_test
environment-file: env/test_environment.yml
- name: Download package
uses: actions/download-artifact@v4
with:
name: fvdb-test-package
path: ./dist
- name: Install package
run: |
micromamba activate fvdb_test
pip install ./dist/*.whl
- name: Run tests
run: |
micromamba activate fvdb_test
cd tests;
pytest -v unit
##############################################################################
# RUN FVDB DOCUMENTATION TESTS
##############################################################################
fvdb-docs-test:
needs: start-tests-gpu-runner # required to start the main job when the runner is ready
name: fVDB Documentation Tests
runs-on: ${{ needs.start-tests-gpu-runner.outputs.label }} # run the job on the newly created runner
container:
image: aswf/ci-openvdb:2024-clang17.2
env:
PYTHONPATH: ""
options: --rm
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.base.ref || github.ref }}
- name: Fetch PR branch
if: github.event_name == 'pull_request_target'
run: |
cd $GITHUB_WORKSPACE
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config --global --add safe.directory "$(pwd)"
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_branch
- name: Merge PR branch into base
if: github.event_name == 'pull_request_target'
run: |
cd $GITHUB_WORKSPACE
git merge pr_branch
- name: Set up fvdb_test Conda env
uses: mamba-org/setup-micromamba@v2
with:
cache-environment: false
post-cleanup: 'all'
environment-name: fvdb_test
environment-file: env/test_environment.yml
- name: Download package
uses: actions/download-artifact@v4
with:
name: fvdb-test-package
path: ./dist
- name: Install package
run: |
micromamba activate fvdb_test
pip install ./dist/*.whl
- name: Run tests
run: |
micromamba activate fvdb_test
pytest --markdown-docs docs --ignore-glob="**/wip/**"
##############################################################################
# STOP FVDB TESTS GPU RUNNER
##############################################################################
fvdb-tests-stop-gpu-runner:
name: Stop GPU EC2 runner for tests
needs:
- start-tests-gpu-runner # required to get output from the start-tests-gpu-runner job
- fvdb-gtests # required to wait when the main job is done
- fvdb-unit-tests # required to wait when the main job is done
- fvdb-docs-test # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::420032683002:role/openvdb-fvdb-github-actions-role
aws-region: us-east-2
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2.4.3
with:
mode: stop
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
label: ${{ needs.start-tests-gpu-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-tests-gpu-runner.outputs.ec2-instance-id }}