-
Notifications
You must be signed in to change notification settings - Fork 7
134 lines (118 loc) · 5.89 KB
/
check-visionos.yml
File metadata and controls
134 lines (118 loc) · 5.89 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
name: Check visionOS
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-visionos:
name: Test Ferric with visionOS Triplets
runs-on: macos-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/jod
# Install nightly Rust for -Zbuild-std support (required for tier 3 visionOS targets)
- name: Install Rust nightly with visionOS source
run: |
rustup toolchain install nightly --component rust-src
rustup default nightly
# Set up Xcode and visionOS SDK (required for visionOS compilation)
- name: Setup Xcode and verify visionOS SDK
run: |
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
# Verify visionOS SDK is available
if xcrun --sdk xros --show-sdk-path; then
echo "visionOS SDK found at: $(xcrun --sdk xros --show-sdk-path)"
else
echo "⚠️ visionOS SDK not found - may need Xcode 15+ with visionOS support"
fi
# Install required iOS target for the bootstrap process
- run: rustup target add aarch64-apple-ios-sim
- run: npm ci
- run: npm run build
# Bootstrap host package to get weak-node-api and ferric-example with visionOS support
- run: npm run bootstrap --workspace react-native-node-api
env:
CMAKE_RN_TRIPLETS: arm64-apple-visionos,arm64-apple-visionos-sim
- name: Configure Cargo for visionOS tier 3 targets with build-std
run: |
# Create cargo config for build-std support (tier 3 visionOS targets)
# Per official docs: build-std requires nightly Cargo + rustc + rust-src component
mkdir -p packages/ferric-example/.cargo
cat > packages/ferric-example/.cargo/config.toml << 'EOF'
[unstable]
build-std = ["std", "panic_abort"]
[build]
target = ["aarch64-apple-visionos", "aarch64-apple-visionos-sim"]
[target.aarch64-apple-visionos]
linker = "clang"
[target.aarch64-apple-visionos-sim]
linker = "clang"
EOF
# Verify cargo config is properly set
echo "Cargo config created:"
cat packages/ferric-example/.cargo/config.toml
# Test visionOS target availability and setup for build-std
- name: Test visionOS Rust targets installation
run: |
echo "Testing visionOS target availability on macOS..."
# First, try the standard installation (might work on macOS with proper Xcode)
if rustup target add aarch64-apple-visionos aarch64-apple-visionos-sim; then
echo "✅ visionOS targets successfully installed via rustup"
else
echo "⚠️ visionOS targets not available via rustup - this may be expected for tier 3 targets"
echo "The build will rely on -Zbuild-std to compile from source"
# Let's see if we can force the issue by testing direct compilation
echo "Testing if rustc can compile for visionOS targets with build-std..."
# Create a minimal test to see if the targets work with build-std
echo 'fn main() { println!("Hello visionOS!"); }' > /tmp/visionos_test.rs
if rustc -Z build-std=std,panic_abort --target aarch64-apple-visionos /tmp/visionos_test.rs -o /tmp/visionos_test 2>/dev/null; then
echo "✅ Direct compilation with build-std works for aarch64-apple-visionos"
else
echo "❌ Direct compilation failed - may need proper SDK setup"
fi
fi
- name: Verify build-std setup and bootstrap ferric-example
run: |
# Verify nightly toolchain and components
echo "=== Rust Toolchain Info ==="
rustc --version
cargo --version
rustup component list --installed --toolchain nightly
echo "=== Installed Rust Targets ==="
rustup target list --installed --toolchain nightly
echo "=== Testing visionOS SDK availability ==="
xcrun --sdk xros --show-sdk-path || echo "visionOS SDK not available - continuing anyway"
echo "=== Bootstrapping ferric-example with visionOS targets ==="
cd packages/ferric-example
ls -la .cargo/ || echo "No .cargo dir found"
cat .cargo/config.toml || echo "No config found"
cd ../..
# Try to bootstrap ferric-example with visionOS targets
# If Ferric's target validation fails, we'll try to bypass it or test manually
echo "Attempting to bootstrap ferric-example with visionOS targets..."
if ! npm run bootstrap --workspace @react-native-node-api/ferric-example; then
echo "❌ Bootstrap failed - likely due to Ferric's target validation"
echo "This confirms the hypothesis that Ferric's ensureInstalledTargets() prevents build-std usage"
echo "Analyzing the specific error to understand if the build would actually work..."
# Test if we can compile directly with cargo and build-std
cd packages/ferric-example
echo "Testing direct cargo compilation with build-std..."
cargo build --target aarch64-apple-visionos || echo "Direct cargo build also failed"
cd ../..
else
echo "✅ Bootstrap succeeded!"
fi
env:
CMAKE_RN_TRIPLETS: arm64-apple-visionos,arm64-apple-visionos-sim
FERRIC_TARGETS: aarch64-apple-visionos,aarch64-apple-visionos-sim
# visionOS SDK configuration
XROS_DEPLOYMENT_TARGET: "1.0"