Skip to content

Commit 06e20df

Browse files
committed
Switch back to pure Zig Autodoc for documentation
* Remove hybrid MkDocs setup * Restore project documentation to src/lib.zig doc comments * Update build.zig to use standard addLibrary pattern for docs * Simplify GH Pages workflow to use purely Zig
1 parent 50e72d8 commit 06e20df

5 files changed

Lines changed: 51 additions & 104 deletions

File tree

.github/workflows/deploy-docs.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,15 @@ jobs:
2828
uses: DeterminateSystems/magic-nix-cache-action@main
2929

3030
- name: Generate Documentation
31-
run: |
32-
nix develop .#default --command mkdocs build
33-
nix develop .#default --command zig build docs -p site
34-
# The docs step in build.zig installs to <prefix>/docs, so we move it to <prefix>/api
35-
mv site/docs site/api
31+
run: nix develop .#default --command zig build docs -p zig-out
3632

3733
- name: Setup Pages
3834
uses: actions/configure-pages@v5
3935

4036
- name: Upload artifact
4137
uses: actions/upload-pages-artifact@v3
4238
with:
43-
path: site
39+
path: zig-out/docs
4440

4541
deploy:
4642
environment:

build.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,16 @@ pub fn build(b: *std.Build) void {
115115
valgrind_run.addArtifactArg(tests);
116116
valgrind_step.dependOn(&valgrind_run.step);
117117

118+
// Docs step
118119
const docs_step = b.step("docs", "Generate API documentation");
119120

120-
const docs_test = b.addTest(.{
121+
const docs_lib = b.addLibrary(.{
122+
.name = "runz",
121123
.root_module = runz_module,
122124
});
123125

124126
const docs_install = b.addInstallDirectory(.{
125-
.source_dir = docs_test.getEmittedDocs(),
127+
.source_dir = docs_lib.getEmittedDocs(),
126128
.install_dir = .prefix,
127129
.install_subdir = "docs",
128130
});

docs/index.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

mkdocs.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/lib.zig

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,49 @@
1-
//! runz - OCI container runtime and library
1+
//! # runz - OCI Container Runtime & Library
22
//!
3-
//! Container runtime with image pulling, layer extraction,
4-
//! namespace isolation, cgroups, capabilities, networking,
5-
//! and OCI runtime spec support.
3+
//! A high-performance, daemonless OCI container runtime and library written in Zig.
4+
//!
5+
//! ## Technical Specifications
6+
//! - **OCI Standards**: Implements the OCI runtime and image specifications.
7+
//! - **Zig Implementation**: predictable performance and memory safety.
8+
//! - **Daemonless**: Executes containers without a background process.
9+
//! - **Library & CLI**: Provides a standalone binary and a Zig module for integration.
10+
//!
11+
//! ## Installation
12+
//!
13+
//! ### Prerequisites
14+
//! - Zig 0.13.0 or later
15+
//! - Linux (for runtime features)
16+
//!
17+
//! ### Using as a Library
18+
//! Add `runz` to your `build.zig.zon`:
19+
//! ```zig
20+
//! .dependencies = .{
21+
//! .runz = .{
22+
//! .url = "git+https://github.com/ananthb/runz",
23+
//! .hash = "...",
24+
//! },
25+
//! },
26+
//! ```
27+
//!
28+
//! ## Basic Usage
29+
//!
30+
//! ### Pulling an Image
31+
//! ```zig
32+
//! const std = @import("std");
33+
//! const runz = @import("runz");
34+
//!
35+
//! pub fn main() !void {
36+
//! var gpa = std.heap.GeneralPurposeAllocator(.{}){};
37+
//! const allocator = gpa.allocator();
38+
//! defer _ = gpa.deinit();
39+
//!
40+
//! var client = try runz.registry.RegistryClient.init(allocator, "registry-1.docker.io");
41+
//! defer client.deinit();
42+
//!
43+
//! try client.ensureAuth("library/alpine");
44+
//! const manifest = try client.fetchManifest("library/alpine", "latest", null);
45+
//! }
46+
//! ```
647

748
/// OCI spec types (image, runtime, distribution)
849
pub const spec = @import("ocispec");
@@ -63,7 +104,3 @@ pub const annotations = @import("annotations.zig");
63104

64105
/// Linux-specific utilities (namespaces, mounts, seccomp, cgroups, capabilities)
65106
pub const linux_util = @import("linux.zig");
66-
67-
test "docs" {
68-
_ = @import("std").testing;
69-
}

0 commit comments

Comments
 (0)