File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Codegen
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches : ["main"]
7+ workflow_dispatch :
8+
9+ permissions :
10+ contents : read
11+
12+ concurrency :
13+ group : ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
14+ cancel-in-progress : true
15+
16+ jobs :
17+ codegen :
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v4
21+ - uses : actions/setup-go@v5
22+ with :
23+ go-version-file : go.mod
24+ # Compile the generators under the `codegen` build tag. The reusable
25+ # go-check/go-test workflows build without this tag, so a generator that
26+ # no longer compiles would otherwise slip through CI.
27+ - run : make codegen-build
28+ # Run `go generate` and fail if the committed generated files are stale.
29+ - run : make gen-check
Original file line number Diff line number Diff line change 1- .PHONY : gen build test
1+ .PHONY : gen build test codegen-build gen-check ci
22
33gen :
44 go generate ./...
88
99test :
1010 go test ./...
11+
12+ # Compile the code generators under the `codegen` build tag they actually run
13+ # with. A normal `go build ./...` never sets this tag, so a generator that no
14+ # longer compiles (e.g. it references a renamed or removed type) would otherwise
15+ # go unnoticed until someone runs `go generate`.
16+ codegen-build :
17+ go build -tags codegen $(shell go list ./... | grep '/gen$$')
18+
19+ # Regenerate everything and fail if the committed output changed, catching both
20+ # generators that no longer compile and generated files that are out of date.
21+ gen-check : gen
22+ @git diff --exit-code -- ' *_gen.go' ' *_gen.*.go' || \
23+ { echo " generated files are out of date; run 'make gen' and commit the result" >&2 ; exit 1; }
24+
25+ # Aggregate target suitable for CI.
26+ ci : build codegen-build gen-check test
Original file line number Diff line number Diff line change 1616)
1717
1818var (
19- DataSetCreate = commands.MustParse [* DataSetCreateArguments , * DataSetCreateOK ]("/pdp/sign/dataset/create" )
20- DataSetDelete = commands.MustParse [* DataSetDeleteArguments , * DataSetDeleteOK ]("/pdp/sign/dataset/delete" )
21- PiecesAdd = commands.MustParse [* PiecesAddArguments , * PiecesAddOK ]("/pdp/sign/pieces/add" )
22- PiecesRemoveSchedule = commands.MustParse [* PiecesRemoveScheduleArguments , * PiecesRemoveScheduleOK ]("/pdp/sign/pieces/remove/schedule" )
19+ DataSetCreate = commands.MustParse [* DataSetCreateArguments ]("/pdp/sign/dataset/create" )
20+ DataSetDelete = commands.MustParse [* DataSetDeleteArguments ]("/pdp/sign/dataset/delete" )
21+ PiecesAdd = commands.MustParse [* PiecesAddArguments ]("/pdp/sign/pieces/add" )
22+ PiecesRemoveSchedule = commands.MustParse [* PiecesRemoveScheduleArguments ]("/pdp/sign/pieces/remove/schedule" )
2323)
You can’t perform that action at this time.
0 commit comments