Skip to content

Commit 6c7a0e2

Browse files
committed
Update to Zig 0.15.1 and automate docs
1 parent bf0825d commit 6c7a0e2

7 files changed

Lines changed: 54 additions & 1469 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

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
}

0 commit comments

Comments
 (0)