Skip to content

Commit 7267d1a

Browse files
committed
Update to Zig 0.15.1 and automate docs
1 parent bf0825d commit 7267d1a

9 files changed

Lines changed: 64 additions & 1480 deletions

File tree

.github/workflows/action.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
on:
2+
push:
3+
workflow_dispatch:
4+
5+
permissions:
6+
pages: write
7+
id-token: write
8+
9+
jobs:
10+
autodocs:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: mlugg/setup-zig@v1
15+
with:
16+
version: 0.15.1
17+
- run: |
18+
zig build-lib -femit-docs src/root.zig
19+
mv docs _site
20+
- name: Upload artifact
21+
uses: actions/upload-pages-artifact@v3
22+
23+
test:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
- uses: mlugg/setup-zig@v1
28+
with:
29+
version: 0.15.1
30+
- run: zig build test --summary all
31+
32+
deploy:
33+
environment:
34+
name: github-pages
35+
url: ${{ steps.deployment.outputs.page_url }}
36+
runs-on: ubuntu-latest
37+
needs:
38+
- autodocs
39+
- test
40+
steps:
41+
- name: Deploy to GitHub Pages
42+
id: deployment
43+
uses: actions/deploy-pages@v4

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# zigqlite
22

33
> [!NOTE]
4-
> Forked from https://chiselapp.com/user/javier/repository/zigqlite
4+
> Forked from https://chiselapp.com/user/javier/repository/zigqlite, 2024-07-24
55
66
An [SQLite](https://sqlite.org) binding for [Zig](https://ziglang.org).
77

@@ -12,16 +12,15 @@ zig fetch --save https://github.com/jkoop/zigqlite/archive/COMMIT.zip
1212
```
1313

1414
```zig
15-
// build.zig before b.installArtifact(exe);
16-
17-
const zigqlite = b.dependency("zigqlite", .{
18-
.target = target,
19-
.optimize = optimize,
20-
}).module("zigqlite");
15+
// add to your build.zig, in your Module's .imports
16+
.{
17+
.name = "zigqlite",
18+
.module = b.dependency("zigqlite", .{ .target = target }).module("zigqlite"),
19+
},
2120
21+
// add before `b.installArtifact(exe);`
2222
exe.linkSystemLibrary("c");
2323
exe.linkSystemLibrary("sqlite3"); // apt install libsqlite3-dev
24-
exe.root_module.addImport("zigqlite", zigqlite);
2524
```
2625

2726
## Usage

build.zig

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@ const std = @import("std");
22

33
pub fn build(b: *std.Build) void {
44
const target = b.standardTargetOptions(.{});
5-
const optimize = b.standardOptimizeOption(.{});
65

7-
_ = b.addModule("zigqlite", .{
8-
.root_source_file = b.path("src/sqlite.zig"),
6+
const mod = b.addModule("zigqlite", .{
7+
.root_source_file = b.path("src/root.zig"),
98
.target = target,
10-
.optimize = optimize,
119
});
1210

13-
const main_tests = b.addTest(.{
14-
.root_source_file = b.path("src/sqlite.zig"),
15-
.target = target,
16-
.optimize = optimize,
11+
const mod_tests = b.addTest(.{
12+
.root_module = mod,
1713
});
18-
main_tests.linkSystemLibrary("c");
19-
main_tests.linkSystemLibrary("sqlite3");
2014

21-
const test_step = b.step("test", "Run library tests");
22-
const run_main_tests = b.addRunArtifact(main_tests);
23-
test_step.dependOn(&run_main_tests.step);
15+
mod_tests.linkSystemLibrary("c");
16+
mod_tests.linkSystemLibrary("sqlite3");
17+
18+
const run_mod_tests = b.addRunArtifact(mod_tests);
19+
20+
const test_step = b.step("test", "Run tests");
21+
test_step.dependOn(&run_mod_tests.step);
2422
}

build.zig.zon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
.{
22
.name = .zigqlite,
3-
.version = "0.0.0",
3+
.version = "1.0.0",
44
.fingerprint = 0xd7a23cabfc7db13a, // Changing this has security and trust implications.
5-
.minimum_zig_version = "0.14.1",
5+
.minimum_zig_version = "0.15.1",
66
.dependencies = .{},
77

88
.paths = .{
9+
"LICENSE",
910
"build.zig",
1011
"build.zig.zon",
1112
"src",
12-
"LICENSE",
1313
},
1414
}

0 commit comments

Comments
 (0)