Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
@@ -6,10 +6,6 @@ when:
|
||||
steps:
|
||||
lint:
|
||||
name: Lint protobufs
|
||||
image: golang:1.26.2-alpine3.22
|
||||
image: bufbuild/buf
|
||||
commands:
|
||||
- apk update
|
||||
- apk add bash curl
|
||||
- curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.alpine.sh' | bash
|
||||
- apk add task
|
||||
- task lint
|
||||
- buf lint
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [accounts_v1.proto](#accounts_v1-proto)
|
||||
- [accounts/accounts_v1.proto](#accounts_accounts_v1-proto)
|
||||
- [AccountData](#accounts-AccountData)
|
||||
- [AccountFull](#accounts-AccountFull)
|
||||
- [AccountFullWithToken](#accounts-AccountFullWithToken)
|
||||
@@ -19,10 +19,10 @@
|
||||
|
||||
|
||||
|
||||
<a name="accounts_v1-proto"></a>
|
||||
<a name="accounts_accounts_v1-proto"></a>
|
||||
<p align="right"><a href="#top">Top</a></p>
|
||||
|
||||
## accounts_v1.proto
|
||||
## accounts/accounts_v1.proto
|
||||
This file has messages for describing environments
|
||||
|
||||
|
||||
|
||||
73
Taskfile.yml
73
Taskfile.yml
@@ -2,75 +2,12 @@
|
||||
|
||||
version: "3"
|
||||
|
||||
vars:
|
||||
LOCALBIN:
|
||||
sh: echo "$(pwd)/bin"
|
||||
CONTAINER_TOOL: '{{.CONTAINER_TOOL | default "podman"}}'
|
||||
# Tools
|
||||
PROTODOC: "{{.LOCALBIN}}/protodoc"
|
||||
PROTOLINT: "{{.LOCALBIN}}/protolint"
|
||||
tasks:
|
||||
lint:
|
||||
desc: Run linter in a container
|
||||
deps:
|
||||
- protolint
|
||||
cmd: '"{{.PROTOLINT}}" lint $(find . -type f -iname "*.proto")'
|
||||
|
||||
gen-docs:
|
||||
desc: Generate docs in a container
|
||||
deps:
|
||||
- protodoc
|
||||
cmd: '"{{.PROTODOC}}" --doc_opt=markdown,README.md'
|
||||
|
||||
# Install required tools
|
||||
localbin:
|
||||
desc: Create local bin directory
|
||||
desc: Run linter
|
||||
silent: true
|
||||
cmds:
|
||||
- mkdir -p "{{.LOCALBIN}}"
|
||||
|
||||
protodoc:
|
||||
desc: Install protodoc
|
||||
cmd: buf lint
|
||||
generate:
|
||||
desc: Generate code
|
||||
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"
|
||||
cmd: buf generate
|
||||
|
||||
22
buf.gen.yaml
Normal file
22
buf.gen.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
version: v2
|
||||
plugins:
|
||||
- remote: buf.build/bufbuild/es
|
||||
out: gen/ts
|
||||
opt:
|
||||
- target=ts
|
||||
|
||||
- remote: buf.build/protocolbuffers/go
|
||||
out: gen/go
|
||||
opt:
|
||||
- paths=source_relative
|
||||
|
||||
- remote: buf.build/grpc/go
|
||||
out: gen/go
|
||||
opt:
|
||||
- paths=source_relative
|
||||
- require_unimplemented_servers=false
|
||||
|
||||
- remote: buf.build/community/pseudomuto-doc:v1.5.1
|
||||
out: gen
|
||||
opt:
|
||||
- markdown,README.md
|
||||
Reference in New Issue
Block a user