Skip to content

feat: add mcpp build support and switch Linux CI to mcpp #16

feat: add mcpp build support and switch Linux CI to mcpp

feat: add mcpp build support and switch Linux CI to mcpp #16

Workflow file for this run

name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-linux:
name: build + test (linux x86_64, mcpp)
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
MCPP_HOME: /home/runner/.mcpp
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
env:
XLINGS_NON_INTERACTIVE: '1'
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"
- 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: Build
run: mcpp build
- name: Test
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