fix: pass MCPP_VENDORED_XLINGS to mcpp test step #37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci-windows | |
| # Windows CI for mcpp — validates LLVM/Clang as the Windows toolchain. | |
| # Same flow as Linux (ci.yml) and macOS (ci-macos.yml): | |
| # xlings install mcpp → self-host build → unit tests → E2E → smoke | |
| on: | |
| push: | |
| branches: [ feat/windows-support, main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ci-windows-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-test: | |
| name: build + test (windows x64, self-host) | |
| runs-on: windows-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: System info | |
| shell: bash | |
| run: | | |
| echo "OS: $(uname -s)" | |
| echo "Arch: $(uname -m)" | |
| echo "Runner: $RUNNER_OS" | |
| - name: Install xlings | |
| shell: bash | |
| env: | |
| XLINGS_NON_INTERACTIVE: '1' | |
| XLINGS_VERSION: '0.4.30' | |
| run: | | |
| WORK=$(mktemp -d) | |
| zipfile="xlings-${XLINGS_VERSION}-windows-x86_64.zip" | |
| curl -fsSL -o "${WORK}/${zipfile}" \ | |
| "https://github.com/d2learn/xlings/releases/download/v${XLINGS_VERSION}/${zipfile}" | |
| cd "${WORK}" | |
| unzip -q "${zipfile}" | |
| XLINGS_DIR="${WORK}/xlings-${XLINGS_VERSION}-windows-x86_64" | |
| "$XLINGS_DIR/subos/default/bin/xlings.exe" self install | |
| echo "$USERPROFILE/.xlings/subos/default/bin" >> "$GITHUB_PATH" | |
| echo "$USERPROFILE/.xlings/bin" >> "$GITHUB_PATH" | |
| - name: Bootstrap mcpp via xlings | |
| shell: bash | |
| run: | | |
| xlings.exe --version | |
| xlings.exe install mcpp -y | |
| MCPP="$USERPROFILE/.xlings/subos/default/bin/mcpp.exe" | |
| test -f "$MCPP" || MCPP="$USERPROFILE/.xlings/subos/default/bin/mcpp" | |
| test -f "$MCPP" | |
| "$MCPP" --version | |
| echo "MCPP=$MCPP" >> "$GITHUB_ENV" | |
| XLINGS_BIN=$(cygpath -w "$USERPROFILE/.xlings/subos/default/bin/xlings.exe") | |
| echo "XLINGS_BIN=$XLINGS_BIN" >> "$GITHUB_ENV" | |
| - name: Build mcpp from source (self-host) | |
| shell: bash | |
| run: | | |
| export MCPP_VENDORED_XLINGS="$XLINGS_BIN" | |
| # Pre-seed mcpp sandbox with xlings LLVM (avoids redundant download) | |
| MCPP_XPKGS="$USERPROFILE/.mcpp/registry/data/xpkgs" | |
| XLINGS_XPKGS="$USERPROFILE/.xlings/data/xpkgs" | |
| if [ -d "$XLINGS_XPKGS/xim-x-llvm" ]; then | |
| mkdir -p "$MCPP_XPKGS" | |
| rm -rf "$MCPP_XPKGS/xim-x-llvm" | |
| cp -r "$XLINGS_XPKGS/xim-x-llvm" "$MCPP_XPKGS/xim-x-llvm" | |
| echo "Pre-seeded LLVM from global xlings" | |
| fi | |
| "$MCPP" build | |
| - name: Unit + integration tests via mcpp test | |
| shell: bash | |
| run: | | |
| MCPP_FRESH=$(find target -name "mcpp.exe" -path "*/bin/*" | head -1) | |
| MCPP_FRESH=$(cd "$(dirname "$MCPP_FRESH")" && pwd)/$(basename "$MCPP_FRESH") | |
| echo "Self-hosted binary: $MCPP_FRESH" | |
| "$MCPP_FRESH" --version | |
| export MCPP_VENDORED_XLINGS="$XLINGS_BIN" | |
| "$MCPP_FRESH" test | |
| - name: E2E suite | |
| shell: bash | |
| run: | | |
| MCPP=$(find target -name "mcpp.exe" -path "*/bin/*" | head -1) | |
| MCPP=$(cd "$(dirname "$MCPP")" && pwd)/$(basename "$MCPP") | |
| test -f "$MCPP" | |
| export MCPP | |
| export MCPP_VENDORED_XLINGS="$XLINGS_BIN" | |
| export MCPP_E2E_TOOLCHAIN_MIRROR=GLOBAL | |
| "$MCPP" self config --mirror "$MCPP_E2E_TOOLCHAIN_MIRROR" 2>/dev/null || true | |
| "$MCPP" toolchain default llvm@20.1.7 2>/dev/null || true | |
| bash tests/e2e/run_all.sh | |
| - name: Self-host smoke (freshly-built mcpp builds itself again) | |
| shell: bash | |
| run: | | |
| MCPP=$(find target -name "mcpp.exe" -path "*/bin/*" | head -1) | |
| MCPP=$(cd "$(dirname "$MCPP")" && pwd)/$(basename "$MCPP") | |
| export MCPP_VENDORED_XLINGS="$XLINGS_BIN" | |
| "$MCPP" build | |
| "$MCPP" --version | |
| echo ":: Self-host smoke PASS" | |
| - name: Package Windows release zip | |
| id: package | |
| shell: bash | |
| run: | | |
| VERSION=$(awk -F '"' '/^version[[:space:]]*=/{print $2; exit}' mcpp.toml) | |
| PLAT="windows-x86_64" | |
| WRAPPER="mcpp-${VERSION}-${PLAT}" | |
| ZIPNAME="${WRAPPER}.zip" | |
| MCPP_SELF=$(find target -name "mcpp.exe" -path "*/bin/*" | head -1) | |
| MCPP_SELF=$(cd "$(dirname "$MCPP_SELF")" && pwd)/$(basename "$MCPP_SELF") | |
| STAGING=$(mktemp -d) | |
| mkdir -p "$STAGING/$WRAPPER/bin" | |
| mkdir -p "$STAGING/$WRAPPER/registry/bin" | |
| cp "$MCPP_SELF" "$STAGING/$WRAPPER/bin/mcpp.exe" | |
| printf '@echo off\r\n"%%~dp0bin\\mcpp.exe" %%*\r\n' > "$STAGING/$WRAPPER/mcpp.bat" | |
| cp README.md "$STAGING/$WRAPPER/" 2>/dev/null || true | |
| cp LICENSE "$STAGING/$WRAPPER/" 2>/dev/null || true | |
| XLINGS_EXE="$USERPROFILE/.xlings/subos/default/bin/xlings.exe" | |
| if [ -f "$XLINGS_EXE" ]; then | |
| cp "$XLINGS_EXE" "$STAGING/$WRAPPER/registry/bin/xlings.exe" | |
| fi | |
| mkdir -p dist | |
| (cd "$STAGING" && 7z a -tzip "$ZIPNAME" "$WRAPPER") | |
| cp "$STAGING/$ZIPNAME" "dist/$ZIPNAME" | |
| (cd dist && sha256sum "$ZIPNAME" > "$ZIPNAME.sha256") | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "zipname=$ZIPNAME" >> "$GITHUB_OUTPUT" | |
| ls -la dist/ | |
| - name: Smoke-test the packaged zip | |
| shell: bash | |
| run: | | |
| ZIPNAME="${{ steps.package.outputs.zipname }}" | |
| WRAPPER="${ZIPNAME%.zip}" | |
| SMOKE=$(mktemp -d) | |
| (cd "$SMOKE" && unzip -q "$GITHUB_WORKSPACE/dist/$ZIPNAME") | |
| "$SMOKE/$WRAPPER/bin/mcpp.exe" --version | |
| test -f "$SMOKE/$WRAPPER/registry/bin/xlings.exe" | |
| test -f "$SMOKE/$WRAPPER/mcpp.bat" | |
| echo "Smoke-test passed" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mcpp-windows-x86_64 | |
| path: | | |
| dist/*.zip | |
| dist/*.sha256 |