Skip to content

Commit aec25eb

Browse files
committed
Upgrade to 1.24
Remove rotten protoc-gen-doc Upgrade tools version to correspond to those in general codebase. Use new avid-tools Add .gitattributes Add dependabot.yml Install protoc-gen-doc binary in ci workflow Use new go get -tool command to set tools and remove tools.go Use go tool install to install all tools. Move all helper go code into separate directory and copy over when appropriate otherwise installing tools fails with unknown import. AB#10624 Signed-off-by: Paul Hewlett <[email protected]>
1 parent 8ad882c commit aec25eb

38 files changed

+147
-741
lines changed

.env.tools

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export TOOLS_BUILDNUMBER=20241108.3
1+
export TOOLS_BUILDNUMBER=20250328.1

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**/go.sum -diff -merge
2+
**/go.sum linguist-generated=true

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# refer: https://github.com/dependabot/dependabot-core/blob/main/.github/dependabot.yml
2+
version: 2
3+
updates:
4+
# Maintain dependencies for GitHub Actions
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
# Check for updates managed by Composer once a week
9+
interval: "weekly"
10+
day: "wednesday"
11+
time: "03:00"
12+
timezone: "Europe/London"
13+
14+
# Maintain dependencies for Golang
15+
- package-ecosystem: "gomod"
16+
directory: "/"
17+
schedule:
18+
# Check for updates managed by Composer once a week
19+
interval: "weekly"
20+
day: "wednesday"
21+
time: "03:00"
22+
timezone: "Europe/London"

.github/workflows/ci.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,40 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13+
1314
- name: Setup go-task
1415
uses: arduino/setup-task@v1
1516
with:
1617
version: 3.x
1718
repo-token: ${{ secrets.GITHUB_TOKEN }}
19+
1820
- name: Setup Go
1921
uses: actions/setup-go@v4
2022
with:
21-
go-version: '1.22.x'
23+
go-version: '1.24.x'
2224
token: ${{ secrets.GITHUB_TOKEN }}
2325
cache-dependency-path: |
2426
datatrails-common-api/go.sum
27+
2528
- name: Setup protobuf
2629
uses: arduino/setup-protoc@v2
2730
with:
2831
version: "24.3"
2932
repo-token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Setup protoc-gen-doc
35+
run: |
36+
# download protoc-gen-doc as binary
37+
go install github.com/pseudomuto/protoc-gen-doc/cmd/[email protected]
38+
which protoc-gen-doc
39+
3040
- name: Generate, Test and Export
3141
run: |
3242
task all
3343
3444
- name: Show exports
3545
working-directory: exported/
36-
run: find . -type d
46+
run: find . -type f
3747

3848
- name: Publish release artifacts
3949
if: ${{ github.event_name == 'release' }}

README.md

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@
22

33
Common public api definitions for the DataTrails platform
44

5-
## Finding and including proto files for depdendecnies
5+
## Finding and including proto files for dependencies
66

7-
tools/go.mod is the source of truth for all proto providing dependencies. That file alone specifies both the upstream version we are using *and* is used, via go install, to make the .proto files available locally
7+
go.mod is the source of truth for all proto providing dependencies. That file alone specifies both the upstream version we are using *and* is used, via go get -tool, to make the .proto files available locally
88

9-
This corresponds to the practice recommended by grpc-gateway and elsewhere
9+
This corresponds to the practice recommended by grpc-gateway and elsewhere.
1010

11-
1. *** ALWAYS *** Use tools/go.mod to specify the dependency version.
12-
2. Add the package to the `go install` command in the apis:preflight task
13-
3. If necessary, add a var for the new path in any-api **and** then add a reference to that var in the PROTO_INC var.
14-
15-
Following this practice removes the need for dual maintenance of dependency versions in the builder image. It also produces a build cycle that is significantly faster.
16-
17-
Cross repository builds in docker while using go.work to refer to locally modified sources don't work. And this setup is essential for an efficient workflow.
11+
1. Execute the `go get -tool` command to add the package to the go.mod file.
12+
2. If necessary, add a var for the new path in any-api **and** then add a reference to that var in the PROTO_INC var.
13+
3. Executing 'go install tool' is then sufficient to install required tools.
1814

1915
## bootstrap proto files
2016

@@ -24,29 +20,12 @@ For this reason we curl the proto's and make them available in our aggregate pro
2420

2521
## Workflow for updating common apis
2622

27-
### Ensure the go tool chain is setup on your host
28-
29-
It is inordinately cumbersome to set this all up for docker. It can't be
30-
achieved without imposing significant inneficiencies in the workflow. For any
31-
engineer working on the api's it is reasonable to expect they can install the
32-
correct version of go for their host, and likely already have.
33-
34-
### Use an avid/src/go.work
35-
36-
First point avid at a clone of this repo so that it's imports will resolve
37-
directly against the sources in `./api`
23+
### Ensure tools are setup on your host
3824

39-
### Familiarize with the workflow sub tasks
40-
41-
The general use entry points all use Docker and do not support efficiently and
42-
iteratively developing avid and other dependents against a local clone of this
43-
repo.
25+
This repo use the go-task tool and also the go toolchain.
4426

4527
#### For this repo
4628

47-
You can do everything in the builder image using `task all`. This uses the
48-
blessed builder image and requires no host setup other than docker.
49-
5029
If you are iterating it is a lot more efficient to use the sub tasks, because they all run on your host.
5130

5231
`task` `apis:bootstrap` -> `task:apis:generate` -> `task:apis:test` -> `task:apis:export`
@@ -68,15 +47,11 @@ If you want to iterate on *just* the helper go code and there tests, do one roun
6847

6948
Then just iterate using `task apis:generate` and `task apis:test`
7049

71-
#### For avid
72-
73-
See the README.md in avid/src/api/README.md
74-
7550
##### Build one api against locally cloned go-datatrails-common-api
7651

7752
The protos can be included exactly as they are found from a clone of go-datatrails-common-api. *Without* needing to generate, build or export. Eg,
7853

7954
task apis:assetsv2-api \
8055
DATATRAILS_COMMON_API="../../go-datatrails-common-api"
8156

82-
It is necessary however to run `task apis:bootsrap` after cloning go-datatrails-common
57+
It is necessary however to run `task apis:bootstrap` after cloning go-datatrails-common-api.

datatrails-common-api/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
marshalers/
12
go.work
3+
*.go
4+
*.json
5+
*.storage

datatrails-common-api/assets/v2/assets/.gitignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

datatrails-common-api/attribute/v2/attribute/.gitignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

datatrails-common-api/caps/v1/caps/.gitignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

datatrails-common-api/filter/v1/filter/.gitignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)