Skip to content

Commit 5531653

Browse files
Sunrisepeakclaude
andcommitted
add multi-platform CI and mcpplibs-index-add skill
CI: per-package jobs triggered by path changes. Toolchains installed via xlings: gcc@15 (Linux), llvm@20 (macOS), MSVC (Windows). xmake auto-detects toolchain. Use -P . to avoid project directory warning. Each package only runs CI when its files change. llmapi tests are build-only. Skill: document full library onboarding workflow with cross-platform C++23 toolchain reference using xlings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1048fde commit 5531653

File tree

2 files changed

+345
-3
lines changed

2 files changed

+345
-3
lines changed

.agents/skills/mcpplibs-index-add.md

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This skill adds a new library from `https://github.com/mcpplibs/<name>` to the m
1414
- xmake package docs: https://xmake.io/mirror/manual/package_dependencies.html
1515
- mcpplibs org: https://github.com/mcpplibs
1616
- index repo: https://github.com/mcpplibs/mcpplibs-index
17+
- xlings CI reference (cross-platform C++23 toolchain): https://github.com/d2learn/xlings/tree/main/.github/workflows
1718

1819
## Step 1: Gather Library Info
1920

@@ -110,7 +111,11 @@ Add an `includes()` line to `tests/xmake.lua`:
110111
includes("<first-letter>/<package-name>")
111112
```
112113

113-
## Step 6: Verify Build
114+
## Step 6: Update CI
115+
116+
Add a new job to `.github/workflows/ci.yml` for the package. Each package has its own job with path-based triggering. Add path filter in `detect-changes` job and a new job block (see existing jobs as template). Also add the package paths to the top-level `on.push.paths` and `on.pull_request.paths`.
117+
118+
## Step 7: Verify Build
114119

115120
```bash
116121
# Clean any cached package
@@ -129,20 +134,69 @@ xmake run <package-name>_test
129134

130135
All three commands must succeed before proceeding.
131136

132-
## Step 7: Create Branch, Commit & Push
137+
## Step 8: Create Branch, Commit & Push
133138

134139
```bash
135140
git checkout -b add-<repo-name>-library
136141
git add packages/<first-letter>/<package-name>/xmake.lua \
137142
tests/<first-letter>/<package-name>/xmake.lua \
138143
tests/<first-letter>/<package-name>/main.cpp \
139-
tests/xmake.lua
144+
tests/xmake.lua \
145+
.github/workflows/ci.yml
140146
git commit -m "add <package-name> library"
141147
git push -u upstream add-<repo-name>-library
142148
```
143149

144150
Use `upstream` (SSH remote) for push, not `origin` (HTTPS, no auth).
145151

