From 689e96d4c1a1d1e8a2d58a220d3265bb5aa48b7c Mon Sep 17 00:00:00 2001 From: mya Date: Sat, 30 Dec 2023 20:33:35 -0600 Subject: [PATCH] ci: simplify workflow --- .gitignore | 2 +- .woodpecker.yml | 34 ++++++++++++++++++++++++++++++++++ .woodpecker/.generate.yaml | 12 ------------ .woodpecker/.lint.yaml | 10 ---------- Makefile | 2 +- scripts/merge-swagger/main.go | 1 + 6 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 .woodpecker.yml delete mode 100644 .woodpecker/.generate.yaml delete mode 100644 .woodpecker/.lint.yaml 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")