Skip to content

Commit 7573f3b

Browse files
committed
fix: ci-fresh-install — no $MCPP var, just PATH; add mirror for LLVM
- Remove $MCPP variable, put freshly-built mcpp dir on PATH instead - All steps just use `mcpp` command directly - Linux LLVM step: add `mcpp self config --mirror GLOBAL` before toolchain install (CI runners are outside CN) - Windows: use pwsh throughout for native path handling
1 parent 7c05c1f commit 7573f3b

1 file changed

Lines changed: 34 additions & 35 deletions

File tree

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
name: ci-fresh-install
22

3-
# Fresh install CI — validates the first-time user experience on all platforms.
4-
# No sandbox/target caches: simulates a user who just installed mcpp.
5-
#
6-
# Flow: bootstrap mcpp via xlings → build this PR's mcpp from source →
7-
# use the freshly-built mcpp to: new → run
3+
# Fresh install CI — simulates first-time user experience on all platforms.
4+
# Flow: xlings install mcpp → build this PR → mcpp new hello → mcpp run
85

96
on:
107
push:
@@ -29,8 +26,7 @@ jobs:
2926
env:
3027
XLINGS_NON_INTERACTIVE: '1'
3128
run: |
32-
curl -fsSL https://github.com/d2learn/xlings/releases/download/v0.4.30/xlings-0.4.30-linux-x86_64.tar.gz -o /tmp/xlings.tar.gz
33-
tar -xzf /tmp/xlings.tar.gz -C /tmp
29+
curl -fsSL https://github.com/d2learn/xlings/releases/download/v0.4.30/xlings-0.4.30-linux-x86_64.tar.gz | tar -xzf - -C /tmp
3430
/tmp/xlings-0.4.30-linux-x86_64/subos/default/bin/xlings self install
3531
export PATH="$HOME/.xlings/subos/default/bin:$PATH"
3632
xlings install mcpp -y
@@ -39,24 +35,26 @@ jobs:
3935
- name: Build this PR's mcpp
4036
run: |
4137
mcpp build
42-
MCPP=$(realpath "$(find target -type f -name mcpp -printf '%T@ %p\n' | sort -rn | head -1 | cut -d' ' -f2)")
43-
echo "MCPP=$MCPP" >> "$GITHUB_ENV"
38+
# Put freshly-built mcpp first on PATH so subsequent steps use it
39+
MCPP_DIR=$(dirname "$(find target -type f -name mcpp -printf '%T@ %p\n' | sort -rn | head -1 | cut -d' ' -f2)")
40+
echo "$MCPP_DIR" >> "$GITHUB_PATH"
4441
45-
- name: "Fresh: mcpp new hello → mcpp run (GCC)"
42+
- name: "mcpp new hello → mcpp run (GCC)"
4643
run: |
4744
cd "$(mktemp -d)"
48-
"$MCPP" new hello
45+
mcpp new hello
4946
cd hello
50-
"$MCPP" run
47+
mcpp run
5148
52-
- name: "Fresh: install LLVM → mcpp new → mcpp run"
49+
- name: "install LLVM → mcpp new → mcpp run"
5350
run: |
54-
"$MCPP" toolchain install llvm 20.1.7
55-
"$MCPP" toolchain default llvm@20.1.7
51+
mcpp self config --mirror GLOBAL
52+
mcpp toolchain install llvm 20.1.7
53+
mcpp toolchain default llvm@20.1.7
5654
cd "$(mktemp -d)"
57-
"$MCPP" new hello_llvm
55+
mcpp new hello_llvm
5856
cd hello_llvm
59-
"$MCPP" run
57+
mcpp run
6058
6159
macos-fresh:
6260
name: macOS fresh install
@@ -69,8 +67,7 @@ jobs:
6967
env:
7068
XLINGS_NON_INTERACTIVE: '1'
7169
run: |
72-
curl -fsSL https://github.com/d2learn/xlings/releases/download/v0.4.30/xlings-0.4.30-macosx-arm64.tar.gz -o /tmp/xlings.tar.gz
73-
tar -xzf /tmp/xlings.tar.gz -C /tmp
70+
curl -fsSL https://github.com/d2learn/xlings/releases/download/v0.4.30/xlings-0.4.30-macosx-arm64.tar.gz | tar -xzf - -C /tmp
7471
/tmp/xlings-0.4.30-macosx-arm64/subos/default/bin/xlings self install
7572
export PATH="$HOME/.xlings/subos/default/bin:$PATH"
7673
xlings install mcpp -y
@@ -79,15 +76,15 @@ jobs:
7976
- name: Build this PR's mcpp
8077
run: |
8178
mcpp build
82-
MCPP=$(find target -type f -name mcpp ! -name '*.o' | head -1)
83-
echo "MCPP=$(cd "$(dirname "$MCPP")" && pwd)/$(basename "$MCPP")" >> "$GITHUB_ENV"
79+
MCPP_DIR=$(dirname "$(find target -type f -name mcpp ! -name '*.o' | head -1)")
80+
echo "$(cd "$MCPP_DIR" && pwd)" >> "$GITHUB_PATH"
8481
85-
- name: "Fresh: mcpp new hello → mcpp run (LLVM)"
82+
- name: "mcpp new hello → mcpp run"
8683
run: |
8784
cd "$(mktemp -d)"
88-
"$MCPP" new hello
85+
mcpp new hello
8986
cd hello
90-
"$MCPP" run
87+
mcpp run
9188
9289
windows-fresh:
9390
name: Windows fresh install
@@ -104,21 +101,23 @@ jobs:
104101
Invoke-WebRequest -Uri "https://github.com/d2learn/xlings/releases/download/v0.4.30/xlings-0.4.30-windows-x86_64.zip" -OutFile "$env:TEMP\xlings.zip"
105102
Expand-Archive -Path "$env:TEMP\xlings.zip" -DestinationPath "$env:TEMP\xlings-extract" -Force
106103
& "$env:TEMP\xlings-extract\xlings-0.4.30-windows-x86_64\subos\default\bin\xlings.exe" self install
107-
$env:PATH = "$env:USERPROFILE\.xlings\subos\default\bin;$env:PATH"
104+
$xlingsbin = "$env:USERPROFILE\.xlings\subos\default\bin"
105+
$env:PATH = "$xlingsbin;$env:PATH"
108106
xlings install mcpp -y
109-
"$env:USERPROFILE\.xlings\subos\default\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
107+
$xlingsbin | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
110108
111109
- name: Build this PR's mcpp
112-
shell: bash
110+
shell: pwsh
113111
run: |
114112
mcpp build
115-
MCPP=$(find target -type f -name 'mcpp.exe' | head -1)
116-
echo "MCPP=$(realpath "$MCPP")" >> "$GITHUB_ENV"
113+
$mcppExe = Get-ChildItem -Path target -Recurse -Filter "mcpp.exe" | Select-Object -First 1
114+
$mcppExe.DirectoryName | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
117115
118-
- name: "Fresh: mcpp new hello → mcpp run"
119-
shell: bash
116+
- name: "mcpp new hello → mcpp run"
117+
shell: pwsh
120118
run: |
121-
cd "$(mktemp -d)"
122-
"$MCPP" new hello
123-
cd hello
124-
"$MCPP" run
119+
$tmp = New-TemporaryFile | ForEach-Object { Remove-Item $_; New-Item -ItemType Directory -Path $_ }
120+
Set-Location $tmp
121+
mcpp new hello
122+
Set-Location hello
123+
mcpp run

0 commit comments

Comments
 (0)