Skip to content

Commit 42ddb60

Browse files
felixtrzmeta-codesync[bot]
authored andcommitted
chore(ci): add Meta Spatial Editor CLI setup for GLXF generation in CI builds
Summary: Download and configure Meta Spatial Editor CLI in build-examples.sh for Linux/CI environments only (skipped on macOS). Pass CLI path to generateGLXF plugin via META_SPATIAL_EDITOR_CLI_PATH env var. Also upgrades pnpm to v10 in deploy workflow and adds --no-frozen-lockfile flag only when running in CI. Reviewed By: zjm-meta Differential Revision: D90213384 Privacy Context Container: L1334777 fbshipit-source-id: a8ab6be27685bcfc430ae79ebf1c809714d68cab
1 parent 7f8c5bd commit 42ddb60

File tree

9 files changed

+74
-5
lines changed

9 files changed

+74
-5
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Setup pnpm
2828
uses: pnpm/action-setup@v2
2929
with:
30-
version: 8
30+
version: 10
3131

3232
- name: Setup Node.js
3333
uses: actions/setup-node@v4
@@ -39,7 +39,7 @@ jobs:
3939
uses: actions/configure-pages@v4
4040

4141
- name: Install dependencies
42-
run: pnpm install --no-frozen-lockfile
42+
run: pnpm install
4343

4444
- name: Build documentation
4545
run: pnpm docs:build

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,6 @@ example-local-build/**/public/ui/
8989
# Auto generated version files
9090
**/version.ts
9191
**/version.js
92+
93+
# Meta Spatial Editor CLI (downloaded by build-examples.sh in CI)
94+
.meta-spatial-cli/

