chore: bootstrap ermite-api module with license, readme, buf and CI
- commit
- ccb011d32ea3738b3d017485651547e10542918f
- author
- brice · · 2026-10-10 00:40 UTC
- parent
- none (root commit)
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
10 files · +168 -0
A .forgejo/workflows/ci.yml +55 -0
| @@ -0,0 +1,55 @@ | |||
| 1 | + | name: CI | |
| 2 | + | ||
| 3 | + | on: | |
| 4 | + | push: | |
| 5 | + | branches: [main] | |
| 6 | + | pull_request: | |
| 7 | + | ||
| 8 | + | env: | |
| 9 | + | # Test the module alone, with the versions in go.mod (never a go.work). | |
| 10 | + | GOWORK: "off" | |
| 11 | + | GOPRIVATE: bnema.dev/ermite* | |
| 12 | + | ||
| 13 | + | jobs: | |
| 14 | + | proto: | |
| 15 | + | name: Proto | |
| 16 | + | runs-on: ubuntu-latest | |
| 17 | + | steps: | |
| 18 | + | - uses: actions/checkout@v6 | |
| 19 | + | with: | |
| 20 | + | fetch-depth: 0 | |
| 21 | + | - uses: actions/setup-go@v5 | |
| 22 | + | with: | |
| 23 | + | go-version-file: go.mod | |
| 24 | + | cache: true | |
| 25 | + | - uses: bufbuild/buf-action@v1 | |
| 26 | + | with: | |
| 27 | + | setup_only: true | |
| 28 | + | # Skipped until the first .proto file exists: buf fails on an empty module. | |
| 29 | + | - name: Lint, breaking, generated code up to date | |
| 30 | + | run: | | |
| 31 | + | if ! find proto -name '*.proto' -print -quit 2>/dev/null | grep -q .; then | |
| 32 | + | echo "no .proto files yet"; exit 0 | |
| 33 | + | fi | |
| 34 | + | buf lint | |
| 35 | + | if git cat-file -e origin/main:buf.yaml 2>/dev/null && git ls-tree -r --name-only origin/main proto | grep -q '\.proto$'; then | |
| 36 | + | buf breaking --against '.git#ref=origin/main' | |
| 37 | + | fi | |
| 38 | + | buf generate | |
| 39 | + | git diff --exit-code -- gen | |
| 40 | + | ||
| 41 | + | go: | |
| 42 | + | name: Go | |
| 43 | + | runs-on: ubuntu-latest | |
| 44 | + | steps: | |
| 45 | + | - uses: actions/checkout@v6 | |
| 46 | + | - uses: actions/setup-go@v5 | |
| 47 | + | with: | |
| 48 | + | go-version-file: go.mod | |
| 49 | + | cache: true | |
| 50 | + | - name: Verify tidy | |
| 51 | + | run: | | |
| 52 | + | go mod tidy | |
| 53 | + | git diff --exit-code -- go.mod go.sum | |
| 54 | + | - run: go vet ./... | |
| 55 | + | - run: go build ./... | |
| @@ -0,0 +1,55 @@ | |||||
| 1 | + | name: CI | |||
| 2 | + | ||||
| 3 | + | on: | |||
| 4 | + | push: | |||
| 5 | + | branches: [main] | |||
| 6 | + | pull_request: | |||
| 7 | + | ||||
| 8 | + | env: | |||
| 9 | + | # Test the module alone, with the versions in go.mod (never a go.work). | |||
| 10 | + | GOWORK: "off" | |||
| 11 | + | GOPRIVATE: bnema.dev/ermite* | |||
| 12 | + | ||||
| 13 | + | jobs: | |||
| 14 | + | proto: | |||
| 15 | + | name: Proto | |||
| 16 | + | runs-on: ubuntu-latest | |||
| 17 | + | steps: | |||
| 18 | + | - uses: actions/checkout@v6 | |||
| 19 | + | with: | |||
| 20 | + | fetch-depth: 0 | |||
| 21 | + | - uses: actions/setup-go@v5 | |||
| 22 | + | with: | |||
| 23 | + | go-version-file: go.mod | |||
| 24 | + | cache: true | |||
| 25 | + | - uses: bufbuild/buf-action@v1 | |||
| 26 | + | with: | |||
| 27 | + | setup_only: true | |||
| 28 | + | # Skipped until the first .proto file exists: buf fails on an empty module. | |||
| 29 | + | - name: Lint, breaking, generated code up to date | |||
| 30 | + | run: | | |||
| 31 | + | if ! find proto -name '*.proto' -print -quit 2>/dev/null | grep -q .; then | |||
| 32 | + | echo "no .proto files yet"; exit 0 | |||
| 33 | + | fi | |||
| 34 | + | buf lint | |||
| 35 | + | if git cat-file -e origin/main:buf.yaml 2>/dev/null && git ls-tree -r --name-only origin/main proto | grep -q '\.proto$'; then | |||
| 36 | + | buf breaking --against '.git#ref=origin/main' | |||
| 37 | + | fi | |||
| 38 | + | buf generate | |||
| 39 | + | git diff --exit-code -- gen | |||
| 40 | + | ||||
| 41 | + | go: | |||
| 42 | + | name: Go | |||
| 43 | + | runs-on: ubuntu-latest | |||
| 44 | + | steps: | |||
| 45 | + | - uses: actions/checkout@v6 | |||
| 46 | + | - uses: actions/setup-go@v5 | |||
| 47 | + | with: | |||
| 48 | + | go-version-file: go.mod | |||
| 49 | + | cache: true | |||
| 50 | + | - name: Verify tidy | |||
| 51 | + | run: | | |||
| 52 | + | go mod tidy | |||
| 53 | + | git diff --exit-code -- go.mod go.sum | |||
| 54 | + | - run: go vet ./... | |||
| 55 | + | - run: go build ./... | |||
A .gitignore +1 -0
| @@ -0,0 +1,1 @@ | |||
| 1 | + | /tmp/ | |
| @@ -0,0 +1,1 @@ | |||||
| 1 | + | /tmp/ | |||
A .golangci.yml +13 -0
| @@ -0,0 +1,13 @@ | |||
| 1 | + | version: "2" | |
| 2 | + | ||
| 3 | + | linters: | |
| 4 | + | enable: | |
| 5 | + | - errcheck | |
| 6 | + | - govet | |
| 7 | + | - ineffassign | |
| 8 | + | - misspell | |
| 9 | + | - staticcheck | |
| 10 | + | - unconvert | |
| 11 | + | - unused | |
| 12 | + | exclusions: | |
| 13 | + | generated: strict | |
| @@ -0,0 +1,13 @@ | |||||
| 1 | + | version: "2" | |||
| 2 | + | ||||
| 3 | + | linters: | |||
| 4 | + | enable: | |||
| 5 | + | - errcheck | |||
| 6 | + | - govet | |||
| 7 | + | - ineffassign | |||
| 8 | + | - misspell | |||
| 9 | + | - staticcheck | |||
| 10 | + | - unconvert | |||
| 11 | + | - unused | |||
| 12 | + | exclusions: | |||
| 13 | + | generated: strict | |||
A LICENSE +21 -0
| @@ -0,0 +1,21 @@ | |||
| 1 | + | MIT License | |
| 2 | + | ||
| 3 | + | Copyright (c) 2026 bnema | |
| 4 | + | ||
| 5 | + | Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | + | of this software and associated documentation files (the "Software"), to deal | |
| 7 | + | in the Software without restriction, including without limitation the rights | |
| 8 | + | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 9 | + | copies of the Software, and to permit persons to whom the Software is | |
| 10 | + | furnished to do so, subject to the following conditions: | |
| 11 | + | ||
| 12 | + | The above copyright notice and this permission notice shall be included in all | |
| 13 | + | copies or substantial portions of the Software. | |
| 14 | + | ||
| 15 | + | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | + | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | + | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 18 | + | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | + | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | + | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| 21 | + | SOFTWARE. | |
| @@ -0,0 +1,21 @@ | |||||
| 1 | + | MIT License | |||
| 2 | + | ||||
| 3 | + | Copyright (c) 2026 bnema | |||
| 4 | + | ||||
| 5 | + | Permission is hereby granted, free of charge, to any person obtaining a copy | |||
| 6 | + | of this software and associated documentation files (the "Software"), to deal | |||
| 7 | + | in the Software without restriction, including without limitation the rights | |||
| 8 | + | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
| 9 | + | copies of the Software, and to permit persons to whom the Software is | |||
| 10 | + | furnished to do so, subject to the following conditions: | |||
| 11 | + | ||||
| 12 | + | The above copyright notice and this permission notice shall be included in all | |||
| 13 | + | copies or substantial portions of the Software. | |||
| 14 | + | ||||
| 15 | + | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
| 16 | + | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
| 17 | + | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
| 18 | + | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
| 19 | + | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
| 20 | + | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||
| 21 | + | SOFTWARE. | |||
A README.md +26 -0
| @@ -0,0 +1,26 @@ | |||
| 1 | + | # ermite-api | |
| 2 | + | ||
| 3 | + | The public API contract of [ermite](https://git.bnema.dev/bnema/ermite), a single-user Git forge: protobuf definitions for its ConnectRPC services and the Go code generated from them. | |
| 4 | + | ||
| 5 | + | Status: early development, no services defined yet. | |
| 6 | + | ||
| 7 | + | ```go | |
| 8 | + | import "bnema.dev/ermite-api/gen/ermite" | |
| 9 | + | ``` | |
| 10 | + | ||
| 11 | + | The contract has no version number. It only changes in backward-compatible ways (new fields, messages, RPCs and services), and CI rejects any breaking change. | |
| 12 | + | ||
| 13 | + | ## Layout | |
| 14 | + | ||
| 15 | + | - `proto/ermite/`: `.proto` files of the `ermite` package, checked by `buf lint` and `buf breaking`. | |
| 16 | + | - `gen/`: generated Go code, committed. Never edit it by hand. | |
| 17 | + | ||
| 18 | + | ## Generate | |
| 19 | + | ||
| 20 | + | ```sh | |
| 21 | + | buf generate | |
| 22 | + | ``` | |
| 23 | + | ||
| 24 | + | ## License | |
| 25 | + | ||
| 26 | + | MIT. See [LICENSE](LICENSE). | |
| @@ -0,0 +1,26 @@ | |||||
| 1 | + | # ermite-api | |||
| 2 | + | ||||
| 3 | + | The public API contract of [ermite](https://git.bnema.dev/bnema/ermite), a single-user Git forge: protobuf definitions for its ConnectRPC services and the Go code generated from them. | |||
| 4 | + | ||||
| 5 | + | Status: early development, no services defined yet. | |||
| 6 | + | ||||
| 7 | + | ```go | |||
| 8 | + | import "bnema.dev/ermite-api/gen/ermite" | |||
| 9 | + | ``` | |||
| 10 | + | ||||
| 11 | + | The contract has no version number. It only changes in backward-compatible ways (new fields, messages, RPCs and services), and CI rejects any breaking change. | |||
| 12 | + | ||||
| 13 | + | ## Layout | |||
| 14 | + | ||||
| 15 | + | - `proto/ermite/`: `.proto` files of the `ermite` package, checked by `buf lint` and `buf breaking`. | |||
| 16 | + | - `gen/`: generated Go code, committed. Never edit it by hand. | |||
| 17 | + | ||||
| 18 | + | ## Generate | |||
| 19 | + | ||||
| 20 | + | ```sh | |||
| 21 | + | buf generate | |||
| 22 | + | ``` | |||
| 23 | + | ||||
| 24 | + | ## License | |||
| 25 | + | ||||
| 26 | + | MIT. See [LICENSE](LICENSE). | |||
A buf.gen.yaml +13 -0
| @@ -0,0 +1,13 @@ | |||
| 1 | + | version: v2 | |
| 2 | + | managed: | |
| 3 | + | enabled: true | |
| 4 | + | override: | |
| 5 | + | - file_option: go_package_prefix | |
| 6 | + | value: bnema.dev/ermite-api/gen | |
| 7 | + | plugins: | |
| 8 | + | - local: [go, tool, protoc-gen-go] | |
| 9 | + | out: gen | |
| 10 | + | opt: paths=source_relative | |
| 11 | + | - local: [go, tool, protoc-gen-connect-go] | |
| 12 | + | out: gen | |
| 13 | + | opt: paths=source_relative | |
| @@ -0,0 +1,13 @@ | |||||
| 1 | + | version: v2 | |||
| 2 | + | managed: | |||
| 3 | + | enabled: true | |||
| 4 | + | override: | |||
| 5 | + | - file_option: go_package_prefix | |||
| 6 | + | value: bnema.dev/ermite-api/gen | |||
| 7 | + | plugins: | |||
| 8 | + | - local: [go, tool, protoc-gen-go] | |||
| 9 | + | out: gen | |||
| 10 | + | opt: paths=source_relative | |||
| 11 | + | - local: [go, tool, protoc-gen-connect-go] | |||
| 12 | + | out: gen | |||
| 13 | + | opt: paths=source_relative | |||
A buf.yaml +13 -0
| @@ -0,0 +1,13 @@ | |||
| 1 | + | version: v2 | |
| 2 | + | modules: | |
| 3 | + | - path: proto | |
| 4 | + | lint: | |
| 5 | + | use: | |
| 6 | + | - STANDARD | |
| 7 | + | # One unversioned package: the contract evolves only by compatible additions, | |
| 8 | + | # enforced by buf breaking. There is no v1/v2. | |
| 9 | + | except: | |
| 10 | + | - PACKAGE_VERSION_SUFFIX | |
| 11 | + | breaking: | |
| 12 | + | use: | |
| 13 | + | - FILE | |
| @@ -0,0 +1,13 @@ | |||||
| 1 | + | version: v2 | |||
| 2 | + | modules: | |||
| 3 | + | - path: proto | |||
| 4 | + | lint: | |||
| 5 | + | use: | |||
| 6 | + | - STANDARD | |||
| 7 | + | # One unversioned package: the contract evolves only by compatible additions, | |||
| 8 | + | # enforced by buf breaking. There is no v1/v2. | |||
| 9 | + | except: | |||
| 10 | + | - PACKAGE_VERSION_SUFFIX | |||
| 11 | + | breaking: | |||
| 12 | + | use: | |||
| 13 | + | - FILE | |||
A doc.go +7 -0
| @@ -0,0 +1,7 @@ | |||
| 1 | + | // SPDX-License-Identifier: MIT | |
| 2 | + | ||
| 3 | + | // Package api is the public contract of the ermite forge: the protobuf | |
| 4 | + | // definitions in proto/ and the Go code generated from them in gen/. | |
| 5 | + | // The ermite server, its web UI, its CLI, the ermite runner and third-party | |
| 6 | + | // clients all depend on this module; it depends on none of them. | |
| 7 | + | package api | |
| @@ -0,0 +1,7 @@ | |||||
| 1 | + | // SPDX-License-Identifier: MIT | |||
| 2 | + | ||||
| 3 | + | // Package api is the public contract of the ermite forge: the protobuf | |||
| 4 | + | // definitions in proto/ and the Go code generated from them in gen/. | |||
| 5 | + | // The ermite server, its web UI, its CLI, the ermite runner and third-party | |||
| 6 | + | // clients all depend on this module; it depends on none of them. | |||
| 7 | + | package api | |||
A go.mod +13 -0
| @@ -0,0 +1,13 @@ | |||
| 1 | + | module bnema.dev/ermite-api | |
| 2 | + | ||
| 3 | + | go 1.27.1 | |
| 4 | + | ||
| 5 | + | tool ( | |
| 6 | + | connectrpc.com/connect/cmd/protoc-gen-connect-go | |
| 7 | + | google.golang.org/protobuf/cmd/protoc-gen-go | |
| 8 | + | ) | |
| 9 | + | ||
| 10 | + | require ( | |
| 11 | + | connectrpc.com/connect v1.21.0 // indirect | |
| 12 | + | google.golang.org/protobuf v1.36.12 // indirect | |
| 13 | + | ) | |
| @@ -0,0 +1,13 @@ | |||||
| 1 | + | module bnema.dev/ermite-api | |||
| 2 | + | ||||
| 3 | + | go 1.27.1 | |||
| 4 | + | ||||
| 5 | + | tool ( | |||
| 6 | + | connectrpc.com/connect/cmd/protoc-gen-connect-go | |||
| 7 | + | google.golang.org/protobuf/cmd/protoc-gen-go | |||
| 8 | + | ) | |||
| 9 | + | ||||
| 10 | + | require ( | |||
| 11 | + | connectrpc.com/connect v1.21.0 // indirect | |||
| 12 | + | google.golang.org/protobuf v1.36.12 // indirect | |||
| 13 | + | ) | |||