diff --git a/.gitignore b/.gitignore index e32dedb..de23040 100644 --- a/.gitignore +++ b/.gitignore @@ -8,11 +8,11 @@ !buf.lock !buf.yaml -!.woodpecker/* !legal/* !scripts/**/* !swagger/* +!.woodpecker.yml !LICENSE !Makefile !README.md diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..5092831 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,34 @@ +steps: + license: + image: golang:1.20 + group: init + environment: + GO111MODULE: on + GOBIN: /usr/local/bin + commands: + - go install github.com/google/addlicense@latest + - addlicense -check -f ./legal/header.txt -skip yaml -skip yml -skip xml . + + lint: + image: bufbuild/buf:1.28.1 + group: init + commands: + - buf lint + + generate: + image: bufbuild/buf:1.28.1 + commands: + - buf generate . + + swagger: + image: golang:1.20 + environment: + GO111MODULE: on + GOBIN: /usr/local/bin + commands: + - cd scripts && go install ./merge-swagger && cd .. + - | + merge-swagger \ + -output swagger.json \ + "./*/*/*.swagger.json" \ + "./swagger/metadata.json" diff --git a/.woodpecker/.generate.yaml b/.woodpecker/.generate.yaml deleted file mode 100644 index c5113c4..0000000 --- a/.woodpecker/.generate.yaml +++ /dev/null @@ -1,12 +0,0 @@ -steps: - generate: - image: golang:1.20 - environment: - GO111MODULE: on - GOBIN: /usr/local/bin - commands: - - go install github.com/bufbuild/buf/cmd/buf@latest - - make generate - - git status -s - -depends_on: [ lint ] diff --git a/.woodpecker/.lint.yaml b/.woodpecker/.lint.yaml deleted file mode 100644 index c7dd402..0000000 --- a/.woodpecker/.lint.yaml +++ /dev/null @@ -1,10 +0,0 @@ -steps: - lint: - image: golang:1.20 - environment: - GO111MODULE: on - GOBIN: /usr/local/bin - commands: - - go install github.com/google/addlicense@latest - - go install github.com/bufbuild/buf/cmd/buf@latest - - make lint diff --git a/Makefile b/Makefile index 7efcf11..fd7a4ad 100644 --- a/Makefile +++ b/Makefile @@ -29,5 +29,5 @@ generate: buf generate . cd scripts && go run ./merge-swagger \ -output ../swagger.json \ - ../**/*.swagger.json \ + ../*/*/*.swagger.json \ ../swagger/metadata.json diff --git a/scripts/merge-swagger/main.go b/scripts/merge-swagger/main.go index 83c16bb..3260e6a 100644 --- a/scripts/merge-swagger/main.go +++ b/scripts/merge-swagger/main.go @@ -16,6 +16,7 @@ import ( func newCLI(name, usage string) *CLI { cli := &CLI{} cli.FlagSet = flag.NewFlagSet(name, flag.ExitOnError) + cli.FlagSet.SetOutput(os.Stderr) cli.FlagSet.Usage = func() { cli.Printf("Usage:\n")