showcase
- v0.2.4
- 37 commits
- 1 branch
- 6 tags
- updated
- CI 2/2
justfile
2.7 KB · 73 lines
1set shell := ["bash", "-euo", "pipefail", "-c"]23default:4 @just --list56# Run all tests7test:8 go test ./cmd/... ./internal/... ./web/...910# Rewrite golden files after an intended output change11golden:12 go test ./internal/build -run Golden -update1314# gofmt check + go vet15lint:16 test -z "$(gofmt -l cmd internal web)" || { gofmt -l cmd internal web; exit 1; }17 go vet ./cmd/... ./internal/... ./web/...1819# Lint the Dockerfile20lint-docker:21 hadolint Dockerfile2223# Print the current digests of the pinned base images, to compare with the Dockerfile24digests:25 @echo "golang:1.27.4-alpine3.24 $(crane digest golang:1.27.4-alpine3.24)"26 @echo "alpine:3.24.4 $(crane digest alpine:3.24.4)"2728image_name := "code.aardvark-halibut.ts.net/daniel/showcase"2930# Build the image for this machine (needs Docker, e.g. on the host)31image tag="dev":32 docker build -t {{image_name}}:{{tag}} .3334# Push a tagged release by hand, as CI does (linux/amd64, for the server): needs Docker, `docker login code.aardvark-halibut.ts.net`, a clean tree and HEAD tagged v<version>35release version:36 git diff --quiet HEAD || { echo "commit first"; exit 1; }37 test "$(git describe --exact-match --tags HEAD 2>/dev/null)" = "v{{version}}" || { echo "tag HEAD as v{{version}} first"; exit 1; }38 docker buildx build --platform linux/amd64 -t {{image_name}}:{{version}} -t {{image_name}}:latest --push .3940# Regenerate the icons from extracted npm packages: material-icon-theme@5.40.0 and @primer/octicons@19.15.041icons material octicons:42 python3 -I scripts/icons.py {{material}} {{octicons}}43 gofmt -w internal/render/icons_gen.go4445# Build the binary into ./bin46build:47 CGO_ENABLED=0 go build -trimpath -o bin/showcase ./cmd/showcase4849# Render the site once into ./out (needs a config.json and access to Gitea)50render config="config.json":51 rm -rf out52 go run ./cmd/showcase -config {{config}} -data .data -once -out out5354# Serve the finished build in ./out on localhost:8000 with the real server55serve config="testdata/demo.json":56 go run ./cmd/showcase -config {{config}} -serve-dir out -listen 127.0.0.1:80005758# Build from real Gitea every 10 minutes and serve on localhost:8000 (needs ./config.json)59run config="config.json":60 go run ./cmd/showcase -config {{config}} -data .data -listen 127.0.0.1:80006162# Render from real Gitea (needs ./config.json) and serve it63preview config="config.json": (render config)64 just serve {{config}}6566# Render the test fixtures (no Gitea needed) and serve them67demo:68 go test ./internal/build -run Golden -count=1 -keep "$PWD/out"69 just serve7071# Count Go lines (budget: ~1,800, excluding tests, templates and CSS)72loc:73 find cmd internal web -name '*.go' ! -name '*_test.go' ! -name '*_gen.go' -print0 | xargs -0 cat | wc -l