Skip to content

Commit 3676998

Browse files
Sunrisepeakclaude
andcommitted
add multi-platform CI and mcpplibs-index-add skill
CI: build & test all packages on Linux (GCC 14) and macOS (LLVM 20). Each package × platform runs as a separate matrix job. llmapi tests are build-only (require API key at runtime). Skill: document full library onboarding workflow with cross-platform C++23 toolchain reference (GCC/LLVM/MSVC setup for CI). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1048fde commit 3676998

File tree

2 files changed

+179
-3
lines changed

2 files changed

+179
-3
lines changed

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

Lines changed: 100 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,18 @@ 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 Matrix
115+
116+
Add the new test to `.github/workflows/ci.yml` matrix:
117+
118+
```yaml
119+
- name: <package-name>
120+
dir: tests/<first-letter>/<package-name>
121+
target: <package-name>_test
122+
run: true # false if test needs network/API keys
123+
```
124+
125+
## Step 7: Verify Build
114126
115127
```bash
116128
# Clean any cached package
@@ -129,20 +141,104 @@ xmake run <package-name>_test
129141

130142
All three commands must succeed before proceeding.
131143

132-
## Step 7: Create Branch, Commit & Push
144+
## Step 8: Create Branch, Commit & Push
133145

134146
```bash
135147
git checkout -b add-<repo-name>-library
136148
git add packages/<first-letter>/<package-name>/xmake.lua \
137149
tests/<first-letter>/<package-name>/xmake.lua \
138150
tests/<first-letter>/<package-name>/main.cpp \
139-
tests/xmake.lua
151+
tests/xmake.lua \
152+
.github/workflows/ci.yml
140153
git commit -m "add <package-name> library"
141154
git push -u upstream add-<repo-name>-library
142155
```
143156

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

159+
## C++23 Toolchain Reference
160+
161+
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).
162+
163+
### Linux — GCC 14 (Ubuntu 24.04)
164+
165+
```bash
166+
sudo apt-get install -y gcc-14 g++-14
167+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
168+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
169+
xmake f -y --toolchain=gcc
170+
```
171+
172+
For static/cross builds (musl-gcc 15.1.0, used by xlings):
173+
```bash
174+
xmake f -c -p linux -m release \
175+
--sdk="$MUSL_SDK" \
176+
--cross=x86_64-linux-musl- \
177+
--cc=x86_64-linux-musl-gcc \
178+
--cxx=x86_64-linux-musl-g++
179+
```
180+
181+
### macOS — LLVM 20 (macOS 15)
182+
183+
```bash
184+
brew install llvm@20
185+
xmake f -y --toolchain=llvm --sdk=/opt/homebrew/opt/llvm@20
186+
```
187+
188+
For static linking of libc++ (no runtime dependency on LLVM dylibs):
189+
```lua
190+
-- in xmake.lua
191+
local llvm_prefix = os.getenv("LLVM_PREFIX") or "/opt/homebrew/opt/llvm@20"
192+
local libcxx_dir = llvm_prefix .. "/lib/c++"
193+
add_ldflags("-nostdlib++", {force = true})
194+
add_ldflags(libcxx_dir .. "/libc++.a", {force = true})
195+
add_ldflags(libcxx_dir .. "/libc++experimental.a", {force = true})
196+
add_ldflags("-lc++abi", {force = true})
197+
```
198+
199+
Verify no LLVM dylib dependency: `otool -L <binary> | grep llvm`
200+
201+
### Windows — MSVC (windows-latest)
202+
203+
```bash
204+
xmake f -y # auto-selects MSVC
205+
```
206+
207+
No special configuration needed. MSVC from Visual Studio supports C++23.
208+
209+
### Toolchain Version Summary
210+
211+
| Platform | Compiler | Version | Runner |
212+
|----------|----------|---------|--------|
213+
| Linux | GCC | 14+ | ubuntu-24.04 |
214+
| Linux (static) | musl-gcc | 15.1.0 | ubuntu-24.04 |
215+
| macOS | LLVM/Clang | 20 | macos-15 |
216+
| Windows | MSVC | latest | windows-latest |
217+
218+
### GitHub Actions Setup Pattern
219+
220+
```yaml
221+
# Linux
222+
- os: ubuntu-24.04
223+
setup: |
224+
sudo apt-get update
225+
sudo apt-get install -y gcc-14 g++-14
226+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
227+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
228+
toolchain: gcc
229+
230+
# macOS
231+
- os: macos-15
232+
setup: brew install llvm@20
233+
toolchain: llvm
234+
sdk: /opt/homebrew/opt/llvm@20
235+
236+
# Windows
237+
- os: windows-latest
238+
setup: echo "MSVC auto-detected"
239+
toolchain: msvc
240+
```
241+
146242
## Checklist
147243
148244
- [ ] Package directory name == `package("xxx")` name
@@ -151,6 +247,7 @@ Use `upstream` (SSH remote) for push, not `origin` (HTTPS, no auth).
151247
- [ ] Extra headers copied in `on_install` if needed by cppm
152248
- [ ] Test does NOT have `add_repositories()` (top-level handles it)
153249
- [ ] Test registered in `tests/xmake.lua` via `includes()`
250+
- [ ] CI matrix updated with new test entry
154251
- [ ] `xmake build` succeeds
155252
- [ ] `xmake run` produces expected output
156253
- [ ] Committed and pushed to upstream

.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
test:
15+
- name: templates
16+
dir: tests/t/templates
17+
target: templates_test
18+
run: true
19+
- name: cmdline
20+
dir: tests/c/cmdline
21+
target: cmdline_test
22+
run: true
23+
run_args: test_input
24+
- name: llmapi
25+
dir: tests/l/llmapi
26+
target: llmapi_test
27+
run: false
28+
- name: llmapi-capi
29+
dir: tests/l/llmapi/capi
30+
target: llmapi_test_c
31+
run: false
32+
- name: lua
33+
dir: tests/l/lua
34+
target: lua_test
35+
run: true
36+
platform:
37+
- os: ubuntu-24.04
38+
setup: |
39+
sudo apt-get update
40+
sudo apt-get install -y gcc-14 g++-14
41+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
42+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
43+
toolchain: gcc
44+
- os: macos-15
45+
setup: brew install llvm@20
46+
toolchain: llvm
47+
sdk: /opt/homebrew/opt/llvm@20
48+
49+
runs-on: ${{ matrix.platform.os }}
50+
name: ${{ matrix.test.name }} (${{ matrix.platform.os }})
51+
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- name: Setup xmake
56+
uses: xmake-io/github-action-setup-xmake@v1
57+
with:
58+
xmake-version: latest
59+
60+
- name: Setup toolchain
61+
run: ${{ matrix.platform.setup }}
62+
63+
- name: Configure
64+
working-directory: ${{ matrix.test.dir }}
65+
run: |
66+
if [ -n "${{ matrix.platform.sdk }}" ]; then
67+
xmake f -y --toolchain=${{ matrix.platform.toolchain }} --sdk=${{ matrix.platform.sdk }}
68+
else
69+
xmake f -y --toolchain=${{ matrix.platform.toolchain }}
70+
fi
71+
72+
- name: Build
73+
working-directory: ${{ matrix.test.dir }}
74+
run: xmake build ${{ matrix.test.target }}
75+
76+
- name: Run
77+
if: matrix.test.run
78+
working-directory: ${{ matrix.test.dir }}
79+
run: xmake run ${{ matrix.test.target }} ${{ matrix.test.run_args }}

0 commit comments

Comments
 (0)