Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 15 additions & 93 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions .xlings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"workspace": {
"mcpp": { "linux": "0.0.3" }
}
}
Loading