55 branches : [main]
66 pull_request :
77
8+ env :
9+ XLINGS_VERSION : 0.4.51
10+ MCPP_VERSION : 0.0.52
11+
812jobs :
913 build-linux-mcpp :
1014 name : build (linux x86_64, mcpp)
1317 - uses : actions/checkout@v4
1418
1519 - name : Install xlings
16- env :
17- XLINGS_VERSION : 0.4.31
1820 run : |
1921 tarball="xlings-${XLINGS_VERSION}-linux-x86_64.tar.gz"
2022 curl -fsSL -o "/tmp/${tarball}" \
@@ -26,14 +28,14 @@ jobs:
2628 - name : Refresh package index
2729 run : xlings update
2830
29- - name : Install workspace tools (.xlings.json → mcpp 0.0.13 )
31+ - name : Install workspace tools (.xlings.json -> mcpp ${{ env.MCPP_VERSION }} )
3032 run : xlings install -y
3133
3234 - name : Cache mcpp sandbox
3335 uses : actions/cache@v4
3436 with :
35- path : ~/.xlings/data/xpkgs/xim-x-mcpp/0.0.13 /registry
36- key : mcpp-sandbox-${{ runner.os }}-mcpp0.0.13
37+ path : ~/.xlings/data/xpkgs/xim-x-mcpp/${{ env.MCPP_VERSION }} /registry
38+ key : mcpp-sandbox-${{ runner.os }}-mcpp${{ env.MCPP_VERSION }}
3739
3840 - name : Build with mcpp
3941 run : mcpp build
@@ -46,15 +48,18 @@ jobs:
4648 "$binary" --version
4749
4850 build-macos :
49- runs-on : macos-15
51+ name : build (${{ matrix.os }}, mcpp)
52+ runs-on : ${{ matrix.os }}
53+ strategy :
54+ fail-fast : false
55+ matrix :
56+ os : [macos-14, macos-15]
5057 steps :
51- - name : Checkout code
52- uses : actions/checkout@v4
58+ - uses : actions/checkout@v4
5359
54- - name : Install Xlings
60+ - name : Install xlings
5561 env :
5662 XLINGS_NON_INTERACTIVE : 1
57- XLINGS_VERSION : 0.4.31
5863 run : |
5964 TARBALL="xlings-${XLINGS_VERSION}-macosx-arm64.tar.gz"
6065 curl -fSL -o "$RUNNER_TEMP/$TARBALL" "https://github.com/d2learn/xlings/releases/download/v${XLINGS_VERSION}/${TARBALL}"
@@ -63,44 +68,117 @@ jobs:
6368 xattr -dr com.apple.quarantine "$EXTRACT_DIR" 2>/dev/null || true
6469 chmod +x "$EXTRACT_DIR/bin/xlings"
6570 "$EXTRACT_DIR/bin/xlings" self install
66- echo "PATH= $HOME/.xlings/subos/current/bin:$PATH " >> "$GITHUB_ENV "
71+ echo "$HOME/.xlings/subos/current/bin" >> "$GITHUB_PATH "
6772
68- - name : Install Project Dependencies via Xlings
69- run : |
70- xlings install
71- clang --version
73+ - name : Refresh package index
74+ run : xlings update
7275
73- - name : Configure xmake
74- run : |
75- LLVM_ROOT="$HOME/.xlings/data/xpkgs/xim-x-llvm"
76- LLVM_SDK=$(find "$LLVM_ROOT" -mindepth 1 -maxdepth 1 -type d | sort -V | tail -1)
77- test -d "$LLVM_SDK"
78- "$LLVM_SDK/bin/clang++" --version
79- xmake f -m release --toolchain=llvm --sdk="$LLVM_SDK" -y -vvD
76+ - name : Install workspace tools (.xlings.json -> mcpp ${{ env.MCPP_VERSION }})
77+ run : xlings install -y
8078
81- - name : Build with xmake
82- run : xmake -a -j"$(sysctl -n hw.logicalcpu)"
79+ - name : Build with mcpp
80+ run : mcpp build
8381
8482 - name : Verify d2x
8583 run : |
86- ./build/macosx/arm64/release/d2x --version
84+ BIN=$(find target -name d2x -type f | head -1)
85+ test -n "$BIN" || { echo "d2x binary not found"; find target -type f | head -20; exit 1; }
86+ chmod +x "$BIN"
87+ "$BIN" --version
8788
8889 build-windows :
90+ name : build (windows x86_64, mcpp)
8991 runs-on : windows-latest
92+ defaults :
93+ run :
94+ shell : bash
95+ env :
96+ XLINGS_NON_INTERACTIVE : 1
9097 steps :
91- - name : Checkout code
92- uses : actions/checkout@v4
98+ - uses : actions/checkout@v4
9399
94- - name : Setup xmake
95- uses : xmake-io/github-action-setup-xmake@v1
96- with :
97- xmake-version : latest
100+ # Everything in one bash step so the in-process PATH is used directly
101+ # (avoids cross-step PATH translation issues for the msys/Windows mix).
102+ - name : Install xlings and build with mcpp
103+ run : |
104+ set -e
105+ ZIP="xlings-${XLINGS_VERSION}-windows-x86_64.zip"
106+ curl -fSL -o "$RUNNER_TEMP/$ZIP" "https://github.com/d2learn/xlings/releases/download/v${XLINGS_VERSION}/${ZIP}"
107+ unzip -q "$RUNNER_TEMP/$ZIP" -d "$RUNNER_TEMP/xl"
108+ XL=$(find "$RUNNER_TEMP/xl" -name 'xlings.exe' | head -1)
109+ echo "xlings: $XL"
110+ "$XL" self install
111+ export PATH="$HOME/.xlings/subos/current/bin:$PATH"
112+ xlings update
113+ xlings install -y
114+ mcpp build
115+ D2X=$(find target -name 'd2x.exe' -type f | head -1)
116+ test -n "$D2X" || { echo "d2x.exe not found"; find target -type f | head -20; exit 1; }
117+ "$D2X" --version
118+
119+ # Smoke test: a real `d2x checker` run against the d2mcpp course must reach
120+ # and report the FIRST exercise's build error within a bounded window, rather
121+ # than hanging on the init log (issue #24). The checker waits for file edits
122+ # forever, so a timeout kill is the expected, healthy outcome.
123+ checker-smoke :
124+ name : checker smoke (linux)
125+ runs-on : ubuntu-latest
126+ steps :
127+ - uses : actions/checkout@v4
98128
99- - name : Build with xmake
129+ - name : Install xlings
100130 run : |
101- xmake f -m release -y
102- xmake -j$env:NUMBER_OF_PROCESSORS
131+ tarball="xlings-${XLINGS_VERSION}-linux-x86_64.tar.gz"
132+ curl -fsSL -o "/tmp/${tarball}" \
133+ "https://github.com/d2learn/xlings/releases/download/v${XLINGS_VERSION}/${tarball}"
134+ tar -xzf "/tmp/${tarball}" -C /tmp
135+ "/tmp/xlings-${XLINGS_VERSION}-linux-x86_64/subos/default/bin/xlings" self install
136+ echo "$HOME/.xlings/subos/current/bin" >> "$GITHUB_PATH"
103137
104- - name : Verify d2x
138+ - name : Refresh package index
139+ run : xlings update
140+
141+ - name : Build d2x with mcpp
142+ run : |
143+ xlings install -y
144+ mcpp build
145+
146+ # Use a real xmake (not the xlings `xmake` shim): d2mcpp's .xlings.json
147+ # pins xmake 3.0.7, which is gone from the registry, so the shim would
148+ # fail to resolve. A standalone xmake ignores .xlings.json. Put it ahead
149+ # of the xlings bin on PATH.
150+ - name : Install xmake
151+ run : |
152+ curl -fsSL https://xmake.io/shget.text | bash
153+ source ~/.xmake/profile 2>/dev/null || true
154+ echo "$HOME/.local/bin" >> "$GITHUB_PATH"
155+ "$HOME/.local/bin/xmake" --version
156+
157+ - name : Checkout d2mcpp course
158+ uses : actions/checkout@v4
159+ with :
160+ repository : mcpp-community/d2mcpp
161+ path : d2mcpp
162+
163+ - name : Run d2x checker (must reach first exercise, not hang on load)
105164 run : |
106- build\windows\x64\release\d2x.exe --version
165+ D2X="$PWD/$(find target -name d2x -type f | head -1)"
166+ test -x "$D2X" || chmod +x "$D2X"
167+ cd d2mcpp
168+ # Force the print UI so output is plain text in a non-TTY runner.
169+ sed -i 's/"ui_backend": *"tui"/"ui_backend": "print"/' .d2x.json || true
170+ xmake f -y
171+ set +e
172+ timeout 120 "$D2X" checker --ui print --lang en > checker.out 2>&1
173+ code=$?
174+ set -e
175+ echo "checker exit=$code (124 = killed by timeout while waiting for edits = expected)"
176+ echo "------------------ checker output (tail) ------------------"
177+ tail -n 40 checker.out || true
178+ echo "-----------------------------------------------------------"
179+ if grep -q "hello-mcpp" checker.out && grep -qiE "error" checker.out; then
180+ echo "OK: checker reached and reported the first exercise (not stuck on the loading log)"
181+ else
182+ echo "FAIL: checker produced no exercise build output within the window (stuck on load?)"
183+ exit 1
184+ fi
0 commit comments