sqlrite 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. sqlrite-0.1.4/.github/workflows/ci.yml +365 -0
  2. sqlrite-0.1.4/.github/workflows/release-pr.yml +138 -0
  3. sqlrite-0.1.4/.github/workflows/release.yml +672 -0
  4. sqlrite-0.1.4/.github/workflows/rust.yml +39 -0
  5. sqlrite-0.1.4/.gitignore +46 -0
  6. sqlrite-0.1.4/CODE_OF_CONDUCT.md +46 -0
  7. sqlrite-0.1.4/Cargo.lock +5762 -0
  8. sqlrite-0.1.4/Cargo.toml +98 -0
  9. sqlrite-0.1.4/LICENSE +21 -0
  10. sqlrite-0.1.4/MAINTAINERS +1 -0
  11. sqlrite-0.1.4/Makefile +43 -0
  12. sqlrite-0.1.4/PKG-INFO +133 -0
  13. sqlrite-0.1.4/README.md +273 -0
  14. sqlrite-0.1.4/desktop/index.html +13 -0
  15. sqlrite-0.1.4/desktop/package-lock.json +1671 -0
  16. sqlrite-0.1.4/desktop/package.json +27 -0
  17. sqlrite-0.1.4/desktop/src/App.svelte +409 -0
  18. sqlrite-0.1.4/desktop/src/app.css +327 -0
  19. sqlrite-0.1.4/desktop/src/main.ts +9 -0
  20. sqlrite-0.1.4/desktop/src/vite-env.d.ts +2 -0
  21. sqlrite-0.1.4/desktop/svelte.config.js +5 -0
  22. sqlrite-0.1.4/desktop/tsconfig.json +17 -0
  23. sqlrite-0.1.4/desktop/vite.config.ts +32 -0
  24. sqlrite-0.1.4/docs/_index.md +55 -0
  25. sqlrite-0.1.4/docs/architecture.md +119 -0
  26. sqlrite-0.1.4/docs/design-decisions.md +270 -0
  27. sqlrite-0.1.4/docs/desktop.md +202 -0
  28. sqlrite-0.1.4/docs/embedding.md +224 -0
  29. sqlrite-0.1.4/docs/file-format.md +382 -0
  30. sqlrite-0.1.4/docs/getting-started.md +133 -0
  31. sqlrite-0.1.4/docs/pager.md +232 -0
  32. sqlrite-0.1.4/docs/release-plan.md +440 -0
  33. sqlrite-0.1.4/docs/release-secrets.md +301 -0
  34. sqlrite-0.1.4/docs/roadmap.md +457 -0
  35. sqlrite-0.1.4/docs/smoke-test.md +605 -0
  36. sqlrite-0.1.4/docs/sql-engine.md +154 -0
  37. sqlrite-0.1.4/docs/storage-model.md +202 -0
  38. sqlrite-0.1.4/docs/supported-sql.md +331 -0
  39. sqlrite-0.1.4/docs/usage.md +72 -0
  40. sqlrite-0.1.4/examples/README.md +93 -0
  41. sqlrite-0.1.4/examples/c/Makefile +42 -0
  42. sqlrite-0.1.4/examples/c/hello.c +103 -0
  43. sqlrite-0.1.4/examples/go/go.mod +11 -0
  44. sqlrite-0.1.4/examples/go/hello.go +105 -0
  45. sqlrite-0.1.4/examples/nodejs/hello.mjs +55 -0
  46. sqlrite-0.1.4/examples/python/hello.py +58 -0
  47. sqlrite-0.1.4/examples/rust/quickstart.rs +57 -0
  48. sqlrite-0.1.4/examples/wasm/Makefile +30 -0
  49. sqlrite-0.1.4/examples/wasm/index.html +134 -0
  50. sqlrite-0.1.4/images/SQLRite - Desktop.png +0 -0
  51. sqlrite-0.1.4/images/SQLRite Data Structures.png +0 -0
  52. sqlrite-0.1.4/images/SQLRite Simple SQL Execution High Level Diagram.png +0 -0
  53. sqlrite-0.1.4/images/SQLRite Simple SQL INSERT Execution High Level Diagram (Insert Row).png +0 -0
  54. sqlrite-0.1.4/images/SQLRite Simple SQL INSERT Execution High Level Diagram.png +0 -0
  55. sqlrite-0.1.4/images/SQLRite_logo.png +0 -0
  56. sqlrite-0.1.4/images/architecture.png +0 -0
  57. sqlrite-0.1.4/pyproject.toml +42 -0
  58. sqlrite-0.1.4/rust-toolchain.toml +3 -0
  59. sqlrite-0.1.4/samples/AST.delete.example +29 -0
  60. sqlrite-0.1.4/samples/AST.insert.exemple +44 -0
  61. sqlrite-0.1.4/samples/AST.select.example +45 -0
  62. sqlrite-0.1.4/samples/AST.update.example +43 -0
  63. sqlrite-0.1.4/samples/CREATE TABLE sqlrite_schema.sql +7 -0
  64. sqlrite-0.1.4/samples/CREATE_TABLE with duplicate.sql +7 -0
  65. sqlrite-0.1.4/samples/CREATE_TABLE.sql +24 -0
  66. sqlrite-0.1.4/samples/INSERT.sql +16 -0
  67. sqlrite-0.1.4/scripts/bump-version.sh +158 -0
  68. sqlrite-0.1.4/sdk/go/README.md +119 -0
  69. sqlrite-0.1.4/sdk/go/conn.go +217 -0
  70. sqlrite-0.1.4/sdk/go/go.mod +12 -0
  71. sqlrite-0.1.4/sdk/go/rows.go +128 -0
  72. sqlrite-0.1.4/sdk/go/sqlrite.go +223 -0
  73. sqlrite-0.1.4/sdk/go/sqlrite_test.go +297 -0
  74. sqlrite-0.1.4/sdk/go/stmt.go +98 -0
  75. sqlrite-0.1.4/sdk/python/Cargo.toml +40 -0
  76. sqlrite-0.1.4/sdk/python/README.md +107 -0
  77. sqlrite-0.1.4/sdk/python/src/lib.rs +527 -0
  78. sqlrite-0.1.4/sdk/python/tests/test_sqlrite.py +246 -0
  79. sqlrite-0.1.4/src/connection.rs +649 -0
  80. sqlrite-0.1.4/src/error.rs +114 -0
  81. sqlrite-0.1.4/src/lib.rs +79 -0
  82. sqlrite-0.1.4/src/main.rs +210 -0
  83. sqlrite-0.1.4/src/meta_command/mod.rs +315 -0
  84. sqlrite-0.1.4/src/repl/mod.rs +144 -0
  85. sqlrite-0.1.4/src/sql/db/database.rs +229 -0
  86. sqlrite-0.1.4/src/sql/db/mod.rs +3 -0
  87. sqlrite-0.1.4/src/sql/db/secondary_index.rs +339 -0
  88. sqlrite-0.1.4/src/sql/db/table.rs +1028 -0
  89. sqlrite-0.1.4/src/sql/executor.rs +767 -0
  90. sqlrite-0.1.4/src/sql/mod.rs +1114 -0
  91. sqlrite-0.1.4/src/sql/pager/cell.rs +511 -0
  92. sqlrite-0.1.4/src/sql/pager/file.rs +66 -0
  93. sqlrite-0.1.4/src/sql/pager/header.rs +77 -0
  94. sqlrite-0.1.4/src/sql/pager/index_cell.rs +144 -0
  95. sqlrite-0.1.4/src/sql/pager/interior_page.rs +477 -0
  96. sqlrite-0.1.4/src/sql/pager/mod.rs +1280 -0
  97. sqlrite-0.1.4/src/sql/pager/overflow.rs +359 -0
  98. sqlrite-0.1.4/src/sql/pager/page.rs +62 -0
  99. sqlrite-0.1.4/src/sql/pager/pager.rs +1219 -0
  100. sqlrite-0.1.4/src/sql/pager/table_page.rs +490 -0
  101. sqlrite-0.1.4/src/sql/pager/varint.rs +194 -0
  102. sqlrite-0.1.4/src/sql/pager/wal.rs +678 -0
  103. sqlrite-0.1.4/src/sql/parser/create.rs +179 -0
  104. sqlrite-0.1.4/src/sql/parser/insert.rs +91 -0
  105. sqlrite-0.1.4/src/sql/parser/mod.rs +3 -0
  106. sqlrite-0.1.4/src/sql/parser/select.rs +233 -0
  107. sqlrite-0.1.4/src/sql/tokenizer.rs +7 -0
