Author:
Hash:
Timestamp:
+114 -81 +/-4 browse
Kevin Schoon [me@kevinschoon.com]
f9decc55206aabc0ce7ea18936e2d89daca1c065
Thu, 14 May 2026 15:41:36 +0000 (2 days ago)
| 1 | diff --git a/.ayllu-build.json b/.ayllu-build.json |
| 2 | deleted file mode 100644 |
| 3 | index 738c441..0000000 |
| 4 | --- a/.ayllu-build.json |
| 5 | +++ /dev/null |
| 6 | @@ -1,64 +0,0 @@ |
| 7 | - { |
| 8 | - "workflows": [ |
| 9 | - { |
| 10 | - "name": "lint", |
| 11 | - "image": "localhost/ayllu-build:latest", |
| 12 | - "steps": [ |
| 13 | - { |
| 14 | - "name": "cargo-fmt", |
| 15 | - "input": "cargo fmt --check" |
| 16 | - } |
| 17 | - ] |
| 18 | - }, |
| 19 | - { |
| 20 | - "name": "test", |
| 21 | - "image": "localhost/ayllu-build:latest", |
| 22 | - "depends_on": [ |
| 23 | - "lint" |
| 24 | - ], |
| 25 | - "steps": [ |
| 26 | - { |
| 27 | - "name": "cargo-test", |
| 28 | - "input": "cargo test" |
| 29 | - }, |
| 30 | - { |
| 31 | - "name": "cargo-clippy", |
| 32 | - "input": "cargo clippy" |
| 33 | - } |
| 34 | - ] |
| 35 | - }, |
| 36 | - { |
| 37 | - "name": "build", |
| 38 | - "image": "localhost/ayllu-build:latest", |
| 39 | - "depends_on": [ |
| 40 | - "test" |
| 41 | - ], |
| 42 | - "steps": [ |
| 43 | - { |
| 44 | - "name": "cargo-build-quipu", |
| 45 | - "input": "cargo build --package quipu" |
| 46 | - }, |
| 47 | - { |
| 48 | - "name": "cargo-build-ayllu-web", |
| 49 | - "input": "cargo build --package ayllu-web" |
| 50 | - }, |
| 51 | - { |
| 52 | - "name": "cargo-build-ayllu-shell", |
| 53 | - "input": "cargo build --package ayllu-shell" |
| 54 | - }, |
| 55 | - { |
| 56 | - "name": "cargo-build-ayllu-keys", |
| 57 | - "input": "cargo build --package ayllu-keys" |
| 58 | - }, |
| 59 | - { |
| 60 | - "name": "cargo-build-ayllu-init", |
| 61 | - "input": "cargo build --package ayllu-init" |
| 62 | - }, |
| 63 | - { |
| 64 | - "name": "cargo-build-ayllu-build", |
| 65 | - "input": "cargo build --package ayllu-build" |
| 66 | - } |
| 67 | - ] |
| 68 | - } |
| 69 | - ] |
| 70 | - } |
| 71 | diff --git a/.ayllu-build.jsonnet b/.ayllu-build.jsonnet |
| 72 | new file mode 100644 |
| 73 | index 0000000..2e69fd1 |
| 74 | --- /dev/null |
| 75 | +++ b/.ayllu-build.jsonnet |
| 76 | @@ -0,0 +1,93 @@ |
| 77 | + local target = 'x86_64-unknown-linux-musl'; |
| 78 | + local build_image = 'localhost/ayllu-build:latest'; |
| 79 | + |
| 80 | + local binaries = [ |
| 81 | + 'ayllu-init', |
| 82 | + 'ayllu-build', |
| 83 | + 'ayllu-keys', |
| 84 | + 'ayllu-migrate', |
| 85 | + 'ayllu-web', |
| 86 | + 'quipu', |
| 87 | + ]; |
| 88 | + |
| 89 | + local subcommands = [ |
| 90 | + 'ayllu-shell-evaluate', |
| 91 | + 'ayllu-shell-git-receive-pack', |
| 92 | + 'ayllu-shell-git-upload-pack', |
| 93 | + ]; |
| 94 | + |
| 95 | + local compile_binary(name) = { |
| 96 | + name: 'Cargo Build ' + name, |
| 97 | + input: 'cargo build --release --target=' + target + ' --bin=' + name, |
| 98 | + outputs: [ |
| 99 | + { |
| 100 | + path: 'target/x86_64-unknown-linux-musl/release/' + name, |
| 101 | + sha256sum: null, |
| 102 | + }, |
| 103 | + ], |
| 104 | + }; |
| 105 | + |
| 106 | + local zsh_complete(name) = { |
| 107 | + path: 'target/dist/completion/' + '_' + name, |
| 108 | + sha256sum: null, |
| 109 | + }; |
| 110 | + |
| 111 | + local bash_complete(name) = { |
| 112 | + path: 'target/dist/completion/' + name + '.bash', |
| 113 | + sha256sum: null, |
| 114 | + }; |
| 115 | + |
| 116 | + local man_page(name, section) = { |
| 117 | + path: "target/dist/man/" + name + "." + section, |
| 118 | + sha256sum: null |
| 119 | + }; |
| 120 | + |
| 121 | + local short_step(name, input) = { |
| 122 | + name: name, |
| 123 | + input: input, |
| 124 | + }; |
| 125 | + |
| 126 | + { |
| 127 | + workflows: [ |
| 128 | + { |
| 129 | + name: 'Lint', |
| 130 | + image: build_image, |
| 131 | + steps: [short_step('Cargo Lint', 'cargo fmt --check')], |
| 132 | + }, |
| 133 | + { |
| 134 | + name: 'Test', |
| 135 | + image: build_image, |
| 136 | + steps: [ |
| 137 | + short_step('Cargo Test', 'cargo test --target=%{}'), |
| 138 | + short_step('Cargo Clippy', 'cargo clippy'), |
| 139 | + ], |
| 140 | + }, |
| 141 | + { |
| 142 | + name: 'Compile Binaries', |
| 143 | + image: build_image, |
| 144 | + steps: [compile_binary(binary) for binary in binaries], |
| 145 | + }, |
| 146 | + { |
| 147 | + name: 'Distribution', |
| 148 | + image: build_image, |
| 149 | + steps: [ |
| 150 | + { |
| 151 | + name: 'Man', |
| 152 | + input: 'cargo run --package xtask -- gen_man', |
| 153 | + outputs: std.flattenArrays([ |
| 154 | + [man_page(name, "1") for name in binaries], |
| 155 | + [man_page("ayllu", "7")] // Misc ayllu documentation |
| 156 | + ]), |
| 157 | + }, |
| 158 | + { |
| 159 | + name: 'Completion', |
| 160 | + input: 'cargo run --package xtask -- complete', |
| 161 | + outputs: std.flattenArrays([ |
| 162 | + [zsh_complete(name) for name in binaries], |
| 163 | + [bash_complete(name) for name in binaries], |
| 164 | + ]), |
| 165 | + }, |
| 166 | + ], |
| 167 | + }, |
| 168 | + ], |
| 169 | + } |
| 170 | diff --git a/Containerfile.build b/Containerfile.build |
| 171 | index d6301cf..6f1aa29 100644 |
| 172 | --- a/Containerfile.build |
| 173 | +++ b/Containerfile.build |
| 174 | @@ -1,6 +1,9 @@ |
| 175 | FROM docker.io/alpine:3.23 |
| 176 | |
| 177 | - RUN apk add cargo rust rustfmt rust-clippy pkgconf build-base git sqlite sqlite-dev |
| 178 | + RUN apk add \ |
| 179 | + cargo rust rustfmt rust-clippy \ |
| 180 | + pkgconf build-base git sqlite sqlite-dev \ |
| 181 | + scdoc |
| 182 | RUN adduser -D -h /src -s /bin/sh ayllu |
| 183 | USER ayllu |
| 184 | WORKDIR /src |
| 185 | diff --git a/xtask/src/main.rs b/xtask/src/main.rs |
| 186 | index c0d3830..f0097c6 100644 |
| 187 | --- a/xtask/src/main.rs |
| 188 | +++ b/xtask/src/main.rs |
| 189 | @@ -90,20 +90,7 @@ where |
| 190 | |
| 191 | fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 192 | match env::args().nth(1).as_deref() { |
| 193 | - Some("dist") => { |
| 194 | - let man_dir = target_dir(DIST_MAN_PATH); |
| 195 | - // Binary man pages |
| 196 | - man_gen::<ayllu_cmd::ayllu::Command>(&man_dir)?; |
| 197 | - man_gen::<ayllu_cmd::shell::Command>(&man_dir)?; |
| 198 | - man_gen::<ayllu_cmd::keys::Command>(&man_dir)?; |
| 199 | - man_gen::<ayllu_cmd::migrate::Command>(&man_dir)?; |
| 200 | - man_gen::<ayllu_cmd::build::Command>(&man_dir)?; |
| 201 | - man_gen::<ayllu_cmd::init::Command>(&man_dir)?; |
| 202 | - man_gen::<ayllu_cmd::quipu::Command>(&man_dir)?; |
| 203 | - |
| 204 | - // Misc man pages |
| 205 | - scdoc_gen(AYLLU_SUMMARY, &target_dir(DIST_MAN_PATH).join("ayllu.7"))?; |
| 206 | - |
| 207 | + Some("complete") => { |
| 208 | // Completion scripts |
| 209 | std::fs::create_dir_all(target_dir(DIST_COMPLETE_PATH))?; |
| 210 | complete_gen::<ayllu_cmd::quipu::Command>(&target_dir(DIST_COMPLETE_PATH), "quipu")?; |
| 211 | @@ -127,9 +114,23 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 212 | &target_dir(DIST_COMPLETE_PATH), |
| 213 | "ayllu-init", |
| 214 | )?; |
| 215 | + } |
| 216 | + Some("gen_man") => { |
| 217 | + let man_dir = target_dir(DIST_MAN_PATH); |
| 218 | + std::fs::create_dir_all(&man_dir)?; |
| 219 | + // Binary man pages |
| 220 | + man_gen::<ayllu_cmd::ayllu::Command>(&man_dir)?; |
| 221 | + man_gen::<ayllu_cmd::shell::Command>(&man_dir)?; |
| 222 | + man_gen::<ayllu_cmd::keys::Command>(&man_dir)?; |
| 223 | + man_gen::<ayllu_cmd::migrate::Command>(&man_dir)?; |
| 224 | + man_gen::<ayllu_cmd::build::Command>(&man_dir)?; |
| 225 | + man_gen::<ayllu_cmd::init::Command>(&man_dir)?; |
| 226 | + man_gen::<ayllu_cmd::quipu::Command>(&man_dir)?; |
| 227 | |
| 228 | - Ok(()) |
| 229 | + // Misc man pages |
| 230 | + scdoc_gen(AYLLU_SUMMARY, &man_dir.join("ayllu.7"))?; |
| 231 | } |
| 232 | _ => unimplemented!(), |
| 233 | - } |
| 234 | + }; |
| 235 | + Ok(()) |
| 236 | } |