A couple up updates

Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
2026-04-19 22:11:18 +02:00
parent 19468be271
commit 066985346d
11 changed files with 134 additions and 933 deletions

81
Taskfile.yml Normal file
View File

@@ -0,0 +1,81 @@
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
LOCALBIN:
sh: echo "$(pwd)/bin"
CONTAINER_TOOL: '{{.CONTAINER_TOOL | default "podman"}}'
# Tools
PROTODOC: "{{.LOCALBIN}}/protodoc"
PROTOLINT: "{{.LOCALBIN}}/protolint"
tasks:
container-lint:
desc: Run linter in a container
cmd: |-
"{{.CONTAINER_TOOL}}" run --rm \
-v $PWD:/workspace:z \
--workdir /workspace \
docker.io/yoheimuta/protolint:latest lint \
$(find . -type f -iname "*.proto")
container-docs:
desc: Generate docs in a container
cmd: |-
"{{.CONTAINER_TOOL}}" run --rm \
-v $PWD/proto:/protos \
-v $PWD:/out:z \
docker.io/pseudomuto/protoc-gen-doc:latest --doc_opt=markdown,README.md
# Install required tools
localbin:
desc: Create local bin directory
silent: true
cmds:
- mkdir -p "{{.LOCALBIN}}"
protodoc:
desc: Install protodoc
silent: true
deps:
- localbin
cmds:
- task: go-install-tool
vars:
TARGET: "{{.PROTODOC}}"
PACKAGE: go.etcd.io/protodoc
VERSION: "latest"
protolint:
desc: Install protolint
silent: true
deps:
- localbin
cmds:
- task: go-install-tool
vars:
TARGET: "{{.PROTOLINT}}"
PACKAGE: github.com/yoheimuta/protolint/cmd/protolint
VERSION: "latest"
go-install-tool:
internal: true
silent: true
cmd: |-
set -e
TARGET="{{.TARGET}}"
PACKAGE="{{.PACKAGE}}@{{.VERSION}}"
VERSIONED="${TARGET}-{{.VERSION}}"
if [ -f "$VERSIONED" ] && [ "$(readlink -- "$TARGET" 2>/dev/null)" = "$VERSIONED" ]; then
echo "$PACKAGE already installed"
exit 0
fi
echo "Downloading $PACKAGE"
rm -f "$TARGET"
GOBIN="{{.LOCALBIN}}" go install "$PACKAGE"
mv "{{.LOCALBIN}}/$(basename "$TARGET")" "$VERSIONED"
ln -sf "$(realpath "$VERSIONED")" "$TARGET"