forked from openvdb/fvdb-core
-
Notifications
You must be signed in to change notification settings - Fork 0
261 lines (229 loc) · 9.56 KB
/
nightly.yml
File metadata and controls
261 lines (229 loc) · 9.56 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
name: fVDB Nightly Build and Tests
on:
# schedule:
# - cron: "01 15 * * *" # Runs every day at 4am pacific/11am UTC
workflow_dispatch:
permissions:
contents: read
deployments: read
pull-requests: read
issues: read
# Need ID token write permission to use OIDC
id-token: write
jobs:
fvdb-build:
if: ${{ github.repository == 'openvdb/fvdb-core' && !startsWith(github.event.pull_request.title, 'Draft:') }}
name: fVDB Build
runs-on:
- self-hosted
container:
image: aswf/ci-openvdb:2024
env:
PYTHONPATH: ""
CPM_SOURCE_CACHE: "/__w/cpm_cache"
options: --rm
defaults:
run:
shell: bash -el {0}
steps:
### Get the PR branch and apply changes to the target branch
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches
- name: Determine the target branch of the PR
run: |
echo "Fetching pull request metadata..."
# Install GitHub CLI and jq
dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
yum install -y gh
which jq || yum install -y jq
# Extract PR number from branch name if it follows pattern "pull-request/123"
BRANCH_NAME=${GITHUB_REF#refs/heads/}
echo "Branch name: $BRANCH_NAME"
# Setup GitHub CLI authentication
echo "${{ github.token }}" | gh auth login --with-token
# Get default branch from repository
echo "Getting default branch from repository..."
DEFAULT_BRANCH=$(gh repo view ${{ github.repository }} --json defaultBranchRef --jq '.defaultBranchRef.name' 2>/dev/null || echo 'develop')
echo "Repository default branch is: $DEFAULT_BRANCH"
if [[ $BRANCH_NAME =~ pull-request/([0-9]+) ]]; then
PR_NUMBER=${BASH_REMATCH[1]}
echo "Found PR number from branch name: $PR_NUMBER"
echo "Using gh CLI to get PR details..."
# Get PR info using GitHub CLI and extract the base branch
PR_INFO=$(gh pr view $PR_NUMBER --json baseRefName --repo ${{ github.repository }} 2>/dev/null || echo '{"baseRefName":"'$DEFAULT_BRANCH'"}')
TARGET_BRANCH=$(echo "$PR_INFO" | jq -r '.baseRefName')
echo "Target branch is $TARGET_BRANCH"
if [ -z "$TARGET_BRANCH" ] || [ "$TARGET_BRANCH" = "null" ]; then
echo "Could not determine target branch, using default branch"
TARGET_BRANCH="$DEFAULT_BRANCH"
fi
else
echo "Branch doesn't match the expected pattern, using default branch"
TARGET_BRANCH="$DEFAULT_BRANCH"
fi
echo "Final TARGET_BRANCH=$TARGET_BRANCH"
echo "TARGET_BRANCH=$TARGET_BRANCH" >> $GITHUB_ENV
- name: Set up Git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Merge pushed branch into target branch
run: |
if [ -z "$TARGET_BRANCH" ]; then
echo "No pull request metadata found. Skipping merge."
exit 0
fi
git config --global --add safe.directory "$(pwd)"
git fetch origin $TARGET_BRANCH
git checkout $TARGET_BRANCH
git merge $GITHUB_REF --no-ff --message "Merging $GITHUB_REF into $TARGET_BRANCH"
env:
GITHUB_REF: ${{ github.ref }}
#### End of git merge
- name: Set up fvdb_build Conda env
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
conda-remove-defaults: "true"
activate-environment: fvdb_build
environment-file: fvdb/env/build_environment.yml
- name: Build fvdb
run: |
cd fvdb;
TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6+PTX" conda run --no-capture-output -n fvdb_build ./build.sh wheel verbose gtests benchmarks
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: fvdb-test-package
path: fvdb/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 fvdb/build/
- name: Upload gtests
uses: actions/upload-artifact@v4
with:
name: fvdb-gtest
path: fvdb-gtest.tar
retention-days: 2
- name: Cleanup
if: always()
run: |
echo "Cleaning up /__w/_temp directory"
sudo rm -rf /__w/_temp/*
echo "Cleanup completed"
fvdb-benchmarks:
if: ${{ github.repository == 'openvdb/fvdb-core' }}
needs: [fvdb-build]
name: fVDB Continuous Benchmarking
runs-on:
- self-hosted
container:
image: aswf/ci-openvdb:2024
env:
PYTHONPATH: ""
options: --rm
defaults:
run:
shell: bash -el {0}
steps:
### Get the PR branch and apply changes to the target branch
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches
- name: Determine the target branch of the PR
run: |
echo "Fetching pull request metadata..."
# Install GitHub CLI and jq
dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
yum install -y gh
which jq || yum install -y jq
# Extract PR number from branch name if it follows pattern "pull-request/123"
BRANCH_NAME=${GITHUB_REF#refs/heads/}
echo "Branch name: $BRANCH_NAME"
# Setup GitHub CLI authentication
echo "${{ github.token }}" | gh auth login --with-token
# Get default branch from repository
echo "Getting default branch from repository..."
DEFAULT_BRANCH=$(gh repo view ${{ github.repository }} --json defaultBranchRef --jq '.defaultBranchRef.name' 2>/dev/null || echo 'develop')
echo "Repository default branch is: $DEFAULT_BRANCH"
if [[ $BRANCH_NAME =~ pull-request/([0-9]+) ]]; then
PR_NUMBER=${BASH_REMATCH[1]}
echo "Found PR number from branch name: $PR_NUMBER"
echo "Using gh CLI to get PR details..."
# Get PR info using GitHub CLI and extract the base branch
PR_INFO=$(gh pr view $PR_NUMBER --json baseRefName --repo ${{ github.repository }} 2>/dev/null || echo '{"baseRefName":"'$DEFAULT_BRANCH'"}')
TARGET_BRANCH=$(echo "$PR_INFO" | jq -r '.baseRefName')
echo "Target branch is $TARGET_BRANCH"
if [ -z "$TARGET_BRANCH" ] || [ "$TARGET_BRANCH" = "null" ]; then
echo "Could not determine target branch, using default branch"
TARGET_BRANCH="$DEFAULT_BRANCH"
fi
else
echo "Branch doesn't match the expected pattern, using default branch"
TARGET_BRANCH="$DEFAULT_BRANCH"
fi
echo "Final TARGET_BRANCH=$TARGET_BRANCH"
echo "TARGET_BRANCH=$TARGET_BRANCH" >> $GITHUB_ENV
- name: Set up Git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Merge pushed branch into target branch
run: |
if [ -z "$TARGET_BRANCH" ]; then
echo "No pull request metadata found. Skipping merge."
exit 0
fi
git config --global --add safe.directory "$(pwd)"
git fetch origin $TARGET_BRANCH
git checkout $TARGET_BRANCH
git merge $GITHUB_REF --no-ff --message "Merging $GITHUB_REF into $TARGET_BRANCH"
env:
GITHUB_REF: ${{ github.ref }}
#### End of git merge
- name: Set up fvdb_test Conda env
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
conda-remove-defaults: "true"
activate-environment: fvdb_test
environment-file: fvdb/env/test_environment.yml
- name: Download package
uses: actions/download-artifact@v4
with:
name: fvdb-test-package
path: ./dist
- name: Install package
run: |
conda activate fvdb_test
pip install ./dist/*.whl
- name: Disable git ownership verification
run: |
git config --global --add safe.directory "$(pwd)"
- name: Run benchmarks
run: |
cd fvdb/tests;
pytest benchmark --benchmark-json benchmark/output.json
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Python Benchmark with pytest-benchmark
tool: 'pytest'
output-file-path: fvdb/tests/benchmark/output.json
# Use personal access token instead of GITHUB_TOKEN due to https://github.community/t/github-action-not-triggering-gh-pages-upon-push/16096
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '200%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@NVIDIA-Omniverse/fvdb-dev'
- name: Cleanup
if: always()
run: |
echo "Cleaning up /__w/_temp directory"
sudo rm -rf /__w/_temp/*
echo "Cleanup completed"