-
Notifications
You must be signed in to change notification settings - Fork 25
276 lines (248 loc) · 11.8 KB
/
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
272
273
274
275
276
name: CI Workflow
on:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
# Cron runs at 16:00 UTC which corresponds to 09:00 AM PT
- cron: "0 16 * * 1"
jobs:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: Setup Matrix
id: set-matrix
run: |
if [ "${{ github.event_name }}" == "schedule" ]; then
MATRIX_FILE="${{ github.workspace }}/test/full_versions.json"
else
MATRIX_FILE="${{ github.workspace }}/test/pr_versions.json"
fi
JSON=$(jq -c . < "$MATRIX_FILE")
MODIFIED_JSON='{"include":[]}'
PLUGINS=("GLTF" "PLY" "OBJ" "STL" "FBX")
for row in $(echo "${JSON}" | jq -c '.include[]'); do
for plugin in "${PLUGINS[@]}"; do
NEW_ROW=$(echo "$row" | jq '. + {"config":"'$plugin'"}')
MODIFIED_JSON=$(echo "$MODIFIED_JSON" | jq '.include += ['"$NEW_ROW"']')
done
ALL_ON_ROW=$(echo "$row" | jq '. + {"config":"ALL"}')
MODIFIED_JSON=$(echo "$MODIFIED_JSON" | jq '.include += ['"$ALL_ON_ROW"']')
done
echo "matrix=$(echo "$MODIFIED_JSON" | jq -c .)" >> $GITHUB_OUTPUT
build:
needs: prepare-matrix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.prepare-matrix.outputs.matrix)}}
name: build (${{ matrix.os }}-${{ matrix.usd_version }}-${{ matrix.config }})
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10.11"
id: setup-python
- name: Install Ninja (Cross-platform)
run: |
python -m pip install ninja
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y unzip
sudo apt-get remove --purge -y cmake
wget https://cmake.org/files/v3.24/cmake-3.24.4-linux-x86_64.sh
chmod +x cmake-3.24.4-linux-x86_64.sh
sudo ./cmake-3.24.4-linux-x86_64.sh --prefix=/usr/local --skip-license
cmake --version
- name: Install dependencies on Windows
if: runner.os == 'Windows'
run: choco install 7zip
- name: Install dependencies on macOS
if: runner.os == 'macOS'
run: |
brew install libheif libraw openjpeg || true
- name: Download release asset
run: gh release download USD-${{ matrix.usd_version }}-Artifacts -p "usd-${{ matrix.usd_version }}-${{ matrix.os }}.zip" --repo ${{ github.repository }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Unzip artifact Windows
if: runner.os == 'Windows'
run: Expand-Archive -Path "usd-${{ matrix.usd_version }}-${{ matrix.os }}.zip" -DestinationPath usd_build -Force
- name: Unzip artifact Unix
if: runner.os != 'Windows'
run: unzip -q usd-${{ matrix.usd_version }}-${{ matrix.os }}.zip -d usd_build
- name: Set Environment Variables
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
echo "${PYTHON_PATH}" >> "$GITHUB_PATH"
echo "${{ github.workspace }}/usd_build/bin" >> "$GITHUB_PATH"
echo "${{ github.workspace }}/usd_build/lib" >> "$GITHUB_PATH"
echo "${{ github.workspace }}/usd_build/lib64" >> "$GITHUB_PATH"
echo "${{ github.workspace }}/usd_build/plugin/usd" >> "$GITHUB_PATH"
echo "${{ github.workspace }}/bin/bin" >> "$GITHUB_PATH"
echo "${{ github.workspace }}/bin/plugin/usd" >> "$GITHUB_PATH"
echo "PXR_PLUGINPATH_NAME=${{ github.workspace }}/bin/plugin/usd;${{ github.workspace }}/usd_build/plugin/usd" >> "$GITHUB_ENV"
else
# Concatenate paths for LD_LIBRARY_PATH
ldLibraryPath="${{ github.workspace }}/usd_build/bin:"
ldLibraryPath+="${{ github.workspace }}/usd_build/lib:"
ldLibraryPath+="${{ github.workspace }}/usd_build/lib64:"
ldLibraryPath+="${{ github.workspace }}/usd_build/plugin/usd:"
ldLibraryPath+="${{ github.workspace }}/bin/bin:"
ldLibraryPath+="${{ github.workspace }}/bin/lib:"
ldLibraryPath+="${{ github.workspace }}/bin/plugin/usd"
echo "LD_LIBRARY_PATH=$ldLibraryPath" >> "$GITHUB_ENV"
echo "PXR_PLUGINPATH_NAME=${{ github.workspace }}/bin/plugin/usd:${{ github.workspace }}/usd_build/plugin/usd" >> "$GITHUB_ENV"
fi
USD_BUILD_PATH="${{ github.workspace }}/usd_build"
USD_BUILD_PATH="${USD_BUILD_PATH//\\//}"
echo "USD_BUILD_PATH=$USD_BUILD_PATH" >> "$GITHUB_ENV"
echo "PYTHONPATH=${{ github.workspace }}/usd_build/lib/python" >> "$GITHUB_ENV"
- name: Get latest successful run ID of the fbx sdk workflow
shell: bash
if: matrix.config == 'FBX' || matrix.config == 'ALL'
id: get-run-id
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RUN_ID=$(gh run list --repo ${{ github.repository }} --workflow fbx-sdk.yml --limit 1 --json databaseId,status --jq '.[] | select(.status=="completed") | .databaseId')
echo "RUN_ID=$RUN_ID" >> $GITHUB_ENV
echo "Run ID: $RUN_ID"
- name: Download FBX SDK Artifact
if: matrix.config == 'FBX' || matrix.config == 'ALL'
uses: actions/download-artifact@v4
with:
name: ${{ runner.os }}-FBX-SDK
path: ${{ github.workspace }}/FBXSDK
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
run-id: ${{ env.RUN_ID }}
- name: Set up FBX
if: matrix.config == 'FBX' || matrix.config == 'ALL'
shell: bash
run: |
FBX_FOLDER=$(echo "${{ github.workspace }}/FBXSDK" | sed 's|\\|/|g')
echo "FBX_FOLDER=$FBX_FOLDER" >> $GITHUB_ENV
if [ "${{ runner.os }}" == "Windows" ]; then
echo "FBX_OUTFILE=$FBX_FOLDER/fbx202037_fbxsdk_vs2022_win.exe" >> $GITHUB_ENV
elif [ "${{ runner.os }}" == "macOS" ]; then
echo "FBX_OUTFILE=$FBX_FOLDER/fbx202037_fbxsdk_clang_mac.pkg" >> $GITHUB_ENV
else
echo "FBX_OUTFILE=$FBX_FOLDER/fbx202037_fbxsdk_gcc_linux" >> $GITHUB_ENV
fi
- name: Install FBX SDK Windows
if: runner.os == 'Windows' && (matrix.config == 'FBX' || matrix.config == 'ALL')
shell: bash
run: |
mkdir -p ${{ env.FBX_FOLDER }}
FBX_INSTALL_DIR=$(echo "${{ github.workspace }}/FBX_SDK_INSTALL" | sed 's|\\|/|g')
mkdir -p $FBX_INSTALL_DIR
7z x "$FBX_OUTFILE" -o"$FBX_INSTALL_DIR" -y
echo "FBX_INSTALL_DIR=$FBX_INSTALL_DIR" >> $GITHUB_ENV
- name: Install FBX SDK Unix
if: runner.os != 'Windows' && (matrix.config == 'FBX' || matrix.config == 'ALL')
run: |
mkdir -p ${{ env.FBX_FOLDER }}
if [ "${{ runner.os }}" == "macOS" ]; then
FBX_INSTALL_DIR="/Applications/Autodesk/FBXSDK/2020.3.7"
tar -xzf ${{ env.FBX_OUTFILE }}.tgz -C ${{ env.FBX_FOLDER }}
FBX_OUTFILE_CORRECTED=$(echo "${{ env.FBX_OUTFILE }}" | sed 's/_mac.pkg/_macos.pkg/')
sudo installer -pkg $FBX_OUTFILE_CORRECTED -target / -verboseR
sudo mv "/Applications/Autodesk/FBX SDK/" "/Applications/Autodesk/FBXSDK"
else # Linux
FBX_INSTALL_DIR=${{ github.workspace }}/FBX_SDK_INSTALL
chmod +r ${{ env.FBX_OUTFILE }}.tar.gz
tar -xzf ${{ env.FBX_OUTFILE }}.tar.gz -C ${{ env.FBX_FOLDER }}
mkdir -p ${{ github.workspace }}/FBX_SDK_INSTALL
yes yes | ${{ env.FBX_FOLDER }}/fbx202037_fbxsdk_linux $FBX_INSTALL_DIR
fi
echo "FBX_INSTALL_DIR=$FBX_INSTALL_DIR" >> $GITHUB_ENV
- name: Configure CMake (Cross-Platform)
shell: bash
run: |
baseArgs="-S . -B build -G Ninja"
commonArgs=(
"-DCMAKE_INSTALL_PREFIX=bin"
"-DCMAKE_BUILD_TYPE=Release"
"-Dpxr_ROOT=${{ github.workspace }}/usd_build"
"-DUSD_FILEFORMATS_ENABLE_GLTF=$([[ "${{ matrix.config }}" == "ALL" || "${{ matrix.config }}" == "GLTF" ]] && echo "ON" || echo "OFF")"
"-DUSD_FILEFORMATS_ENABLE_PLY=$([[ "${{ matrix.config }}" == "ALL" || "${{ matrix.config }}" == "PLY" ]] && echo "ON" || echo "OFF")"
"-DUSD_FILEFORMATS_ENABLE_OBJ=$([[ "${{ matrix.config }}" == "ALL" || "${{ matrix.config }}" == "OBJ" ]] && echo "ON" || echo "OFF")"
"-DUSD_FILEFORMATS_ENABLE_STL=$([[ "${{ matrix.config }}" == "ALL" || "${{ matrix.config }}" == "STL" ]] && echo "ON" || echo "OFF")"
"-DUSD_FILEFORMATS_ENABLE_FBX=$([[ "${{ matrix.config }}" == "ALL" || "${{ matrix.config }}" == "FBX" ]] && echo "ON" || echo "OFF")"
"-DFBXSDK_ROOT=${{ env.FBX_INSTALL_DIR }}"
"-DUSD_FILEFORMATS_BUILD_TESTS=ON"
"-DOpenImageIO_INCLUDE_DIR=${{ github.workspace }}/usd_build/include"
"-DOpenImageIO_INCLUDES=${{ github.workspace }}/usd_build/include"
"-DPython3_LIBRARY="
"-DPython3_INCLUDE_DIR="
"-DPython3_VERSION=3.10.11"
)
# Platform specific arguments based on RUNNER_OS
if [ "$RUNNER_OS" == "Linux" ]; then
libFolder="lib64"
else
libFolder="lib"
fi
platformArgs=(
"-DOpenImageIO_DIR=${{ github.workspace }}/usd_build/${libFolder}/cmake/OpenImageIO"
"-DOpenImageIO_LIB_DIR=${{ github.workspace }}/usd_build/${libFolder}/cmake/OpenImageIO"
)
fullCmakeArgs="$baseArgs ${commonArgs[@]} ${platformArgs[@]}"
cmake $fullCmakeArgs
- name: Build and Display Linker Command
run: cmake --build build --config Release
- name: Install
run: cmake --install build --config Release
- name: Remap Dependency in dylib Files
if: runner.os == 'macOS'
shell: bash
run: |
for dylib in ${{ github.workspace }}/bin/plugin/usd/*.dylib; do
if otool -L "$dylib" | grep -q "@rpath/libfileformatUtils.dylib"; then
echo "Remapping @rpath for $dylib"
install_name_tool -change @rpath/libfileformatUtils.dylib ${{ github.workspace }}/bin/lib/libfileformatUtils.dylib "$dylib"
fi
done
- name: Install test requirements
run: pip install -r scripts/requirements.txt
- name: Run tests and inspect dependencies
shell: bash
run: |
cd build
ctest -VV -C Release
result=$?
echo "Test exit status: $result"
suffix="${{ matrix.os }}-${{ matrix.usd_version }}-${{ matrix.config }}"
if [[ "$result" -eq 0 ]]; then
echo "BUILD_STATUS_STRING=Passed" >> $GITHUB_ENV
echo "BUILD_STATUS_COLOR=#00cc11" >> $GITHUB_ENV
else
echo "BUILD_STATUS_STRING=Failed" >> $GITHUB_ENV
echo "BUILD_STATUS_COLOR=red" >> $GITHUB_ENV
fi
- name: Handle Failure
if: failure()
run: |
echo "BUILD_STATUS_STRING=Failed" >> $GITHUB_ENV
echo "BUILD_STATUS_COLOR=red" >> $GITHUB_ENV
- name: Update Badge
if: always()
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 264643f3d2acacc5369a0ba70854dfb6
filename: ${{ matrix.os }}-${{ matrix.usd_version }}-${{ matrix.config }}.json
label: ${{ matrix.os }}-${{ matrix.usd_version }}-${{ matrix.config }}
message: ${{ env.BUILD_STATUS_STRING }}
color: "${{ env.BUILD_STATUS_COLOR }}"
forceUpdate: true