examples/audio/vite.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ export default defineConfig({
4141

4242
// GLXF generation plugin with file watcher
4343
generateGLXF({
44+
...(process.env.META_SPATIAL_EDITOR_CLI_PATH && {
45+
metaSpatialCliPath: process.env.META_SPATIAL_EDITOR_CLI_PATH,
46+
}),
4447
metaSpatialDir: 'metaspatial',
4548
outputDir: 'public/glxf', // Match the manual CLI test output
4649
verbose: false,

examples/grab/vite.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ export default defineConfig({
4141

4242
// GLXF generation plugin with file watcher
4343
generateGLXF({
44+
...(process.env.META_SPATIAL_EDITOR_CLI_PATH && {
45+
metaSpatialCliPath: process.env.META_SPATIAL_EDITOR_CLI_PATH,
46+
}),
4447
metaSpatialDir: 'metaspatial',
4548
outputDir: 'public/glxf', // Match the manual CLI test output
4649
verbose: false,

examples/locomotion/vite.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ export default defineConfig({
3333

3434
// GLXF generation plugin with file watcher
3535
generateGLXF({
36+
...(process.env.META_SPATIAL_EDITOR_CLI_PATH && {
37+
metaSpatialCliPath: process.env.META_SPATIAL_EDITOR_CLI_PATH,
38+
}),
3639
metaSpatialDir: 'metaspatial',
3740
outputDir: 'public/glxf', // Match the manual CLI test output
3841
verbose: false,

examples/physics/vite.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export default defineConfig({
4040

4141
// GLXF generation plugin with file watcher
4242
generateGLXF({
43+
...(process.env.META_SPATIAL_EDITOR_CLI_PATH && {
44+
metaSpatialCliPath: process.env.META_SPATIAL_EDITOR_CLI_PATH,
45+
}),
4346
metaSpatialDir: 'metaspatial',
4447
outputDir: 'public/glxf', // Match the manual CLI test output
4548
verbose: false,

examples/scene-understanding/vite.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export default defineConfig({
4040

4141
// GLXF generation plugin with file watcher
4242
generateGLXF({
43+
...(process.env.META_SPATIAL_EDITOR_CLI_PATH && {
44+
metaSpatialCliPath: process.env.META_SPATIAL_EDITOR_CLI_PATH,
45+
}),
4346
metaSpatialDir: 'metaspatial',
4447
outputDir: 'public/glxf', // Match the manual CLI test output
4548
verbose: false,

scripts/build-examples.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,50 @@ BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
1313
EXAMPLES_DIR="$BASE_DIR/examples"
1414
DOCS_EXAMPLES_DIR="$BASE_DIR/docs/.vitepress/dist/examples"
1515

16+
# Download and setup Meta Spatial Editor CLI for Linux (CI only)
17+
if [[ "$(uname)" == "Linux" ]]; then
18+
CLI_DIR="$BASE_DIR/.meta-spatial-cli"
19+
CLI_URL="https://securecdn-sjc6-1.oculus.com/binaries/download/?id=32756129430698033"
20+
21+
echo "📥 Downloading Meta Spatial Editor CLI..."
22+
mkdir -p "$CLI_DIR"
23+
cd "$CLI_DIR"
24+
25+
if ! curl -L -o meta-spatial-cli.tar.gz "$CLI_URL"; then
26+
echo "❌ Failed to download CLI"
27+
exit 1
28+
fi
29+
30+
echo "📦 Extracting CLI..."
31+
if ! tar -xzf meta-spatial-cli.tar.gz; then
32+
echo "❌ Failed to extract CLI"
33+
exit 1
34+
fi
35+
36+
# Make CLI executable
37+
chmod +x meta-spatial-editor-cli-linux-dist/MetaSpatialEditorCLI
38+
chmod +x meta-spatial-editor-cli-linux-dist/meta-spatial-editor-cli
39+
40+
CLI_PATH="$CLI_DIR/meta-spatial-editor-cli-linux-dist/MetaSpatialEditorCLI"
41+
42+
# Verify CLI works
43+
echo "🔍 Verifying CLI installation..."
44+
if ! "$CLI_PATH" version; then
45+
echo "❌ CLI verification failed"
46+
exit 1
47+
fi
48+
49+
echo "✅ CLI ready at: $CLI_PATH"
50+
echo ""
51+
52+
# Export CLI path for use in builds
53+
export META_SPATIAL_EDITOR_CLI_PATH="$CLI_PATH"
54+
55+
cd "$BASE_DIR"
56+
else
57+
echo "⏭️ Skipping Meta Spatial Editor CLI download (non-Linux environment)"
58+
fi
59+
1660
# Track build results
1761
FAILED_EXAMPLES=()
1862
SUCCESS_COUNT=0

scripts/build-tgz.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ set -e
1111

1212
echo "🚀 Building standalone tgz packages..."
1313

14+
# Detect CI environment and set pnpm install flags
15+
PNPM_INSTALL_FLAGS=""
16+
if [ -n "$CI" ] || [ -n "$GITHUB_ACTIONS" ]; then
17+
echo "🔍 CI environment detected, using --no-frozen-lockfile"
18+
PNPM_INSTALL_FLAGS="--no-frozen-lockfile"
19+
fi
20+
1421
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
1522
UNAME=$(uname)
1623
if [[ "$UNAME" == CYGWIN* || "$UNAME" == MINGW* ]]; then
@@ -144,7 +151,7 @@ build_root_packages() {
144151

145152
# Install the file dependencies
146153
echo " 📥 Installing file dependencies..."
147-
pnpm install
154+
pnpm install $PNPM_INSTALL_FLAGS
148155

149156
# Clean and build
150157
rm -rf lib dist build *.tgz
@@ -164,7 +171,7 @@ build_root_packages() {
164171
# Restore original package.json and reinstall workspace dependencies
165172
echo " 🔄 Restoring workspace dependencies..."
166173
restore_package_json "$package_dir"
167-
pnpm install --silent
174+
pnpm install --silent $PNPM_INSTALL_FLAGS
168175
done
169176
}
170177

@@ -178,7 +185,7 @@ cleanup() {
178185
if [ -f "$package_dir/package.json.backup" ]; then
179186
restore_package_json "$package_dir"
180187
cd "$package_dir"
181-
pnpm install --silent
188+
pnpm install --silent $PNPM_INSTALL_FLAGS
182189
fi
183190
done
184191
}

0 commit comments

Comments
 (0)