Skip to content

Commit 7ad9129

Browse files
committed
test: harden git probes (cmd /c), add xim:git shim stage
1 parent 06b4348 commit 7ad9129

1 file changed

Lines changed: 64 additions & 26 deletions

File tree

.github/workflows/temp-windows-no-git-user-flow.yml

Lines changed: 64 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
# 3. xlings install mcpp
77
# 4. mcpp new hello && cd hello && mcpp build (expected to fail)
88
# 5. mcpp self init --force (expected to fail)
9-
# 6. root-cause probes:
9+
# 6. install xim:git (creates the xvm git shim -> `git --version` works
10+
# in the user env, matching the reported machine state), re-run mcpp
11+
# 7. root-cause probes:
1012
# - `git --version` in the user env (xvm shim → expected OK)
1113
# - `git --version` with XLINGS_HOME redirected to ~/.mcpp/registry
1214
# (expected: "xlings: 'git' is not installed" — the smoking gun)
@@ -85,7 +87,6 @@ jobs:
8587
8688
- name: "Stage 1b: xlings sanity check"
8789
run: |
88-
Write-Host "PATH = $env:Path"
8990
Write-Host "XLINGS_HOME = $env:XLINGS_HOME"
9091
xlings --version
9192
exit $LASTEXITCODE
@@ -97,58 +98,93 @@ jobs:
9798
xlings install mcpp -y
9899
exit $LASTEXITCODE
99100
100-
- name: "Stage 2b: post-install git/shim state"
101+
- name: "Stage 2b: post-install git/shim/mcpp state"
101102
if: always()
102103
run: |
103104
Write-Host "=== where git ==="
104-
where.exe git 2>$null | ForEach-Object { Write-Host $_ }
105-
Write-Host "=== git --version (user env; expected to work via xvm shim) ==="
106-
git --version
107-
Write-Host "git exit code: $LASTEXITCODE"
105+
$git = @(where.exe git 2>$null)
106+
if ($git.Count -gt 0) {
107+
$git | ForEach-Object { Write-Host $_ }
108+
cmd /c "git --version 2>&1"
109+
Write-Host "git --version exit code: $LASTEXITCODE"
110+
} else {
111+
Write-Host "(git not resolvable)"
112+
}
108113
Write-Host "=== where mcpp ==="
109114
where.exe mcpp 2>$null | ForEach-Object { Write-Host $_ }
110-
Write-Host "=== ~/.xlings layout (top level) ==="
111-
Get-ChildItem "$env:USERPROFILE\.xlings" -ErrorAction SilentlyContinue | Select-Object Name
112-
Get-ChildItem "$env:USERPROFILE\.xlings\subos\current\bin" -ErrorAction SilentlyContinue | Select-Object Name
115+
cmd /c "mcpp --version 2>&1"
116+
Write-Host "mcpp --version exit code: $LASTEXITCODE"
117+
Write-Host "=== xvm shim dir ==="
118+
Get-ChildItem "$env:USERPROFILE\.xlings\subos\current\bin" -ErrorAction SilentlyContinue |
119+
ForEach-Object { Write-Host $_.Name }
113120
exit 0
114121
115-
- name: "Stage 3: mcpp new hello && mcpp build"
122+
- name: "Stage 3: mcpp new hello && mcpp build (fresh machine, no git anywhere)"
116123
id: build
117124
continue-on-error: true
118125
run: |
119-
mcpp new hello
120-
if ($LASTEXITCODE -ne 0) { Write-Host "mcpp new failed: $LASTEXITCODE"; exit $LASTEXITCODE }
126+
mcpp new hello 2>&1 | ForEach-Object { Write-Host $_ }
127+
if ($LASTEXITCODE -ne 0) { Write-Host "mcpp new exit code: $LASTEXITCODE"; exit 1 }
121128
cd hello
122-
mcpp build
129+
cmd /c "mcpp build 2>&1"
130+
Write-Host "mcpp build exit code: $LASTEXITCODE"
123131
exit $LASTEXITCODE
124132
125-
- name: "Stage 4: mcpp self init --force"
133+
- name: "Stage 4: mcpp self init --force (fresh machine, no git anywhere)"
126134
id: selfinit
127135
continue-on-error: true
128136
run: |
129-
mcpp self init --force
137+
cmd /c "mcpp self init --force 2>&1"
138+
Write-Host "exit code: $LASTEXITCODE"
130139
exit $LASTEXITCODE
131140
132-
- name: "Stage 5: root-cause probe — git shim vs redirected XLINGS_HOME"
141+
- name: "Stage 5: install xim:git -> user now has working `git --version` (reported machine state)"
142+
id: ximgit
143+
continue-on-error: true
144+
run: |
145+
xlings install xim:git -y
146+
Write-Host "xlings install xim:git exit code: $LASTEXITCODE"
147+
Write-Host "=== where git (after xim:git) ==="
148+
where.exe git 2>$null | ForEach-Object { Write-Host $_ }
149+
cmd /c "git --version 2>&1"
150+
Write-Host "git --version exit code: $LASTEXITCODE"
151+
exit $LASTEXITCODE
152+
153+
- name: "Stage 5b: re-run mcpp build + self init (git --version now OK in user env)"
154+
id: rebuild
155+
continue-on-error: true
156+
run: |
157+
cd hello
158+
cmd /c "mcpp build 2>&1"
159+
$buildRc = $LASTEXITCODE
160+
Write-Host "mcpp build exit code: $buildRc"
161+
cd ..
162+
cmd /c "mcpp self init --force 2>&1"
163+
$initRc = $LASTEXITCODE
164+
Write-Host "mcpp self init --force exit code: $initRc"
165+
if ($buildRc -ne 0 -or $initRc -ne 0) { exit 1 }
166+
exit 0
167+
168+
- name: "Stage 6: root-cause probe — git shim vs redirected XLINGS_HOME"
133169
if: always()
134170
run: |
135171
Write-Host "=== probe A: git --version with user XLINGS_HOME ($env:XLINGS_HOME) ==="
136-
git --version
172+
cmd /c "git --version 2>&1"
137173
Write-Host "exit code: $LASTEXITCODE"
138174
139175
Write-Host ""
140176
Write-Host "=== probe B: git --version with XLINGS_HOME=~/.mcpp/registry (what mcpp's subprocesses see) ==="
141177
$env:XLINGS_HOME = "$env:USERPROFILE\.mcpp\registry"
142-
git --version
178+
cmd /c "git --version 2>&1"
143179
Write-Host "exit code: $LASTEXITCODE"
144180
exit 0
145181
146-
- name: "Stage 6: dump mcpp sandbox state"
182+
- name: "Stage 7: dump mcpp sandbox state"
147183
if: always()
148184
run: |
149-
Write-Host "=== ~/.mcpp layout ==="
150-
Get-ChildItem "$env:USERPROFILE\.mcpp" -Recurse -Depth 2 -ErrorAction SilentlyContinue |
151-
Select-Object FullName | ForEach-Object { Write-Host $_.FullName }
185+
Write-Host "=== ~/.mcpp layout (depth 3) ==="
186+
Get-ChildItem "$env:USERPROFILE\.mcpp" -Recurse -Depth 3 -ErrorAction SilentlyContinue |
187+
ForEach-Object { Write-Host $_.FullName }
152188
153189
Write-Host "=== package index presence ==="
154190
foreach ($d in @(
@@ -174,9 +210,11 @@ jobs:
174210
"",
175211
"| step | outcome |",
176212
"|------|---------|",
177-
"| xlings install mcpp | ${{ steps.install_mcpp.outcome }} |",
178-
"| mcpp new + build | ${{ steps.build.outcome }} |",
179-
"| mcpp self init --force | ${{ steps.selfinit.outcome }} |"
213+
"| xlings install mcpp (no git) | ${{ steps.install_mcpp.outcome }} |",
214+
"| mcpp new + build (no git) | ${{ steps.build.outcome }} |",
215+
"| mcpp self init --force (no git) | ${{ steps.selfinit.outcome }} |",
216+
"| xlings install xim:git (user env) | ${{ steps.ximgit.outcome }} |",
217+
"| re-run build + self init (git shim OK) | ${{ steps.rebuild.outcome }} |"
180218
)
181219
$lines | Add-Content $env:GITHUB_STEP_SUMMARY
182220
$lines | ForEach-Object { Write-Host $_ }

0 commit comments

Comments
 (0)