@@ -0,0 +1,365 @@
1
+ # Continuous integration — runs on every pull request + every push to
2
+ # main. Blocks PR merge when anything fails (once branch protection is
3
+ # configured on the GitHub side — see docs/release-plan.md Phase 6c).
4
+ #
5
+ # Jobs:
6
+ # - rust-build-and-test {ubuntu, macos, windows} cargo build + test
7
+ # - rust-lint ubuntu fmt + clippy + doc
8
+ # - python-sdk {ubuntu, macos, windows} maturin develop + pytest
9
+ # - nodejs-sdk {ubuntu, macos, windows} napi build + node --test
10
+ # - go-sdk {ubuntu, macos} cgo against libsqlrite_c + go test
11
+ # - wasm-build ubuntu wasm-pack build + size report
12
+ # - desktop-build ubuntu npm ci + cargo build -p sqlrite-desktop
13
+ #
14
+ # All jobs use caching so a warm PR run takes 2–3 minutes on ubuntu.
15
+ # Go CI skips Windows for Phase 6b — Go's cgo on Windows needs a mingw
16
+ # setup that we haven't wired into the Go sidecar; deferred follow-up.
17
+
18
+ name: CI
19
+
20
+ on:
21
+ pull_request:
22
+ push:
23
+ branches: [main]
24
+
25
+ # Cancel previous CI runs on the same branch when a new push arrives.
26
+ # Saves compute + shortens PR feedback loops.
27
+ concurrency:
28
+ group: ${{ github.workflow }}-${{ github.ref }}
29
+ cancel-in-progress: true
30
+
31
+ permissions:
32
+ contents: read
33
+
34
+ env:
35
+ # Suppress the "incremental compilation is not recommended for CI"
36
+ # advice line-noise across every Rust job. We don't want incremental
37
+ # on CI anyway (every run is from scratch).
38
+ CARGO_INCREMENTAL: '0'
39
+ # Colored cargo output survives into the GitHub Actions log view.
40
+ CARGO_TERM_COLOR: always
41
+ # Note: we intentionally do NOT set `RUSTFLAGS: '-D warnings'` at
42
+ # the workflow level. The codebase has ~24 pre-existing clippy
43
+ # warnings (mostly cosmetic — overindented docstrings, `Vec::new()
44
+ # + push` patterns, etc.) that will get cleaned up incrementally.
45
+ # Once the count is zero, we'll tighten by adding `-D warnings`
46
+ # here. Hard clippy errors (deny-by-default lints like
47
+ # `approx_constant`) still fail CI without this flag — that's the
48
+ # backstop for real correctness issues.
49
+
50
+ jobs:
51
+ # ---------------------------------------------------------------------------
52
+ # Rust: build + test the whole workspace (minus the desktop crate —
53
+ # it needs a frontend build, handled in its own job).
54
+ rust-build-and-test:
55
+ name: rust (${{ matrix.os }})
56
+ runs-on: ${{ matrix.os }}
57
+ strategy:
58
+ fail-fast: false
59
+ matrix:
60
+ os: [ubuntu-latest, macos-latest, windows-latest]
61
+ defaults:
62
+ run:
63
+ # Bash on every OS — Windows uses Git Bash (preinstalled on
64
+ # `windows-latest`). Without this, Windows defaults to pwsh,
65
+ # which doesn't understand bash's backslash line-continuation
66
+ # in multi-line `run:` blocks.
67
+ shell: bash
68
+ steps:
69
+ - uses: actions/checkout@v4
70
+
71
+ - name: Install Rust
72
+ uses: dtolnay/rust-toolchain@stable
73
+
74
+ - name: Cache cargo
75
+ uses: Swatinem/rust-cache@v2
76
+ with:
77
+ # Bucket by OS + job — separate caches so a Linux miss
78
+ # doesn't steal macOS's target dir and vice versa.
79
+ shared-key: rust-build-and-test
80
+
81
+ # Exclusions explained:
82
+ #
83
+ # - `sqlrite-desktop` needs the Svelte frontend built first
84
+ # (handled in the `desktop-build` job).
85
+ #
86
+ # - `sqlrite-python` + `sqlrite-nodejs` are PyO3/napi-rs
87
+ # extension-module cdylibs. Their `extension-module` feature
88
+ # tells the Rust toolchain not to link libpython / libnode at
89
+ # compile time, so `--all-targets` fails on macOS when it
90
+ # tries to build the auto-generated test binary for their
91
+ # rlib targets (unresolved Python/Node symbols). The per-SDK
92
+ # `python-sdk` + `nodejs-sdk` jobs below exercise these
93
+ # crates through their native tooling (maturin / napi-rs).
94
+ - name: cargo build
95
+ run: |
96
+ cargo build --workspace \
97
+ --exclude sqlrite-desktop \
98
+ --exclude sqlrite-python \
99
+ --exclude sqlrite-nodejs \
100
+ --all-targets
101
+
102
+ - name: cargo test
103
+ run: |
104
+ cargo test --workspace \
105
+ --exclude sqlrite-desktop \
106
+ --exclude sqlrite-python \
107
+ --exclude sqlrite-nodejs
108
+
109
+ # ---------------------------------------------------------------------------
110
+ # Rust: lint — fmt + clippy + doc. One cell (ubuntu) because these
111
+ # are platform-independent checks. Runs in parallel with the matrix
112
+ # build/test job above.
113
+ rust-lint:
114
+ name: rust lint
115
+ runs-on: ubuntu-latest
116
+ steps:
117
+ - uses: actions/checkout@v4
118
+
119
+ - name: Install Rust + components
120
+ uses: dtolnay/rust-toolchain@stable
121
+ with:
122
+ components: rustfmt, clippy
123
+
124
+ - uses: Swatinem/rust-cache@v2
125
+ with:
126
+ shared-key: rust-lint
127
+
128
+ - name: cargo fmt
129
+ run: cargo fmt --all -- --check
130
+
131
+ - name: cargo clippy
132
+ # No `-D warnings` for now — see the top-level env comment.
133
+ # Deny-by-default lints (the ones that surface real bugs,
134
+ # e.g. `approx_constant`) still fail without the flag.
135
+ # Exclude the extension-module SDK cdylibs for the same
136
+ # reason as `rust-build-and-test` — their test binaries
137
+ # can't link standalone.
138
+ run: |
139
+ cargo clippy --workspace \
140
+ --exclude sqlrite-desktop \
141
+ --exclude sqlrite-python \
142
+ --exclude sqlrite-nodejs \
143
+ --all-targets
144
+
145
+ - name: cargo doc
146
+ # `--no-deps` skips deps docs (they build on docs.rs, not here).
147
+ # Not warnings-as-errors yet — same rationale as clippy above.
148
+ run: |
149
+ cargo doc --workspace \
150
+ --exclude sqlrite-desktop \
151
+ --exclude sqlrite-python \
152
+ --exclude sqlrite-nodejs \
153
+ --no-deps
154
+
155
+ # ---------------------------------------------------------------------------
156
+ # Python SDK: build the PyO3 extension, install into a venv, run pytest.
157
+ python-sdk:
158
+ name: python-sdk (${{ matrix.os }})
159
+ runs-on: ${{ matrix.os }}
160
+ strategy:
161
+ fail-fast: false
162
+ matrix:
163
+ os: [ubuntu-latest, macos-latest, windows-latest]
164
+ defaults:
165
+ run:
166
+ # Bash on every runner (Windows' git bash is available via
167
+ # `shell: bash`) so the same commands work everywhere — no
168
+ # PowerShell / cmd fork.
169
+ shell: bash
170
+ steps:
171
+ - uses: actions/checkout@v4
172
+
173
+ - uses: actions/setup-python@v5
174
+ with:
175
+ python-version: '3.12'
176
+ cache: pip
177
+
178
+ - uses: dtolnay/rust-toolchain@stable
179
+ - uses: Swatinem/rust-cache@v2
180
+ with:
181
+ shared-key: python-sdk-${{ matrix.os }}
182
+
183
+ # maturin develop needs a virtualenv or conda env to install
184
+ # into. We create one per job + export VIRTUAL_ENV so every
185
+ # subsequent step sees it. Cross-platform: Windows venvs have
186
+ # `Scripts/` instead of `bin/`, so we pick the right path.
187
+ - name: Create venv
188
+ run: |
189
+ python -m venv .venv
190
+ if [ -d .venv/bin ]; then
191
+ echo "VIRTUAL_ENV=$PWD/.venv" >> "$GITHUB_ENV"
192
+ echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
193
+ else
194
+ echo "VIRTUAL_ENV=$PWD/.venv" >> "$GITHUB_ENV"
195
+ echo "$PWD/.venv/Scripts" >> "$GITHUB_PATH"
196
+ fi
197
+
198
+ - name: Install maturin + pytest
199
+ run: pip install maturin pytest
200
+
201
+ - name: maturin develop
202
+ working-directory: sdk/python
203
+ run: maturin develop
204
+
205
+ - name: pytest
206
+ working-directory: sdk/python
207
+ run: python -m pytest tests/
208
+
209
+ # ---------------------------------------------------------------------------
210
+ # Node.js SDK: napi-rs build produces a .node binary. `npm test`
211
+ # exercises the node:test suite against it.
212
+ nodejs-sdk:
213
+ name: nodejs-sdk (${{ matrix.os }})
214
+ runs-on: ${{ matrix.os }}
215
+ strategy:
216
+ fail-fast: false
217
+ matrix:
218
+ os: [ubuntu-latest, macos-latest, windows-latest]
219
+ defaults:
220
+ run:
221
+ shell: bash
222
+ steps:
223
+ - uses: actions/checkout@v4
224
+
225
+ - uses: actions/setup-node@v4
226
+ with:
227
+ node-version: '20'
228
+ cache: 'npm'
229
+ cache-dependency-path: sdk/nodejs/package-lock.json
230
+
231
+ - uses: dtolnay/rust-toolchain@stable
232
+ - uses: Swatinem/rust-cache@v2
233
+ with:
234
+ shared-key: nodejs-sdk-${{ matrix.os }}
235
+
236
+ - name: npm ci
237
+ working-directory: sdk/nodejs
238
+ run: npm ci
239
+
240
+ - name: npm run build
241
+ working-directory: sdk/nodejs
242
+ run: npm run build
243
+
244
+ - name: npm test
245
+ working-directory: sdk/nodejs
246
+ run: npm test
247
+
248
+ # ---------------------------------------------------------------------------
249
+ # Go SDK: cgo-linked against libsqlrite_c. We build the FFI crate in
250
+ # release mode first so the .so / .dylib is available for go test.
251
+ #
252
+ # Skips Windows for Phase 6b — Go's cgo on Windows needs a mingw
253
+ # toolchain that isn't preinstalled on `windows-latest` runners; a
254
+ # follow-up task in the roadmap adds it.
255
+ go-sdk:
256
+ name: go-sdk (${{ matrix.os }})
257
+ runs-on: ${{ matrix.os }}
258
+ strategy:
259
+ fail-fast: false
260
+ matrix:
261
+ os: [ubuntu-latest, macos-latest]
262
+ steps:
263
+ - uses: actions/checkout@v4
264
+
265
+ - uses: actions/setup-go@v5
266
+ with:
267
+ go-version: '1.21'
268
+ cache-dependency-path: sdk/go/go.mod
269
+
270
+ - uses: dtolnay/rust-toolchain@stable
271
+ - uses: Swatinem/rust-cache@v2
272
+ with:
273
+ shared-key: go-sdk-${{ matrix.os }}
274
+
275
+ - name: Build libsqlrite_c
276
+ # The Go driver's `#cgo LDFLAGS` references target/release.
277
+ run: cargo build --release -p sqlrite-ffi
278
+
279
+ - name: go test ./...
280
+ working-directory: sdk/go
281
+ run: go test -v ./...
282
+
283
+ # ---------------------------------------------------------------------------
284
+ # WASM: only the build + size check (no tests — the WASM module's
285
+ # behavior is covered by the other SDKs' test suites; WASM just
286
+ # re-targets the same engine). One cell because WASM is a
287
+ # cross-compilation target, not a host OS.
288
+ wasm-build:
289
+ name: wasm-build
290
+ runs-on: ubuntu-latest
291
+ steps:
292
+ - uses: actions/checkout@v4
293
+
294
+ - uses: dtolnay/rust-toolchain@stable
295
+ with:
296
+ targets: wasm32-unknown-unknown
297
+
298
+ - uses: Swatinem/rust-cache@v2
299
+ with:
300
+ # sdk/wasm is its own workspace (see Cargo.toml comment);
301
+ # key it separately so it doesn't blow the main cache.
302
+ workspaces: sdk/wasm
303
+ shared-key: wasm-build
304
+
305
+ - name: Install wasm-pack
306
+ uses: jetli/wasm-pack-action@v0.4.0
307
+
308
+ - name: wasm-pack build --target web --release
309
+ working-directory: sdk/wasm
310
+ run: wasm-pack build --target web --release
311
+
312
+ - name: Report .wasm size
313
+ # Surfaces size regressions in PR logs. Not a hard limit yet;
314
+ # if/when we set a budget, convert to a failing check.
315
+ working-directory: sdk/wasm
316
+ run: |
317
+ size=$(stat -c '%s' pkg/sqlrite_wasm_bg.wasm 2>/dev/null || stat -f '%z' pkg/sqlrite_wasm_bg.wasm)
318
+ echo "::notice title=WASM bundle size::sqlrite_wasm_bg.wasm = $size bytes ($(( size / 1024 )) KiB)"
319
+
320
+ # ---------------------------------------------------------------------------
321
+ # Desktop: Tauri's Rust side + the Svelte frontend. Needs Node to
322
+ # build the frontend first because Tauri's build.rs looks for the
323
+ # compiled assets in `desktop/dist/`.
324
+ #
325
+ # One cell (ubuntu) for CI speed — release builds are tested in the
326
+ # Phase 6e desktop-release workflow's build matrix on all three OSes.
327
+ # Here we just need to prove the Rust side compiles.
328
+ desktop-build:
329
+ name: desktop-build
330
+ runs-on: ubuntu-latest
331
+ steps:
332
+ - uses: actions/checkout@v4
333
+
334
+ - uses: actions/setup-node@v4
335
+ with:
336
+ node-version: '20'
337
+ cache: 'npm'
338
+ cache-dependency-path: desktop/package-lock.json
339
+
340
+ - uses: dtolnay/rust-toolchain@stable
341
+
342
+ # Tauri needs Linux webkit + friends before cargo build runs.
343
+ - name: Install Tauri Linux deps
344
+ run: |
345
+ sudo apt-get update
346
+ sudo apt-get install -y \
347
+ libwebkit2gtk-4.1-dev \
348
+ libayatana-appindicator3-dev \
349
+ librsvg2-dev \
350
+ patchelf
351
+
352
+ - uses: Swatinem/rust-cache@v2
353
+ with:
354
+ shared-key: desktop-build
355
+
356
+ - name: npm ci
357
+ working-directory: desktop
358
+ run: npm ci
359
+
360
+ - name: Build frontend
361
+ working-directory: desktop
362
+ run: npm run build
363
+
364
+ - name: Build Rust side
365
+ run: cargo build -p sqlrite-desktop
@@ -0,0 +1,138 @@
1
+ # The "prepare" half of the two-workflow release flow. Dispatched
2
+ # manually with a target semver; runs `scripts/bump-version.sh`,
3
+ # refreshes `Cargo.lock`, and opens a Release PR that a human
4
+ # reviews + merges. Once that PR merges, `release.yml` auto-fires
5
+ # to tag + publish everything.
6
+ #
7
+ # See docs/release-plan.md for the full design; docs/release-secrets.md
8
+ # for the one-time registry setup this depends on.
9
+
10
+ name: Release PR
11
+
12
+ on:
13
+ workflow_dispatch:
14
+ inputs:
15
+ version:
16
+ description: 'Semver to bump everything to (e.g., 0.2.0 or 1.0.0-rc.1)'
17
+ required: true
18
+ type: string
19
+
20
+ # `contents: write` so the workflow can push the new branch;
21
+ # `pull-requests: write` so it can open the PR. No other perms.
22
+ permissions:
23
+ contents: write
24
+ pull-requests: write
25
+
26
+ # Only one release PR at a time per version. If someone double-
27
+ # dispatches at the same version, the second run errors out on
28
+ # "branch already exists" rather than racing.
29
+ concurrency:
30
+ group: release-pr-${{ inputs.version }}
31
+ cancel-in-progress: false
32
+
33
+ jobs:
34
+ open-release-pr:
35
+ runs-on: ubuntu-latest
36
+ steps:
37
+ - uses: actions/checkout@v4
38
+ with:
39
+ ref: main
40
+ # Full history so `git log` / tag checks work — the
41
+ # version validation below needs to compare against the
42
+ # current version string in Cargo.toml, which is a
43
+ # single-commit lookup so we could live without depth 0,
44
+ # but it costs ~nothing on a repo this size.
45
+ fetch-depth: 0
46
+
47
+ - name: Validate version input
48
+ id: validate
49
+ run: |
50
+ VERSION="${{ inputs.version }}"
51
+ # Same semver regex as scripts/bump-version.sh — keep them
52
+ # in sync. Copy-pasted rather than shared to avoid adding
53
+ # a Python / awk dependency here.
54
+ if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then
55
+ echo "::error::'$VERSION' is not a valid semver (X.Y.Z[-pre][+build])"
56
+ exit 1
57
+ fi
58
+
59
+ CURRENT=$(grep '^version = ' Cargo.toml | head -1 | cut -d'"' -f2)
60
+ if [ "$VERSION" = "$CURRENT" ]; then
61
+ echo "::error::version is already $CURRENT — pick a new one"
62
+ exit 1
63
+ fi
64
+
65
+ # Reject re-using an existing tag. The policy is "never
66
+ # reuse, always bump past" — see release-plan.md.
67
+ if git rev-parse "v$VERSION" >/dev/null 2>&1; then
68
+ echo "::error::tag v$VERSION already exists — pick a higher version"
69
+ exit 1
70
+ fi
71
+
72
+ echo "current=$CURRENT" >> "$GITHUB_OUTPUT"
73
+
74
+ - name: Install Rust
75
+ # Needed only so `cargo build` below can refresh Cargo.lock
76
+ # with the new workspace member versions.
77
+ uses: dtolnay/rust-toolchain@stable
78
+
79
+ - name: Cache cargo
80
+ uses: Swatinem/rust-cache@v2
81
+ with:
82
+ shared-key: release-pr
83
+
84
+ - name: Run bump-version.sh
85
+ run: ./scripts/bump-version.sh "${{ inputs.version }}"
86
+
87
+ - name: Refresh Cargo.lock
88
+ # `cargo build` updates Cargo.lock with the new workspace
89
+ # member versions. `--exclude sqlrite-desktop` because the
90
+ # desktop crate needs the Svelte frontend compiled first
91
+ # (Tauri's build.rs looks for `desktop/dist/`) — we're not
92
+ # building a release artifact here, just refreshing the lock.
93
+ # `--quiet` keeps the log tidy; a real compile failure still
94
+ # surfaces.
95
+ run: cargo build --workspace --exclude sqlrite-desktop --quiet
96
+
97
+ - name: Configure git identity
98
+ # Use the github-actions[bot] identity so the commit shows
99
+ # up as from the bot, not as an impersonation. The email is
100
+ # the stable one GitHub uses for the bot account.
101
+ run: |
102
+ git config user.name "github-actions[bot]"
103
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
104
+
105
+ - name: Create branch + commit
106
+ # The commit message prefix `release: v` is load-bearing —
107
+ # `release.yml` matches on it to trigger the publish side
108
+ # after the PR merges. Keep it exact.
109
+ run: |
110
+ BRANCH="release/v${{ inputs.version }}"
111
+ git checkout -b "$BRANCH"
112
+ git add -A
113
+ git commit -m "release: v${{ inputs.version }}"
114
+ git push -u origin "$BRANCH"
115
+
116
+ - name: Open PR
117
+ env:
118
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119
+ run: |
120
+ gh pr create \
121
+ --title "Release v${{ inputs.version }}" \
122
+ --head "release/v${{ inputs.version }}" \
123
+ --base main \
124
+ --body "Bumps every product to \`v${{ inputs.version }}\` (previously \`${{ steps.validate.outputs.current }}\`).
125
+
126
+ The diff should be exactly:
127
+ - 10 manifests with a new \`version\` string (root Cargo.toml, sqlrite-ffi, sdk/python × 2, sdk/nodejs × 2, sdk/wasm, desktop × 3).
128
+ - \`Cargo.lock\` refreshed with the new workspace versions.
129
+
130
+ **Once this PR merges**, the \`release.yml\` workflow automatically:
131
+ 1. Tags \`sqlrite-v${{ inputs.version }}\`, \`sqlrite-ffi-v${{ inputs.version }}\`, and umbrella \`v${{ inputs.version }}\` against the merge commit.
132
+ 2. Publishes the Rust engine to crates.io (gated by maintainer approval in the \`release\` environment).
133
+ 3. Builds \`libsqlrite_c\` for Linux x86_64/aarch64 + macOS aarch64 + Windows x86_64 and uploads them to the \`sqlrite-ffi\` GitHub Release.
134
+ 4. Creates the umbrella \`v${{ inputs.version }}\` GitHub Release with auto-generated notes linking to the per-product ones.
135
+
136
+ Python / Node.js / WASM / Go / desktop SDKs land as their publish jobs come online (Phases 6e–6i).
137
+
138
+ See [docs/release-plan.md](../blob/main/docs/release-plan.md) for the full flow."