-
Notifications
You must be signed in to change notification settings - Fork 0
171 lines (159 loc) · 5.6 KB
/
Copy pathci.yml
File metadata and controls
171 lines (159 loc) · 5.6 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
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: build + test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build loadable extension
run: make loadable
- name: Run test suite
run: make test
amalgamation:
name: amalgamation compiles
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# regenerate the single-file amalgamation from the current sources and
# compile it (static + loadable), so it can never drift from the tree.
- name: Generate + compile amalgamation
run: make amalgamation-check
bindings:
name: bindings (node + rust)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# rust crate: compiles the amalgamation via build.rs, register + forecast
- name: Rust crate
run: make rust-src && cargo test --manifest-path bindings/rust/Cargo.toml
- uses: actions/setup-node@v7
with:
node-version: "22"
# node binding: load the extension and run a forecast through node:sqlite
- name: Node binding
run: |
make loadable
cp dist/predict0.so bindings/node/predict0.so
node --experimental-sqlite -e '
const sp = require("./bindings/node/index.cjs");
const { DatabaseSync } = require("node:sqlite");
const db = new DatabaseSync(":memory:", { allowExtension: true });
sp.load(db);
db.exec("CREATE TABLE r(ts TEXT, value REAL)");
const ins = db.prepare("INSERT INTO r VALUES (?,?)");
for (let i = 0; i < 96; i++)
ins.run("2024-01-01T" + String(i % 24).padStart(2, "0") + ":00:00", 50 + 10 * Math.sin(i));
const doc = JSON.parse(db.prepare("SELECT forecast(ts, value, 6) d FROM r").get().d);
if (doc.status !== "ok" || doc.rows.length !== 6) { console.error("bad forecast doc"); process.exit(1); }
const x = db.prepare("SELECT count(*) c FROM forecast_rows(\x27" + JSON.stringify(doc).replaceAll("\x27","") + "\x27)").get().c;
if (x !== 6) { console.error("expected 6 expanded rows, got", x); process.exit(1); }
console.log("node binding OK");
'
# drizzle ORM smoke: the aggregate form composed through a query
# builder end to end (the RFC §4.2.8 ORM path)
- name: Drizzle smoke (aggregate form)
run: |
cd bindings/node
npm install --no-save better-sqlite3 drizzle-orm
node test/drizzle-smoke.mjs
sanitizers:
name: ASan + UBSan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Run sanitizer soak
run: make test-asan CC=clang
valgrind:
name: valgrind
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# Run valgrind inside a container instead of apt-installing it on the
# runner: the host's apt contends with the runner's background
# unattended-upgrades dpkg lock and can hang. `make test-valgrind` builds
# the soak in a fresh gcc:13 container (glibc + gcc coverage too) and
# runs it under valgrind with --error-exitcode.
- name: Run valgrind (containerized)
run: make test-valgrind
fuzz-smoke:
name: fuzz smoke (60s)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Build + run libFuzzer
run: make fuzz
windows:
name: windows (mingw)
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v7
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc make curl unzip mingw-w64-x86_64-sqlite3
- name: Build loadable DLL
run: make loadable
- name: Build + run soak (static, portability proof)
run: make soak && ./dist/soak
- name: Load the DLL via the SQLite CLI
run: |
sqlite3 ":memory:" ".load ./dist/predict0" "SELECT predict_version();"
wasm:
name: wasm (emscripten)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install emscripten
run: |
git clone --depth 1 https://github.com/emscripten-core/emsdk.git
./emsdk/emsdk install latest
./emsdk/emsdk activate latest
- name: Compile soak to WebAssembly
run: |
source ./emsdk/emsdk_env.sh
make soak-wasm
- name: Run under node
run: node dist/soak.js
onnx:
name: onnx (cpu)
runs-on: ubuntu-latest
env:
ORT_VERSION: "1.27.1"
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Fetch onnxruntime
run: |
curl -fsSL -o ort.tgz \
"https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION}/onnxruntime-linux-x64-${ORT_VERSION}.tgz"
tar xzf ort.tgz
echo "ONNXRUNTIME_PREFIX=$PWD/onnxruntime-linux-x64-${ORT_VERSION}" \
>> "$GITHUB_ENV"
- name: Build the onnx variant + run its tests
run: make test-onnx
- name: ASan + LSan soak of the onnx backend
run: make test-asan-onnx
- name: Compile-check the GPU build (CUDA/TensorRT wiring)
run: make loadable-onnx-gpu