From ed08366cac0db0fd2a33df3af6a371740a40d3fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 29 Apr 2021 20:01:23 +0200 Subject: [PATCH] Run cli docsgen in CI --- .circleci/config.yml | 9 ++++++--- Makefile | 6 ++++++ build/version.go | 8 ++++++++ documentation/en/cli-lotus-miner.md | 2 +- documentation/en/cli-lotus-worker.md | 2 +- documentation/en/cli-lotus.md | 2 +- scripts/generate-lotus-cli.py | 1 + 7 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c2f937a9d..c3deab6ad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -436,7 +436,7 @@ jobs: - run: command: "! go fmt ./... 2>&1 | read" - cbor-gen-check: + gen-check: executor: golang steps: - install-deps @@ -444,7 +444,10 @@ jobs: - run: make deps - run: go install golang.org/x/tools/cmd/goimports - run: go install github.com/hannahhoward/cbor-gen-for - - run: make type-gen + - run: make gen + - run: git --no-pager diff + - run: git --no-pager diff --quiet + - run: make docsgen-cli - run: git --no-pager diff - run: git --no-pager diff --quiet @@ -701,7 +704,7 @@ workflows: concurrency: "16" # expend all docker 2xlarge CPUs. - mod-tidy-check - gofmt - - cbor-gen-check + - gen-check - docs-check - test: codecov-upload: true diff --git a/Makefile b/Makefile index e2d4e3764..1ccce11ed 100644 --- a/Makefile +++ b/Makefile @@ -368,7 +368,13 @@ docsgen-openrpc-worker: docsgen-openrpc-bin .PHONY: docsgen docsgen-md-bin docsgen-openrpc-bin gen: type-gen method-gen docsgen api-gen + @echo ">>> IF YOU'VE MODIFIED THE CLI, REMEMBER TO ALSO MAKE docsgen-cli" .PHONY: gen +# separate from gen because it needs binaries +docsgen-cli: lotus lotus-miner lotus-worker + python ./scripts/generate-lotus-cli.py +.PHONY: docsgen-cli + print-%: @echo $*=$($*) diff --git a/build/version.go b/build/version.go index 84f49ead8..57582119b 100644 --- a/build/version.go +++ b/build/version.go @@ -1,8 +1,16 @@ package build +import "os" + var CurrentCommit string var BuildType int +func init() { + if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" { + CurrentCommit = "" + } +} + const ( BuildDefault = 0 BuildMainnet = 0x1 diff --git a/documentation/en/cli-lotus-miner.md b/documentation/en/cli-lotus-miner.md index bc06573ad..bd8ed424e 100644 --- a/documentation/en/cli-lotus-miner.md +++ b/documentation/en/cli-lotus-miner.md @@ -7,7 +7,7 @@ USAGE: lotus-miner [global options] command [command options] [arguments...] VERSION: - 1.11.0-dev+mainnet+git.12867a567.dirty + 1.11.0-dev+mainnet COMMANDS: init Initialize a lotus miner repo diff --git a/documentation/en/cli-lotus-worker.md b/documentation/en/cli-lotus-worker.md index 58f84dfa7..b04587c4f 100644 --- a/documentation/en/cli-lotus-worker.md +++ b/documentation/en/cli-lotus-worker.md @@ -7,7 +7,7 @@ USAGE: lotus-worker [global options] command [command options] [arguments...] VERSION: - 1.11.0-dev+2k+git.ac39417f4.dirty + 1.11.0-dev+mainnet COMMANDS: run Start lotus worker diff --git a/documentation/en/cli-lotus.md b/documentation/en/cli-lotus.md index d2fe7377a..c93a866ff 100644 --- a/documentation/en/cli-lotus.md +++ b/documentation/en/cli-lotus.md @@ -7,7 +7,7 @@ USAGE: lotus [global options] command [command options] [arguments...] VERSION: - 1.11.0-dev+mainnet+git.12867a567.dirty + 1.11.0-dev+mainnet COMMANDS: daemon Start a lotus daemon process diff --git a/scripts/generate-lotus-cli.py b/scripts/generate-lotus-cli.py index fc436d6ad..8018962e9 100644 --- a/scripts/generate-lotus-cli.py +++ b/scripts/generate-lotus-cli.py @@ -46,6 +46,7 @@ def generate_lotus_cli(prog): if __name__ == "__main__": + os.putenv("LOTUS_VERSION_IGNORE_COMMIT", "1") generate_lotus_cli('lotus') generate_lotus_cli('lotus-miner') generate_lotus_cli('lotus-worker')