mirror of
https://github.com/hanzoai/build-demo.git
synced 2026-09-30 20:48:40 +00:00
build-demo: a recipe whose artifacts are a Go binary and an npm package
Two things hanzo.app could not build before: nothing here is a container image, so nothing here has a Dockerfile. The declaration is the same hanzo.yml both CI lanes already read. Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
# build-demo
|
||||||
|
|
||||||
|
The smallest proof that `hanzo.app` builds software, not just container images.
|
||||||
|
|
||||||
|
`hanzo.yml` declares two artifacts and no Dockerfile:
|
||||||
|
|
||||||
|
- **`hanzo-demo`** — a static Go binary, cross-built for `linux/amd64` and `darwin/arm64`
|
||||||
|
- **`@hanzo/build-demo`** — a real npm package: `tsc` compiles `src/`, `npm pack` tars it
|
||||||
|
|
||||||
|
Both are built by `POST /v1/runner` on the platform's own cluster and published to
|
||||||
|
`https://s3.hanzo.ai/plugins/hanzoai/build-demo/<tag>/`, with a `binaries.json`
|
||||||
|
index carrying the URL and SHA-256 of each file.
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
// Command demo is the smallest thing hanzo.app can build that is not a
|
||||||
|
// container image: a static Go binary, published by name+digest.
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// Version is stamped by the build (-ldflags "-X main.Version=…").
|
||||||
|
var Version = "dev"
|
||||||
|
|
||||||
|
func main() { fmt.Printf("hanzo build demo %s\n", Version) }
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# The build recipe. ONE declaration, read by hanzoai/ci (GitHub lane) and by
|
||||||
|
# platform.hanzo.ai (POST /v1/runner, in-cluster) — neither of which needs a
|
||||||
|
# Dockerfile, because neither of these artifacts is a container image.
|
||||||
|
#
|
||||||
|
# `main:` is the zero-config Go lane. `run:` + `out:` is every other toolchain:
|
||||||
|
# the command that builds, and the glob of what it produced. `image:` names the
|
||||||
|
# toolchain the platform runs that command in (on a GitHub runner the toolchain
|
||||||
|
# is the runner, so the GitHub lane ignores it).
|
||||||
|
binaries:
|
||||||
|
- name: hanzo-demo
|
||||||
|
main: ./cmd/demo
|
||||||
|
platforms: [linux/amd64, darwin/arm64]
|
||||||
|
|
||||||
|
- name: hanzo-demo-sdk
|
||||||
|
image: node:22-bookworm
|
||||||
|
run: npm install --no-audit --no-fund --loglevel=error && npm run build && npm pack --pack-destination .
|
||||||
|
out: "*.tgz"
|
||||||
|
|
||||||
|
# Where the artifacts land: hanzoai/s3, as
|
||||||
|
# https://s3.hanzo.ai/plugins/<owner>/<repo>/<tag>/ with a binaries.json index
|
||||||
|
# beside them (url + sha256 for each), which is the one file a host reads.
|
||||||
|
bucket: plugins
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "@hanzo/build-demo",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "The TypeScript half of the hanzo.app build demo: a real npm package, built and published by POST /v1/runner.",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"types": "dist/index.d.ts",
|
||||||
|
"files": ["dist"],
|
||||||
|
"scripts": { "build": "tsc" },
|
||||||
|
"devDependencies": { "typescript": "^5.6.0" }
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/** greet is the whole package: proof a TS toolchain ran, compiled and packed. */
|
||||||
|
export const greet = (who: string): string => `hanzo build demo greets ${who}`
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "commonjs",
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "dist",
|
||||||
|
"strict": true
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user