152+
## C++23 Toolchain Reference
153+
154+
All mcpplibs packages require C++23 with modules support. Below are the toolchain configurations for each platform, referenced from [xlings CI](https://github.com/d2learn/xlings/tree/main/.github/workflows).
155+
156+
All toolchains are installed via [xlings](https://github.com/d2learn/xlings). xlings bundles xmake, no separate install needed.
157+
158+
### Install xlings
159+
160+
```bash
161+
# Linux / macOS
162+
curl -fsSL https://raw.githubusercontent.com/d2learn/xlings/main/tools/other/quick_install.sh | bash
163+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
164+
165+
# Windows (PowerShell)
166+
irm https://raw.githubusercontent.com/d2learn/xlings/refs/heads/main/tools/other/quick_install.ps1 | iex
167+
$env:PATH = "$env:USERPROFILE\.xlings\subos\current\bin;$env:PATH"
168+
```
169+
170+
### Linux — GCC 15 (Ubuntu 24.04)
171+
172+
```bash
173+
xlings install gcc@15 -y
174+
xmake f -y
175+
```
176+
177+
### macOS — LLVM 20 (macOS 15)
178+
179+
```bash
180+
xlings install llvm@20 -y
181+
xmake f -y
182+
```
183+
184+
### Windows — MSVC (windows-latest)
185+
186+
```bash
187+
xmake f -y # auto-selects MSVC
188+
```
189+
190+
No special configuration needed. MSVC from Visual Studio supports C++23.
191+
192+
### Toolchain Version Summary
193+
194+
| Platform | Compiler | Version | Install |
195+
|----------|----------|---------|---------|
196+
| Linux | GCC | 15.1.0 | `xlings install gcc@15 -y` |
197+
| macOS | LLVM/Clang | 20 | `xlings install llvm@20 -y` |
198+
| Windows | MSVC | latest | auto-detected |
199+
146200
## Checklist
147201

148202
- [ ] Package directory name == `package("xxx")` name
@@ -151,6 +205,7 @@ Use `upstream` (SSH remote) for push, not `origin` (HTTPS, no auth).
151205
- [ ] Extra headers copied in `on_install` if needed by cppm
152206
- [ ] Test does NOT have `add_repositories()` (top-level handles it)
153207
- [ ] Test registered in `tests/xmake.lua` via `includes()`
208+
- [ ] CI matrix updated with new test entry
154209
- [ ] `xmake build` succeeds
155210
- [ ] `xmake run` produces expected output
156211
- [ ] Committed and pushed to upstream

.github/workflows/ci.yml

Lines changed: 287 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,287 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'packages/**'
8+
- 'tests/**'
9+
- '.github/workflows/ci.yml'
10+
pull_request:
11+
branches: [main]
12+
paths:
13+
- 'packages/**'
14+
- 'tests/**'
15+
- '.github/workflows/ci.yml'
16+
17+
env:
18+
XLINGS_NON_INTERACTIVE: 1
19+
20+
jobs:
21+
detect-changes:
22+
runs-on: ubuntu-24.04
23+
outputs:
24+
templates: ${{ steps.filter.outputs.templates }}
25+
cmdline: ${{ steps.filter.outputs.cmdline }}
26+
llmapi: ${{ steps.filter.outputs.llmapi }}
27+
lua: ${{ steps.filter.outputs.lua }}
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: dorny/paths-filter@v3
31+
id: filter
32+
with:
33+
filters: |
34+
templates:
35+
- 'packages/t/templates/**'
36+
- 'tests/t/templates/**'
37+
- '.github/workflows/ci.yml'
38+
cmdline:
39+
- 'packages/c/cmdline/**'
40+
- 'tests/c/cmdline/**'
41+
- '.github/workflows/ci.yml'
42+
llmapi:
43+
- 'packages/l/llmapi/**'
44+
- 'tests/l/llmapi/**'
45+
- '.github/workflows/ci.yml'
46+
lua:
47+
- 'packages/m/mcpplibs-capi-lua/**'
48+
- 'tests/l/lua/**'
49+
- '.github/workflows/ci.yml'
50+
51+
templates:
52+
needs: detect-changes
53+
if: needs.detect-changes.outputs.templates == 'true'
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
include:
58+
- { os: ubuntu-24.04, shell: bash }
59+
- { os: macos-15, shell: bash }
60+
- { os: windows-latest, shell: pwsh }
61+
runs-on: ${{ matrix.os }}
62+
name: templates (${{ matrix.os }})
63+
steps:
64+
- uses: actions/checkout@v4
65+
- name: Setup (unix)
66+
if: runner.os != 'Windows'
67+
run: curl -fsSL https://raw.githubusercontent.com/d2learn/xlings/main/tools/other/quick_install.sh | bash
68+
- name: Setup (windows)
69+
if: runner.os == 'Windows'
70+
run: irm https://raw.githubusercontent.com/d2learn/xlings/refs/heads/main/tools/other/quick_install.ps1 | iex
71+
- name: Install toolchain (linux)
72+
if: runner.os == 'Linux'
73+
run: |
74+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
75+
xlings install gcc@15 -y
76+
- name: Install toolchain (macos)
77+
if: runner.os == 'macOS'
78+
run: |
79+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
80+
xlings install llvm@20 -y
81+
- name: Build & Run (linux)
82+
if: runner.os == 'Linux'
83+
working-directory: tests/t/templates
84+
run: |
85+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
86+
xmake f -P . -y
87+
xmake build -P . -y templates_test
88+
xmake run -P . templates_test
89+
- name: Build & Run (macos)
90+
if: runner.os == 'macOS'
91+
working-directory: tests/t/templates
92+
run: |
93+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
94+
xmake f -P . -y
95+
xmake build -P . -y templates_test
96+
xmake run -P . templates_test
97+
- name: Build & Run (windows)
98+
if: runner.os == 'Windows'
99+
working-directory: tests/t/templates
100+
run: |
101+
$env:PATH = "$env:USERPROFILE\.xlings\subos\current\bin;$env:PATH"
102+
xmake f -P . -y
103+
xmake build -P . -y templates_test
104+
xmake run -P . templates_test
105+
106+
cmdline:
107+
needs: detect-changes
108+
if: needs.detect-changes.outputs.cmdline == 'true'
109+
strategy:
110+
fail-fast: false
111+
matrix:
112+
include:
113+
- { os: ubuntu-24.04, shell: bash }
114+
- { os: macos-15, shell: bash }
115+
- { os: windows-latest, shell: pwsh }
116+
runs-on: ${{ matrix.os }}
117+
name: cmdline (${{ matrix.os }})
118+
steps:
119+
- uses: actions/checkout@v4
120+
- name: Setup (unix)
121+
if: runner.os != 'Windows'
122+
run: curl -fsSL https://raw.githubusercontent.com/d2learn/xlings/main/tools/other/quick_install.sh | bash
123+
- name: Setup (windows)
124+
if: runner.os == 'Windows'
125+
run: irm https://raw.githubusercontent.com/d2learn/xlings/refs/heads/main/tools/other/quick_install.ps1 | iex
126+
- name: Install toolchain (linux)
127+
if: runner.os == 'Linux'
128+
run: |
129+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
130+
xlings install gcc@15 -y
131+
- name: Install toolchain (macos)
132+
if: runner.os == 'macOS'
133+
run: |
134+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
135+
xlings install llvm@20 -y
136+
- name: Build & Run (linux)
137+
if: runner.os == 'Linux'
138+
working-directory: tests/c/cmdline
139+
run: |
140+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
141+
xmake f -P . -y
142+
xmake build -P . -y cmdline_test
143+
xmake run -P . cmdline_test test_input
144+
- name: Build & Run (macos)
145+
if: runner.os == 'macOS'
146+
working-directory: tests/c/cmdline
147+
run: |
148+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
149+
xmake f -P . -y
150+
xmake build -P . -y cmdline_test
151+
xmake run -P . cmdline_test test_input
152+
- name: Build & Run (windows)
153+
if: runner.os == 'Windows'
154+
working-directory: tests/c/cmdline
155+
run: |
156+
$env:PATH = "$env:USERPROFILE\.xlings\subos\current\bin;$env:PATH"
157+
xmake f -P . -y
158+
xmake build -P . -y cmdline_test
159+
xmake run -P . cmdline_test test_input
160+
161+
llmapi:
162+
needs: detect-changes
163+
if: needs.detect-changes.outputs.llmapi == 'true'
164+
strategy:
165+
fail-fast: false
166+
matrix:
167+
include:
168+
- { os: ubuntu-24.04, shell: bash }
169+
- { os: macos-15, shell: bash }
170+
- { os: windows-latest, shell: pwsh }
171+
runs-on: ${{ matrix.os }}
172+
name: llmapi (${{ matrix.os }})
173+
steps:
174+
- uses: actions/checkout@v4
175+
- name: Setup (unix)
176+
if: runner.os != 'Windows'
177+
run: curl -fsSL https://raw.githubusercontent.com/d2learn/xlings/main/tools/other/quick_install.sh | bash
178+
- name: Setup (windows)
179+
if: runner.os == 'Windows'
180+
run: irm https://raw.githubusercontent.com/d2learn/xlings/refs/heads/main/tools/other/quick_install.ps1 | iex
181+
- name: Install toolchain (linux)
182+
if: runner.os == 'Linux'
183+
run: |
184+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
185+
xlings install gcc@15 -y
186+
- name: Install toolchain (macos)
187+
if: runner.os == 'macOS'
188+
run: |
189+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
190+
xlings install llvm@20 -y
191+
- name: Build llmapi (linux)
192+
if: runner.os == 'Linux'
193+
working-directory: tests/l/llmapi
194+
run: |
195+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
196+
xmake f -P . -y
197+
xmake build -P . -y llmapi_test
198+
- name: Build llmapi (macos)
199+
if: runner.os == 'macOS'
200+
working-directory: tests/l/llmapi
201+
run: |
202+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
203+
xmake f -P . -y
204+
xmake build -P . -y llmapi_test
205+
- name: Build llmapi (windows)
206+
if: runner.os == 'Windows'
207+
working-directory: tests/l/llmapi
208+
run: |
209+
$env:PATH = "$env:USERPROFILE\.xlings\subos\current\bin;$env:PATH"
210+
xmake f -P . -y
211+
xmake build -P . -y llmapi_test
212+
- name: Build llmapi-capi (linux)
213+
if: runner.os == 'Linux'
214+
working-directory: tests/l/llmapi/capi
215+
run: |
216+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
217+
xmake f -P . -y
218+
xmake build -P . -y llmapi_test_c
219+
- name: Build llmapi-capi (macos)
220+
if: runner.os == 'macOS'
221+
working-directory: tests/l/llmapi/capi
222+
run: |
223+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
224+
xmake f -P . -y
225+
xmake build -P . -y llmapi_test_c
226+
- name: Build llmapi-capi (windows)
227+
if: runner.os == 'Windows'
228+
working-directory: tests/l/llmapi/capi
229+
run: |
230+
$env:PATH = "$env:USERPROFILE\.xlings\subos\current\bin;$env:PATH"
231+
xmake f -P . -y
232+
xmake build -P . -y llmapi_test_c
233+
234+
lua:
235+
needs: detect-changes
236+
if: needs.detect-changes.outputs.lua == 'true'
237+
strategy:
238+
fail-fast: false
239+
matrix:
240+
include:
241+
- { os: ubuntu-24.04, shell: bash }
242+
- { os: macos-15, shell: bash }
243+
- { os: windows-latest, shell: pwsh }
244+
runs-on: ${{ matrix.os }}
245+
name: lua (${{ matrix.os }})
246+
steps:
247+
- uses: actions/checkout@v4
248+
- name: Setup (unix)
249+
if: runner.os != 'Windows'
250+
run: curl -fsSL https://raw.githubusercontent.com/d2learn/xlings/main/tools/other/quick_install.sh | bash
251+
- name: Setup (windows)
252+
if: runner.os == 'Windows'
253+
run: irm https://raw.githubusercontent.com/d2learn/xlings/refs/heads/main/tools/other/quick_install.ps1 | iex
254+
- name: Install toolchain (linux)
255+
if: runner.os == 'Linux'
256+
run: |
257+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
258+
xlings install gcc@15 -y
259+
- name: Install toolchain (macos)
260+
if: runner.os == 'macOS'
261+
run: |
262+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
263+
xlings install llvm@20 -y
264+
- name: Build & Run (linux)
265+
if: runner.os == 'Linux'
266+
working-directory: tests/l/lua
267+
run: |
268+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
269+
xmake f -P . -y
270+
xmake build -P . -y lua_test
271+
xmake run -P . lua_test
272+
- name: Build & Run (macos)
273+
if: runner.os == 'macOS'
274+
working-directory: tests/l/lua
275+
run: |
276+
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
277+
xmake f -P . -y
278+
xmake build -P . -y lua_test
279+
xmake run -P . lua_test
280+
- name: Build & Run (windows)
281+
if: runner.os == 'Windows'
282+
working-directory: tests/l/lua
283+
run: |
284+
$env:PATH = "$env:USERPROFILE\.xlings\subos\current\bin;$env:PATH"
285+
xmake f -P . -y
286+
xmake build -P . -y lua_test
287+
xmake run -P . lua_test

0 commit comments

Comments
 (0)