Repository navigation
230 lines (215 loc) · 10.1 KB
/
Copy pathci.yml
File metadata and controls
230 lines (215 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# CI for rag-cpp.
#
# The job that matters here is `pinned-sdk`. rag-cpp resolves the RCP C++ SDK in
# three steps — an explicit -DRAGCPP_RCP_SDK_DIR, then a SIBLING ../rcp/sdk/cpp
# checkout, then FetchContent of the pinned tag — and on any developer machine
# the sibling wins, because co-developing the two repos is the normal workflow.
#
# The consequence is that the pin was dead code. Nothing had ever exercised
# RAGCPP_RCP_SDK_TAG, so it could have named a deleted ref, a force-pushed tag,
# or an API-incompatible SDK, and every local build would still be green. The
# first person to find out would be someone cloning the repo — which is to say,
# every new user, and nobody else.
#
# `pinned-sdk` therefore builds from a directory with NO sibling rcp/, asserts
# that the SDK actually came from the pinned tag, and runs the suite plus
# protocol conformance against it. It is the only job here that tests the build
# a stranger gets.
#
# Deliberately NOT -Werror: this job answers "does the pinned SDK still work",
# and it must not go red because a new compiler release invented a warning.
# Warnings are a separate job with a separate signal.
name: ci
on:
push:
branches: [main]
pull_request:
# The pin can break with nothing in this repo changing — a deleted or
# force-pushed upstream tag is invisible to push-triggered CI — so also check
# it on a schedule.
schedule:
- cron: "0 6 * * 1"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# ── The job this file exists for ───────────────────────────────────────────
pinned-sdk:
name: clean clone (FetchContent pin)
runs-on: ubuntu-latest
steps:
- name: Check out into a directory with no sibling rcp/
uses: actions/checkout@v4
with:
path: solo/rag-cpp
- name: Prove the sibling path cannot win
working-directory: solo/rag-cpp
run: |
# Without this guard the job could silently test the DEVELOPER path
# and report success for a pin it never touched.
if [ -e ../rcp ]; then
echo "::error::a sibling rcp/ checkout exists; this job would not test the pin"
exit 1
fi
echo "no sibling rcp/ — FetchContent is the only way to resolve the SDK"
- name: Configure
working-directory: solo/rag-cpp
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
- name: Assert the SDK came from the pinned tag
working-directory: solo/rag-cpp
run: |
# Configuring successfully proves little on its own. This checks the
# SDK was FETCHED (so resolution really used the pin) and that the
# checked-out ref is the tag CMakeLists names, so a drifting or
# force-pushed pin fails loudly instead of silently building
# something else.
src=build/_deps/rcp-src
if [ ! -d "$src" ]; then
echo "::error::SDK was not fetched — resolution did not use the pin"
exit 1
fi
want=$(grep -m1 'set(RAGCPP_RCP_SDK_TAG' CMakeLists.txt | sed -E 's/.*"([^"]+)".*/\1/')
got=$(git -C "$src" describe --tags --exact-match 2>/dev/null || git -C "$src" rev-parse HEAD)
echo "pin wants: $want"
echo "fetched : $got ($(git -C "$src" rev-parse --short HEAD))"
if [ "$want" != "$got" ]; then
echo "::error::fetched SDK ref '$got' is not the pinned tag '$want'"
exit 1
fi
- name: Build
working-directory: solo/rag-cpp
run: cmake --build build -j 8
- name: Test
working-directory: solo/rag-cpp
run: ctest --test-dir build --output-on-failure
# Compiling and passing unit tests would not prove the SDK's WIRE
# behaviour survived the pin — rag-cpp is the reference RCP
# implementation, so that is the property worth guarding. The spec is
# cloned at the SAME tag as the SDK so the two cannot drift apart.
- name: Conformance against the pinned SDK
working-directory: solo/rag-cpp
run: |
tag=$(grep -m1 'set(RAGCPP_RCP_SDK_TAG' CMakeLists.txt | sed -E 's/.*"([^"]+)".*/\1/')
git clone --depth 1 --branch "$tag" https://github.com/1ay1/rcp.git /tmp/rcp-spec
mkdir -p corpus
cp README.md ARCHITECTURE.md FORMAT.md corpus/
./build/cli/ragcpp index corpus ci.ragdb --ext=.md
python3 /tmp/rcp-spec/conformance/check.py -- \
./build/cli/ragcpp serve ci.ragdb --all --write
# ── Ordinary build matrix ──────────────────────────────────────────────────
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: linux / gcc
os: ubuntu-latest
# macOS also exercises the Metal backend, which is ON by default
# there. Its shaders are compiled at runtime by the driver and GitHub
# macOS runners are virtualized without a usable GPU — so this proves
# the RUNTIME-availability fallback works, which is precisely the path
# a user without a GPU takes. Both halves matter: `no-metal` below
# tests the code being COMPILED out, this tests it compiled IN and
# declining at run time.
- name: macos / clang + metal
os: macos-15
steps:
- uses: actions/checkout@v4
- run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
- run: cmake --build build -j 8
# Neither runner has a usable GPU, and ubuntu-latest ships a SOFTWARE
# OpenCL ICD (POCL) that CMake auto-detects. Letting the suite dispatch
# its 200k-vector batches to a CPU-backed "GPU" turned this job from 2m40s
# into a >12-minute hang the first time OpenCL was enabled. The backend now
# refuses software devices, but the tests should not depend on that
# heuristic to terminate.
- run: ctest --test-dir build --output-on-failure
env:
RAGCPP_GPU_BACKEND: none
# A GPU-less build is a first-class configuration, not an afterthought: the
# batch scoring path has a CPU fallback that has to stay correct, and nothing
# on a developer Mac ever compiles with Metal off.
no-metal:
name: macos / metal disabled
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DRAGCPP_WITH_METAL=OFF
- run: cmake --build build -j 8
- run: ctest --test-dir build --output-on-failure
# The OpenCL backend is the CROSS-PLATFORM GPU path — it is what gives NVIDIA,
# AMD and Intel users acceleration at all — so it must keep COMPILING on
# non-Apple targets, which no developer Mac verifies. A CI runner has no GPU,
# so this proves the build and the graceful decline (available() == false ->
# every caller takes its CPU path), not the kernel. The kernel's correctness is
# covered by gpu_active_backend_matches_cpu_whichever_it_is, which runs
# wherever a device does exist.
opencl:
name: linux / opencl build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install the OpenCL headers and an ICD loader
run: sudo apt-get update && sudo apt-get install -y opencl-headers ocl-icd-opencl-dev
- name: Configure with OpenCL required
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DRAGCPP_WITH_OPENCL=ON
- name: Assert the backend was actually compiled in
run: |
grep -q 'RAGCPP_WITH_OPENCL' build/CMakeCache.txt || {
echo "::error::RAGCPP_WITH_OPENCL=ON did not take effect"; exit 1; }
- run: cmake --build build -j 8
# No GPU on a CI runner, and the ICD here is a SOFTWARE implementation
# (POCL). The backend already refuses software devices, but pinning the
# backend off makes this job test what it is actually for — that the
# OpenCL path COMPILES and that every caller degrades to the CPU — without
# depending on that refusal working. Kernel correctness is covered by
# gpu_active_backend_matches_cpu_whichever_it_is on real hardware.
- run: ctest --test-dir build --output-on-failure
env:
RAGCPP_GPU_BACKEND: none
# Windows is a first-class target: users build under MSYS2's ucrt64 toolchain
# (the environment where the store's POSIX file-durability calls — fsync,
# ftruncate, kill — have no CRT equivalent and are supplied by
# include/rag/store/posix_compat.hpp). Nothing on a Linux or macOS runner
# compiles that shim, so without this job a Windows regression is invisible
# until a user hits it. GPU backends are off here — mingw has neither Metal
# nor a default OpenCL ICD — so this exercises the CPU path plus Winsock.
windows:
name: windows / msys2 ucrt64
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: >-
mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-cmake
mingw-w64-ucrt-x86_64-ninja
git
- name: Configure
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build -j
- name: Test
run: ctest --test-dir build --output-on-failure
env:
RAGCPP_GPU_BACKEND: none
# Warnings get their own job so that a new compiler release inventing a
# diagnostic cannot take down the pin check or the test matrix. Pinned to the
# platform where -Werror was actually verified clean; widen it only after
# confirming the same on the other toolchains.
warnings:
name: macos / -Werror
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DRAGCPP_WERROR=ON
- run: cmake --build build -j 8