Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: devtool: refactor api-gen & re-generate related codes #4737

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions .github/workflows/baisc_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,15 @@ jobs:
- name: tests-shared
run: make test-venus-shared

- name: compatible-checks
- name: compatible all
run: |
make compatible-all
git --no-pager diff
git --no-pager diff --quiet

- name: check api docs
- name: gen all
run: |
make api-docs
git --no-pager diff
git --no-pager diff --quiet
make gen-all

- name: check cbor-gen
- name: detect changes
run: |
make cborgen
git --no-pager diff
git --no-pager diff --quiet

- name: check mock pai
run: |
make mock-api-gen
git --no-pager diff
git --no-pager diff --quiet
git status --porcelain
test -z "$(git status --porcelain)"
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ clean:
rm -rf ./extern/filecoin-ffi
rm -rf ./extern/test-vectors

gen-all: cborgen gogen inline-gen api-gen api-docs-gen

gen-asset:
go-bindata -pkg=asset -o ./fixtures/asset/asset.go ./fixtures/_assets/car/ ./fixtures/_assets/proof-params/ ./fixtures/_assets/arch-diagram.monopic
gofmt -s -l -w ./fixtures/asset/asset.go
Expand All @@ -45,14 +47,12 @@ inline-gen:
test-venus-shared:
cd venus-shared && go test -covermode=set ./...

gen-api:
cd ./venus-devtool/ && go run ./api-gen/
gofmt -s -l -w ./venus-shared/api/chain/v0/proxy_gen.go;
gofmt -s -l -w ./venus-shared/api/chain/v1/proxy_gen.go
api-gen:
cd ./venus-devtool/ && go run ./api-gen/ proxy

v0APIDoc = ../venus-shared/api/v0-api-document.md
v1APIDoc = ../venus-shared/api/v1-api-document.md
api-docs:
api-docs-gen:
cd ./venus-devtool/ && go run ./api-docs-gen/cmd ../venus-shared/api/chain/v0/fullnode.go FullNode v0 ../venus-shared/api/chain/v0 $(v0APIDoc)
cd ./venus-devtool/ && go run ./api-docs-gen/cmd ../venus-shared/api/chain/v1/fullnode.go FullNode v1 ../venus-shared/api/chain/v1 $(v1APIDoc)

Expand Down
26 changes: 26 additions & 0 deletions venus-devtool/api-gen/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package main

import (
"fmt"
"os"

"github.com/urfave/cli/v2"
)

func main() {
app := &cli.App{
Name: "api-gen",
Usage: "generate api related codes for venus-shared",
EnableBashCompletion: true,
Flags: []cli.Flag{},
Commands: []*cli.Command{
proxyCmd,
},
}

app.Setup()

if err := app.Run(os.Args); err != nil {
fmt.Fprintf(os.Stderr, "ERR: %v\n", err) // nolint: errcheck
}
}
Loading