From 18d226e25b9658815867e973fd67981d494a0be4 Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Sun, 10 May 2026 04:07:32 +0800 Subject: [PATCH] ci: switch to mcpp build (.xlings.json pins mcpp 0.0.3) Replaces the existing CI with a single mcpp-driven Linux job: - `.xlings.json` declares `mcpp = { linux = "0.0.3" }`. - `.github/workflows/ci.yml` boots xlings, runs `xlings install -y`, then `mcpp build` + `mcpp test` against the existing mcpp.toml. --- .github/workflows/ci.yml | 108 ++++++--------------------------------- .xlings.json | 5 ++ 2 files changed, 20 insertions(+), 93 deletions(-) create mode 100644 .xlings.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec99aa1..f5a9833 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,110 +2,32 @@ name: CI on: push: - branches: [main, master] + branches: [main] pull_request: - branches: [main, master] - -concurrency: - group: ci-${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true jobs: - build-linux: + build: name: build + test (linux x86_64, mcpp) - runs-on: ubuntu-24.04 - timeout-minutes: 30 - env: - MCPP_HOME: /home/runner/.mcpp + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - # mcpp's sandbox (musl-gcc + ninja + binutils) is multi-hundred-MB; - # key on mcpp.toml so toolchain changes refresh the cache. - - name: Cache mcpp sandbox - uses: actions/cache@v4 - with: - path: ~/.mcpp - key: mcpp-sandbox-${{ runner.os }}-${{ hashFiles('mcpp.toml') }} - restore-keys: | - mcpp-sandbox-${{ runner.os }}- - - - name: Cache xlings - uses: actions/cache@v4 - with: - path: ~/.xlings - key: xlings-${{ runner.os }} - restore-keys: | - xlings-${{ runner.os }}- - - - name: Bootstrap mcpp via xlings + - name: Install xlings env: - XLINGS_NON_INTERACTIVE: '1' + XLINGS_VERSION: 0.4.25 run: | - if [ ! -x "$HOME/.xlings/subos/default/bin/xlings" ]; then - curl -fsSL https://d2learn.org/xlings-install.sh | bash - fi - export PATH="$HOME/.xlings/subos/default/bin:$PATH" - xlings --version - xlings install mcpp -y - mcpp --version - echo "$HOME/.xlings/subos/default/bin" >> "$GITHUB_PATH" + tarball="xlings-${XLINGS_VERSION}-linux-x86_64.tar.gz" + curl -fsSL -o "/tmp/${tarball}" \ + "https://github.com/d2learn/xlings/releases/download/v${XLINGS_VERSION}/${tarball}" + tar -xzf "/tmp/${tarball}" -C /tmp + "/tmp/xlings-${XLINGS_VERSION}-linux-x86_64/subos/default/bin/xlings" self install + echo "$HOME/.xlings/subos/current/bin" >> "$GITHUB_PATH" - - name: Cache target/ (build artifacts + BMIs) - uses: actions/cache@v4 - with: - path: target - key: mcpp-target-${{ runner.os }}-${{ hashFiles('src/**', 'tests/**', 'mcpp.toml') }} - restore-keys: | - mcpp-target-${{ runner.os }}- + - name: Install workspace tools (.xlings.json → mcpp 0.0.3) + run: xlings install -y - - name: Build + - name: Build with mcpp run: mcpp build - - name: Test + - name: Run tests run: mcpp test - - # mcpp is Linux-x86_64 first; macOS/Windows support is still WIP, so the - # cross-platform xmake build keeps coverage for those targets. - build-macos: - name: build (macOS, xmake) - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - - name: Setup xmake - uses: xmake-io/github-action-setup-xmake@v1 - with: - xmake-version: latest - package-cache: true - - - name: Install LLVM 20 - run: brew install llvm@20 - - - name: Build - run: | - xmake f --toolchain=llvm --sdk=/opt/homebrew/opt/llvm@20 - xmake -y -vv - - build-windows: - name: build + test (Windows, xmake) - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - - name: Setup xmake - uses: xmake-io/github-action-setup-xmake@v1 - with: - xmake-version: latest - package-cache: true - - - name: Build - run: xmake -y -vv - - - name: Test - run: xmake run cmdline_test - - - name: Run examples (smoke) - run: | - xmake run with_dispatch -- add python 3.12 - xmake run with_dispatch -- remove foo diff --git a/.xlings.json b/.xlings.json new file mode 100644 index 0000000..f2be3fd --- /dev/null +++ b/.xlings.json @@ -0,0 +1,5 @@ +{ + "workspace": { + "mcpp": { "linux": "0.0.3" } + } +}