Skip to content

Commit 1ea3a02

Browse files
committed
fix: fresh user test — unset MCPP_VENDORED_XLINGS, keep MCPP_HOME
The test should verify mcpp works WITHOUT MCPP_VENDORED_XLINGS (using its own bundled xlings). Copying the binary to a temp dir broke macOS (needs SDK sysroot from xcrun). Instead, use the self-hosted binary in-place with env vars cleared.
1 parent 6ede7e1 commit 1ea3a02

3 files changed

Lines changed: 24 additions & 59 deletions

File tree

.github/workflows/ci-macos.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -318,23 +318,16 @@ jobs:
318318
319319
- name: Fresh user experience (clean env, mcpp new → build → run)
320320
run: |
321+
# Use the self-hosted mcpp with its existing MCPP_HOME but
322+
# unset MCPP_VENDORED_XLINGS to test self-contained behavior.
321323
MCPP=$(find target -path "*/bin/mcpp" | head -1)
322324
MCPP=$(cd "$(dirname "$MCPP")" && pwd)/$(basename "$MCPP")
323325
FRESH=$(mktemp -d)
324-
INSTALL="$FRESH/mcpp-install"
325-
mkdir -p "$INSTALL/bin"
326-
cp "$MCPP" "$INSTALL/bin/mcpp"
327-
cp -r "$HOME/.mcpp/registry" "$INSTALL/registry" 2>/dev/null || true
328-
cp "$HOME/.mcpp/config.toml" "$INSTALL/config.toml" 2>/dev/null || true
329-
330-
env -u MCPP_HOME -u MCPP_VENDORED_XLINGS -u XLINGS_BIN \
331-
bash -c "
332-
cd '$FRESH'
333-
'$INSTALL/bin/mcpp' new hello
334-
cd hello
335-
'$INSTALL/bin/mcpp' build
336-
out=\$('$INSTALL/bin/mcpp' run 2>&1)
337-
echo \"\$out\"
338-
echo \"\$out\" | grep -q 'Hello from hello' || { echo 'FAIL: unexpected output'; exit 1; }
339-
echo ':: Fresh user experience PASS'
340-
"
326+
cd "$FRESH"
327+
env -u MCPP_VENDORED_XLINGS "$MCPP" new hello
328+
cd hello
329+
env -u MCPP_VENDORED_XLINGS "$MCPP" build
330+
out=$(env -u MCPP_VENDORED_XLINGS "$MCPP" run 2>&1)
331+
echo "$out"
332+
echo "$out" | grep -q "Hello from hello" || { echo "FAIL: unexpected output"; exit 1; }
333+
echo ":: Fresh user experience PASS"

.github/workflows/ci-windows.yml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -111,32 +111,16 @@ jobs:
111111
- name: Fresh user experience (clean env, mcpp new → build → run)
112112
shell: bash
113113
run: |
114-
# Simulate a real user: clean environment, no MCPP_HOME,
115-
# no MCPP_VENDORED_XLINGS. Use the self-hosted binary which
116-
# is self-contained (has bundled xlings in its registry/).
117-
FRESH=$(mktemp -d)
118-
# Copy the self-hosted mcpp into a release-like layout
119-
INSTALL_DIR="$FRESH/mcpp-install"
120-
mkdir -p "$INSTALL_DIR/bin" "$INSTALL_DIR/registry/bin"
121-
cp "$MCPP_SELF" "$INSTALL_DIR/bin/mcpp.exe"
122-
# Copy xlings + sandbox from the build so mcpp is self-contained
123-
cp -r "$USERPROFILE/.mcpp/registry/bin/xlings.exe" "$INSTALL_DIR/registry/bin/" 2>/dev/null || true
124-
cp -r "$USERPROFILE/.mcpp/registry/data" "$INSTALL_DIR/registry/data" 2>/dev/null || true
125-
cp -r "$USERPROFILE/.mcpp/registry/subos" "$INSTALL_DIR/registry/subos" 2>/dev/null || true
126-
cp "$USERPROFILE/.mcpp/config.toml" "$INSTALL_DIR/config.toml" 2>/dev/null || true
127-
128-
MCPP_BIN="$INSTALL_DIR/bin/mcpp.exe"
129-
130-
# Clear all mcpp/xlings env vars
131-
unset MCPP_HOME
114+
# Unset MCPP_VENDORED_XLINGS — mcpp should use its own bundled xlings.
115+
# MCPP_HOME stays (resolved from binary location by mcpp itself).
132116
unset MCPP_VENDORED_XLINGS
133117
unset XLINGS_BIN
134-
118+
FRESH=$(mktemp -d)
135119
cd "$FRESH"
136-
"$MCPP_BIN" new hello
120+
"$MCPP_SELF" new hello
137121
cd hello
138-
"$MCPP_BIN" build
139-
out=$("$MCPP_BIN" run 2>&1)
122+
"$MCPP_SELF" build
123+
out=$("$MCPP_SELF" run 2>&1)
140124
echo "$out"
141125
echo "$out" | grep -q "Hello from hello" || { echo "FAIL: unexpected output"; exit 1; }
142126
echo ":: Fresh user experience PASS"

.github/workflows/ci.yml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -138,23 +138,11 @@ jobs:
138138
run: |
139139
MCPP=$(realpath "$(find target -type f -name mcpp -printf '%T@ %p\n' | sort -rn | head -1 | cut -d' ' -f2)")
140140
FRESH=$(mktemp -d)
141-
# Create a release-like self-contained layout
142-
INSTALL="$FRESH/mcpp-install"
143-
mkdir -p "$INSTALL/bin"
144-
cp "$MCPP" "$INSTALL/bin/mcpp"
145-
# Copy registry so mcpp is self-contained
146-
cp -r "$HOME/.mcpp/registry" "$INSTALL/registry" 2>/dev/null || true
147-
cp "$HOME/.mcpp/config.toml" "$INSTALL/config.toml" 2>/dev/null || true
148-
149-
# Clear all mcpp env vars — simulate real user
150-
env -u MCPP_HOME -u MCPP_VENDORED_XLINGS -u XLINGS_BIN \
151-
bash -c "
152-
cd '$FRESH'
153-
'$INSTALL/bin/mcpp' new hello
154-
cd hello
155-
'$INSTALL/bin/mcpp' build
156-
out=\$('$INSTALL/bin/mcpp' run 2>&1)
157-
echo \"\$out\"
158-
echo \"\$out\" | grep -q 'Hello from hello' || { echo 'FAIL: unexpected output'; exit 1; }
159-
echo ':: Fresh user experience PASS'
160-
"
141+
cd "$FRESH"
142+
env -u MCPP_VENDORED_XLINGS "$MCPP" new hello
143+
cd hello
144+
env -u MCPP_VENDORED_XLINGS "$MCPP" build
145+
out=$(env -u MCPP_VENDORED_XLINGS "$MCPP" run 2>&1)
146+
echo "$out"
147+
echo "$out" | grep -q "Hello from hello" || { echo "FAIL: unexpected output"; exit 1; }
148+
echo ":: Fresh user experience PASS"

0 commit comments

Comments
 (0)