From 466336755bfb1b1e79c48debafcc5c8597f4c100 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 09:31:49 +0200 Subject: [PATCH 01/14] chore: move ci templates inside specific directory --- .github/workflows/contribs.yml | 2 +- .github/workflows/gnoland.yml | 2 +- .github/workflows/gnovm.yml | 8 ++++---- .github/workflows/misc.yml | 2 +- .github/workflows/{ => templates}/build_template.yml | 0 .github/workflows/{ => templates}/gnofmt_template.yml | 0 .github/workflows/{ => templates}/lint_template.yml | 0 .github/workflows/{ => templates}/main_template.yml | 6 +++--- .github/workflows/{ => templates}/test_template.yml | 0 .github/workflows/tm2.yml | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) rename .github/workflows/{ => templates}/build_template.yml (100%) rename .github/workflows/{ => templates}/gnofmt_template.yml (100%) rename .github/workflows/{ => templates}/lint_template.yml (100%) rename .github/workflows/{ => templates}/main_template.yml (85%) rename .github/workflows/{ => templates}/test_template.yml (100%) diff --git a/.github/workflows/contribs.yml b/.github/workflows/contribs.yml index d83b8dad8ed..ed7472a32eb 100644 --- a/.github/workflows/contribs.yml +++ b/.github/workflows/contribs.yml @@ -52,7 +52,7 @@ jobs: matrix: program: ${{ fromJson(needs.setup.outputs.programs) }} name: Run Main - uses: ./.github/workflows/main_template.yml + uses: ./.github/workflows/templates/main_template.yml with: modulepath: contribs/${{ matrix.program }} go-version: ${{ (fromJson(needs.setup.outputs.go-versions))[matrix.program] }} diff --git a/.github/workflows/gnoland.yml b/.github/workflows/gnoland.yml index d279ad3822b..7f5da70d723 100644 --- a/.github/workflows/gnoland.yml +++ b/.github/workflows/gnoland.yml @@ -22,7 +22,7 @@ on: jobs: main: name: Run gno.land suite - uses: ./.github/workflows/main_template.yml + uses: ./.github/workflows/templates/main_template.yml with: modulepath: "gno.land" tests-extra-args: "-coverpkg=github.com/gnolang/gno/gno.land/..." diff --git a/.github/workflows/gnovm.yml b/.github/workflows/gnovm.yml index c5b503bb631..54e1f8d5a95 100644 --- a/.github/workflows/gnovm.yml +++ b/.github/workflows/gnovm.yml @@ -15,16 +15,16 @@ on: workflow_dispatch: jobs: - main: + test: name: Run GnoVM suite - uses: ./.github/workflows/main_template.yml + uses: ./.github/workflows/templates/main_template.yml with: modulepath: "gnovm" tests-extra-args: "-coverpkg=github.com/gnolang/gno/gnovm/..." secrets: codecov-token: ${{ secrets.CODECOV_TOKEN }} - fmt: + stdlibs-fmt: name: Run gno fmt on stdlibs - uses: ./.github/workflows/gnofmt_template.yml + uses: ./.github/workflows/templates/gnofmt_template.yml with: path: "gnovm/stdlibs/..." diff --git a/.github/workflows/misc.yml b/.github/workflows/misc.yml index 1116a87c300..575e5cf2141 100644 --- a/.github/workflows/misc.yml +++ b/.github/workflows/misc.yml @@ -24,7 +24,7 @@ jobs: - goscan - loop name: Run misc suite - uses: ./.github/workflows/main_template.yml + uses: ./.github/workflows/templates/main_template.yml with: modulepath: misc/${{ matrix.program }} tests-extra-args: "-coverpkg=github.com/gnolang/gno/misc/..." diff --git a/.github/workflows/build_template.yml b/.github/workflows/templates/build_template.yml similarity index 100% rename from .github/workflows/build_template.yml rename to .github/workflows/templates/build_template.yml diff --git a/.github/workflows/gnofmt_template.yml b/.github/workflows/templates/gnofmt_template.yml similarity index 100% rename from .github/workflows/gnofmt_template.yml rename to .github/workflows/templates/gnofmt_template.yml diff --git a/.github/workflows/lint_template.yml b/.github/workflows/templates/lint_template.yml similarity index 100% rename from .github/workflows/lint_template.yml rename to .github/workflows/templates/lint_template.yml diff --git a/.github/workflows/main_template.yml b/.github/workflows/templates/main_template.yml similarity index 85% rename from .github/workflows/main_template.yml rename to .github/workflows/templates/main_template.yml index b56567b610f..71d58f7769c 100644 --- a/.github/workflows/main_template.yml +++ b/.github/workflows/templates/main_template.yml @@ -22,19 +22,19 @@ on: jobs: lint: name: Go Lint - uses: ./.github/workflows/lint_template.yml + uses: ./.github/workflows/templates/lint_template.yml with: modulepath: ${{ inputs.modulepath }} go-version: ${{ inputs.go-version }} build: name: Go Build - uses: ./.github/workflows/build_template.yml + uses: ./.github/workflows/templates/build_template.yml with: modulepath: ${{ inputs.modulepath }} go-version: ${{ inputs.go-version }} test: name: Go Test - uses: ./.github/workflows/test_template.yml + uses: ./.github/workflows/templates/test_template.yml with: modulepath: ${{ inputs.modulepath }} tests-ts-seq: ${{ inputs.tests-ts-seq }} diff --git a/.github/workflows/test_template.yml b/.github/workflows/templates/test_template.yml similarity index 100% rename from .github/workflows/test_template.yml rename to .github/workflows/templates/test_template.yml diff --git a/.github/workflows/tm2.yml b/.github/workflows/tm2.yml index d2157eb8828..da53f6c6f11 100644 --- a/.github/workflows/tm2.yml +++ b/.github/workflows/tm2.yml @@ -15,7 +15,7 @@ on: jobs: main: name: Run TM2 suite - uses: ./.github/workflows/main_template.yml + uses: ./.github/workflows/templates/main_template.yml with: modulepath: "tm2" tests-extra-args: "-coverpkg=github.com/gnolang/gno/tm2/..." From 8fe7308e2f1a3d3753e44d5c591aacb4818ec98d Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 09:32:40 +0200 Subject: [PATCH 02/14] feat: add `-C`, similar to go, to change directory before execution --- gnovm/cmd/gno/main.go | 64 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/gnovm/cmd/gno/main.go b/gnovm/cmd/gno/main.go index c785e1bcb9b..4c58789f9c1 100644 --- a/gnovm/cmd/gno/main.go +++ b/gnovm/cmd/gno/main.go @@ -2,6 +2,9 @@ package main import ( "context" + "errors" + "flag" + "fmt" "os" "runtime/pprof" @@ -23,17 +26,68 @@ func main() { defer pprof.StopCPUProfile() } - cmd := newGnocliCmd(commands.NewDefaultIO()) + io := commands.NewDefaultIO() + cmd, cfg := newGnocliCmd(io) - cmd.Execute(context.Background(), os.Args[1:]) + args := os.Args[1:] + + if err := cmd.Parse(args); err != nil { + handleError(err) + return + } + + // Apply directory change after parsing, before running + if err := cfg.ApplyDirectory(); err != nil { + handleError(err) + return + } + + ctx := context.Background() + if err := cmd.Run(ctx); err != nil { + handleError(err) + } +} + +func handleError(err error) { + var ece commands.ExitCodeError + switch { + case errors.Is(err, flag.ErrHelp): // just exit with 1 (help already printed) + case errors.As(err, &ece): + os.Exit(int(ece)) + default: + fmt.Fprintf(os.Stderr, "%+v\n", err) + } + os.Exit(1) } -func newGnocliCmd(io commands.IO) *commands.Command { +// rootConfig handles global flags +type rootConfig struct { + ChangeDir string +} + +// RegisterFlags registers the -C flag for changing directory +func (cfg *rootConfig) RegisterFlags(fs *flag.FlagSet) { + fs.StringVar(&cfg.ChangeDir, "C", "", "change to directory before running command") +} + +// ApplyDirectory changes to the specified directory if set +func (cfg *rootConfig) ApplyDirectory() error { + if cfg.ChangeDir != "" { + if err := os.Chdir(cfg.ChangeDir); err != nil { + return fmt.Errorf("failed to change directory to %q: %w", cfg.ChangeDir, err) + } + } + return nil +} + +func newGnocliCmd(io commands.IO) (*commands.Command, *rootConfig) { + cfg := &rootConfig{} + cmd := commands.NewCommand( commands.Metadata{ ShortUsage: "gno [arguments]", }, - commands.NewEmptyConfig(), + cfg, commands.HelpExec, ) @@ -62,5 +116,5 @@ func newGnocliCmd(io commands.IO) *commands.Command { // vet ) - return cmd + return cmd, cfg } From f16f5a93f96b264a6048c211f441e39706f9c24d Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 09:42:36 +0200 Subject: [PATCH 03/14] chore(ci): use gno tempalte --- .github/workflows/examples.yml | 54 +++++++++------------------------- .github/workflows/gnovm.yml | 7 ++++- 2 files changed, 20 insertions(+), 41 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 4dd58161af0..79ca305608d 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -31,56 +31,30 @@ jobs: - run: go install -v ./gnovm/cmd/gno - run: go run ./gnovm/cmd/gno tool transpile -v --gobuild ./examples test: - strategy: - fail-fast: false - matrix: - goversion: - - "1.23.x" - # unittests: TODO: matrix with contracts - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.goversion }} - - name: Set environment variables for debug mode - if: env.ACTIONS_STEP_DEBUG == 'true' - run: | - export LOG_PATH_DIR=${{ runner.temp }}/logs - mkdir -p $LOG_PATH_DIR - echo "LOG_LEVEL=debug" >> $GITHUB_ENV - echo "LOG_PATH_DIR=$LOG_PATH_DIR" >> $GITHUB_ENV - - run: go install -v ./gnovm/cmd/gno - - run: cd examples && go run ../gnovm/cmd/gno test -v -print-runtime-metrics -print-events ./... + name: Run gno test + uses: ./.github/workflows/templates/gnotest_template.yml + with: + path: "examples" + go-version: "1.23.x" + lint: - strategy: - fail-fast: false - matrix: - goversion: - - "1.23.x" - # unittests: TODO: matrix with contracts - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.goversion }} - # testing official directories, basically examples/ minus examples/.../x/. - - run: make lint -C ./examples - # TODO: consider running lint on every other directories, maybe in "warning" mode? + name: Run gno lint + uses: ./.github/workflows/templates/gnolint_template.yml + with: + path: "examples" + go-version: "1.23.x" + # TODO: consider running lint on every other directories, maybe in "warning" mode? # TODO: track coverage fmt: name: Run gno fmt on examples - uses: ./.github/workflows/gnofmt_template.yml + uses: ./.github/workflows/templates/gnofmt_template.yml with: path: "examples/..." generate: name: Check generated files are up to date - uses: ./.github/workflows/build_template.yml + uses: ./.github/workflows/templates/build_template.yml with: modulepath: "examples" go-version: "1.23.x" diff --git a/.github/workflows/gnovm.yml b/.github/workflows/gnovm.yml index 54e1f8d5a95..6182e12c190 100644 --- a/.github/workflows/gnovm.yml +++ b/.github/workflows/gnovm.yml @@ -15,7 +15,7 @@ on: workflow_dispatch: jobs: - test: + main: name: Run GnoVM suite uses: ./.github/workflows/templates/main_template.yml with: @@ -28,3 +28,8 @@ jobs: uses: ./.github/workflows/templates/gnofmt_template.yml with: path: "gnovm/stdlibs/..." + stdlibs-test: + name: Run gno test on stdlibs + uses: ./.github/workflows/templates/gnofmt_template.yml + with: + path: "gnovm/stdlibs/..." From a15d0a9dbc114087ed10fa4c1a51c7f308996476 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 09:47:19 +0200 Subject: [PATCH 04/14] chore: use diff for fmt --- .github/workflows/templates/gnofmt_template.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/templates/gnofmt_template.yml b/.github/workflows/templates/gnofmt_template.yml index e587502a5f4..21ceaf18065 100644 --- a/.github/workflows/templates/gnofmt_template.yml +++ b/.github/workflows/templates/gnofmt_template.yml @@ -24,10 +24,4 @@ jobs: uses: actions/checkout@v5 - name: Format code with gno fmt - env: - GNOFMT_PATH: ${{ inputs.path }} - run: go run ./gnovm/cmd/gno fmt -v -diff $GNOFMT_PATH - - - name: Check for unformatted code - run: | - git diff --exit-code || (echo "Some gno files are not formatted, please run 'make fmt'." && exit 1) + run: go run ./gnovm/cmd/gno -C ${{ inputs.path }} fmt -diff ./... From 42483e9b98df7a463deb41f2232c2bff2d50e90c Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 10:00:54 +0200 Subject: [PATCH 05/14] chore: prefix instead of having a template directory --- .github/workflows/contribs.yml | 2 +- .github/workflows/examples.yml | 8 ++-- .github/workflows/gnoland.yml | 2 +- .github/workflows/gnovm.yml | 6 +-- .github/workflows/misc.yml | 2 +- .../build_template.yml => template_build.yml} | 0 ...nofmt_template.yml => template_gnofmt.yml} | 0 .github/workflows/template_gnolint.yml | 32 +++++++++++++++ .github/workflows/template_gnotest.yml | 40 +++++++++++++++++++ .../lint_template.yml => template_lint.yml} | 0 .../main_template.yml => template_main.yml} | 6 +-- .../test_template.yml => template_test.yml} | 0 .github/workflows/tm2.yml | 2 +- 13 files changed, 86 insertions(+), 14 deletions(-) rename .github/workflows/{templates/build_template.yml => template_build.yml} (100%) rename .github/workflows/{templates/gnofmt_template.yml => template_gnofmt.yml} (100%) create mode 100644 .github/workflows/template_gnolint.yml create mode 100644 .github/workflows/template_gnotest.yml rename .github/workflows/{templates/lint_template.yml => template_lint.yml} (100%) rename .github/workflows/{templates/main_template.yml => template_main.yml} (85%) rename .github/workflows/{templates/test_template.yml => template_test.yml} (100%) diff --git a/.github/workflows/contribs.yml b/.github/workflows/contribs.yml index ed7472a32eb..243def482f0 100644 --- a/.github/workflows/contribs.yml +++ b/.github/workflows/contribs.yml @@ -52,7 +52,7 @@ jobs: matrix: program: ${{ fromJson(needs.setup.outputs.programs) }} name: Run Main - uses: ./.github/workflows/templates/main_template.yml + uses: ./.github/workflows/template_main.yml with: modulepath: contribs/${{ matrix.program }} go-version: ${{ (fromJson(needs.setup.outputs.go-versions))[matrix.program] }} diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 79ca305608d..17fb49cb38a 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -32,14 +32,14 @@ jobs: - run: go run ./gnovm/cmd/gno tool transpile -v --gobuild ./examples test: name: Run gno test - uses: ./.github/workflows/templates/gnotest_template.yml + uses: ./.github/workflows/template_gnotest.yml with: path: "examples" go-version: "1.23.x" lint: name: Run gno lint - uses: ./.github/workflows/templates/gnolint_template.yml + uses: ./.github/workflows/template_gnolint.yml with: path: "examples" go-version: "1.23.x" @@ -48,13 +48,13 @@ jobs: fmt: name: Run gno fmt on examples - uses: ./.github/workflows/templates/gnofmt_template.yml + uses: ./.github/workflows/template_gnofmt.yml with: path: "examples/..." generate: name: Check generated files are up to date - uses: ./.github/workflows/templates/build_template.yml + uses: ./.github/workflows/template_build.yml with: modulepath: "examples" go-version: "1.23.x" diff --git a/.github/workflows/gnoland.yml b/.github/workflows/gnoland.yml index 7f5da70d723..456e38edc0d 100644 --- a/.github/workflows/gnoland.yml +++ b/.github/workflows/gnoland.yml @@ -22,7 +22,7 @@ on: jobs: main: name: Run gno.land suite - uses: ./.github/workflows/templates/main_template.yml + uses: ./.github/workflows/template_main.yml with: modulepath: "gno.land" tests-extra-args: "-coverpkg=github.com/gnolang/gno/gno.land/..." diff --git a/.github/workflows/gnovm.yml b/.github/workflows/gnovm.yml index 6182e12c190..bd49746f03f 100644 --- a/.github/workflows/gnovm.yml +++ b/.github/workflows/gnovm.yml @@ -17,7 +17,7 @@ on: jobs: main: name: Run GnoVM suite - uses: ./.github/workflows/templates/main_template.yml + uses: ./.github/workflows/template_main.yml with: modulepath: "gnovm" tests-extra-args: "-coverpkg=github.com/gnolang/gno/gnovm/..." @@ -25,11 +25,11 @@ jobs: codecov-token: ${{ secrets.CODECOV_TOKEN }} stdlibs-fmt: name: Run gno fmt on stdlibs - uses: ./.github/workflows/templates/gnofmt_template.yml + uses: ./.github/workflows/template_gnofmt.yml with: path: "gnovm/stdlibs/..." stdlibs-test: name: Run gno test on stdlibs - uses: ./.github/workflows/templates/gnofmt_template.yml + uses: ./.github/workflows/template_gnofmt.yml with: path: "gnovm/stdlibs/..." diff --git a/.github/workflows/misc.yml b/.github/workflows/misc.yml index 575e5cf2141..b8647b45e69 100644 --- a/.github/workflows/misc.yml +++ b/.github/workflows/misc.yml @@ -24,7 +24,7 @@ jobs: - goscan - loop name: Run misc suite - uses: ./.github/workflows/templates/main_template.yml + uses: ./.github/workflows/template_main.yml with: modulepath: misc/${{ matrix.program }} tests-extra-args: "-coverpkg=github.com/gnolang/gno/misc/..." diff --git a/.github/workflows/templates/build_template.yml b/.github/workflows/template_build.yml similarity index 100% rename from .github/workflows/templates/build_template.yml rename to .github/workflows/template_build.yml diff --git a/.github/workflows/templates/gnofmt_template.yml b/.github/workflows/template_gnofmt.yml similarity index 100% rename from .github/workflows/templates/gnofmt_template.yml rename to .github/workflows/template_gnofmt.yml diff --git a/.github/workflows/template_gnolint.yml b/.github/workflows/template_gnolint.yml new file mode 100644 index 00000000000..8e5e20dd738 --- /dev/null +++ b/.github/workflows/template_gnolint.yml @@ -0,0 +1,32 @@ +on: + workflow_call: + inputs: + path: + description: "Path to run gno lint on" + required: true + type: string + go-version: + description: "Go version to use" + required: true + type: string + debug: + description: "Enable debug logs" + required: false + +jobs: + lint: + strategy: + fail-fast: false + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Install Go + uses: ./.github/actions/setup-go + with: + go-version: ${{ inputs.go-version }} + + - name: Run gno lint + run: go run ./gnovm/cmd/gno lint -C ${{ inputs.path }} -v . diff --git a/.github/workflows/template_gnotest.yml b/.github/workflows/template_gnotest.yml new file mode 100644 index 00000000000..f5680239dbd --- /dev/null +++ b/.github/workflows/template_gnotest.yml @@ -0,0 +1,40 @@ +on: + workflow_call: + inputs: + path: + description: "Path to run gno test on" + required: true + type: string + go-version: + description: "Go version to use" + required: true + type: string + debug: + description: "Enable debug logs" + required: false + +jobs: + test: + strategy: + fail-fast: false + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Install Go + uses: ./.github/actions/setup-go + with: + go-version: ${{ inputs.go-version }} + + - name: Setup debug env + if: ${{ inputs.debug }} + run: | + export LOG_PATH_DIR=${{ runner.temp }}/logs + mkdir -p $LOG_PATH_DIR + echo "LOG_LEVEL=debug" >> $GITHUB_ENV + echo "LOG_PATH_DIR=$LOG_PATH_DIR" >> $GITHUB_ENV + + - name: Run gno test + run: go run ./gnovm/cmd/gno test -C ${{ inputs.path }} -v -print-runtime-metrics -print-events ./... diff --git a/.github/workflows/templates/lint_template.yml b/.github/workflows/template_lint.yml similarity index 100% rename from .github/workflows/templates/lint_template.yml rename to .github/workflows/template_lint.yml diff --git a/.github/workflows/templates/main_template.yml b/.github/workflows/template_main.yml similarity index 85% rename from .github/workflows/templates/main_template.yml rename to .github/workflows/template_main.yml index 71d58f7769c..6dc66de19a3 100644 --- a/.github/workflows/templates/main_template.yml +++ b/.github/workflows/template_main.yml @@ -22,19 +22,19 @@ on: jobs: lint: name: Go Lint - uses: ./.github/workflows/templates/lint_template.yml + uses: ./.github/workflows/template_lint.yml with: modulepath: ${{ inputs.modulepath }} go-version: ${{ inputs.go-version }} build: name: Go Build - uses: ./.github/workflows/templates/build_template.yml + uses: ./.github/workflows/template_build.yml with: modulepath: ${{ inputs.modulepath }} go-version: ${{ inputs.go-version }} test: name: Go Test - uses: ./.github/workflows/templates/test_template.yml + uses: ./.github/workflows/template_test.yml with: modulepath: ${{ inputs.modulepath }} tests-ts-seq: ${{ inputs.tests-ts-seq }} diff --git a/.github/workflows/templates/test_template.yml b/.github/workflows/template_test.yml similarity index 100% rename from .github/workflows/templates/test_template.yml rename to .github/workflows/template_test.yml diff --git a/.github/workflows/tm2.yml b/.github/workflows/tm2.yml index da53f6c6f11..8f234117d93 100644 --- a/.github/workflows/tm2.yml +++ b/.github/workflows/tm2.yml @@ -15,7 +15,7 @@ on: jobs: main: name: Run TM2 suite - uses: ./.github/workflows/templates/main_template.yml + uses: ./.github/workflows/template_main.yml with: modulepath: "tm2" tests-extra-args: "-coverpkg=github.com/gnolang/gno/tm2/..." From f1b8e53f4538b9c0c095f233254ed1809f09ffa9 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 10:06:43 +0200 Subject: [PATCH 06/14] fix: path --- .github/workflows/examples.yml | 2 +- .github/workflows/gnovm.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 17fb49cb38a..813b7a79b6a 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -50,7 +50,7 @@ jobs: name: Run gno fmt on examples uses: ./.github/workflows/template_gnofmt.yml with: - path: "examples/..." + path: "examples" generate: name: Check generated files are up to date diff --git a/.github/workflows/gnovm.yml b/.github/workflows/gnovm.yml index bd49746f03f..0078c96213f 100644 --- a/.github/workflows/gnovm.yml +++ b/.github/workflows/gnovm.yml @@ -27,9 +27,9 @@ jobs: name: Run gno fmt on stdlibs uses: ./.github/workflows/template_gnofmt.yml with: - path: "gnovm/stdlibs/..." + path: "gnovm/stdlibs" stdlibs-test: name: Run gno test on stdlibs uses: ./.github/workflows/template_gnofmt.yml with: - path: "gnovm/stdlibs/..." + path: "gnovm/stdlibs" From ce862983e61eee4aad6377fd05d1aaa5984be8b7 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 10:12:06 +0200 Subject: [PATCH 07/14] chore: lint --- gnovm/cmd/gno/README.md | 3 +++ gnovm/cmd/gno/clean_test.go | 6 ++++-- gnovm/cmd/gno/main_test.go | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gnovm/cmd/gno/README.md b/gnovm/cmd/gno/README.md index f38b4fad81b..02ffea95afa 100644 --- a/gnovm/cmd/gno/README.md +++ b/gnovm/cmd/gno/README.md @@ -29,6 +29,9 @@ SUBCOMMANDS tool run specified gno tool version display installed gno version +FLAGS + -C ... change to directory before running command + ``` ## Install diff --git a/gnovm/cmd/gno/clean_test.go b/gnovm/cmd/gno/clean_test.go index 44955066dfc..d0b2847bde3 100644 --- a/gnovm/cmd/gno/clean_test.go +++ b/gnovm/cmd/gno/clean_test.go @@ -100,7 +100,8 @@ func TestCleanApp(t *testing.T) { io.SetErr(commands.WriteNopCloser(mockErr)) // dry run clean - err = newGnocliCmd(io).ParseAndRun(context.Background(), []string{"clean", "-n"}) + cmd, _ := newGnocliCmd(io) + err = cmd.ParseAndRun(context.Background(), []string{"clean", "-n"}) require.NoError(t, err) // check output if tc.stdOut != "" { @@ -113,7 +114,8 @@ func TestCleanApp(t *testing.T) { } // run clean - err = newGnocliCmd(io).ParseAndRun(context.Background(), []string{"clean"}) + cmd, _ = newGnocliCmd(io) + err = cmd.ParseAndRun(context.Background(), []string{"clean"}) require.NoError(t, err) // check files for _, file := range tc.filesRemoved { diff --git a/gnovm/cmd/gno/main_test.go b/gnovm/cmd/gno/main_test.go index 909bd8cbf93..ef1b5f39edf 100644 --- a/gnovm/cmd/gno/main_test.go +++ b/gnovm/cmd/gno/main_test.go @@ -136,7 +136,8 @@ func testMainCaseRun(t *testing.T, tc []testMainCase) { testPackageFetcher = examplespkgfetcher.New("") - err := newGnocliCmd(io).ParseAndRun(context.Background(), test.args) + cmd, _ := newGnocliCmd(io) + err := cmd.ParseAndRun(context.Background(), test.args) if errShouldBeEmpty { require.Nil(t, err, "err should be nil") From d915672987c900aa4aa277240efd4181f2886549 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 10:12:15 +0200 Subject: [PATCH 08/14] feat: stdlibs lint --- .github/workflows/gnovm.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/gnovm.yml b/.github/workflows/gnovm.yml index 0078c96213f..fd9a39b064b 100644 --- a/.github/workflows/gnovm.yml +++ b/.github/workflows/gnovm.yml @@ -33,3 +33,8 @@ jobs: uses: ./.github/workflows/template_gnofmt.yml with: path: "gnovm/stdlibs" + stdlibs-lint: + name: Run gno test on stdlibs + uses: ./.github/workflows/template_gnolint.yml + with: + path: "gnovm/stdlibs" From c011e1702d21a589f9880969a68a1f3fbecc376b Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 10:18:03 +0200 Subject: [PATCH 09/14] fix: template --- .github/workflows/examples.yml | 1 + .github/workflows/template_gnolint.yml | 1 + .github/workflows/template_gnotest.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 813b7a79b6a..ef8f0004cde 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -34,6 +34,7 @@ jobs: name: Run gno test uses: ./.github/workflows/template_gnotest.yml with: + debug: env.ACTIONS_STEP_DEBUG == 'true' path: "examples" go-version: "1.23.x" diff --git a/.github/workflows/template_gnolint.yml b/.github/workflows/template_gnolint.yml index 8e5e20dd738..41bbd220111 100644 --- a/.github/workflows/template_gnolint.yml +++ b/.github/workflows/template_gnolint.yml @@ -12,6 +12,7 @@ on: debug: description: "Enable debug logs" required: false + type: boolean jobs: lint: diff --git a/.github/workflows/template_gnotest.yml b/.github/workflows/template_gnotest.yml index f5680239dbd..33b3f892c4d 100644 --- a/.github/workflows/template_gnotest.yml +++ b/.github/workflows/template_gnotest.yml @@ -12,6 +12,7 @@ on: debug: description: "Enable debug logs" required: false + type: boolean jobs: test: From 9bd4639a8339746b360c69feaff37b46212163cd Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 10:21:45 +0200 Subject: [PATCH 10/14] fix: template --- .github/workflows/template_gnolint.yml | 3 ++- .github/workflows/template_gnotest.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/template_gnolint.yml b/.github/workflows/template_gnolint.yml index 41bbd220111..8c394306c22 100644 --- a/.github/workflows/template_gnolint.yml +++ b/.github/workflows/template_gnolint.yml @@ -7,8 +7,9 @@ on: type: string go-version: description: "Go version to use" - required: true + required: false type: string + default: "1.23.x" debug: description: "Enable debug logs" required: false diff --git a/.github/workflows/template_gnotest.yml b/.github/workflows/template_gnotest.yml index 33b3f892c4d..da67bc103f1 100644 --- a/.github/workflows/template_gnotest.yml +++ b/.github/workflows/template_gnotest.yml @@ -7,8 +7,9 @@ on: type: string go-version: description: "Go version to use" - required: true + required: false type: string + default: "1.23.x" debug: description: "Enable debug logs" required: false From 0a36cc450b278939c4fbab47e7637a82e17f6f2d Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 10:30:11 +0200 Subject: [PATCH 11/14] fix: template --- .github/workflows/gnovm.yml | 2 +- .github/workflows/template_gnofmt.yml | 6 +++--- .github/workflows/template_gnolint.yml | 2 +- .github/workflows/template_gnotest.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/gnovm.yml b/.github/workflows/gnovm.yml index fd9a39b064b..c90114f0134 100644 --- a/.github/workflows/gnovm.yml +++ b/.github/workflows/gnovm.yml @@ -34,7 +34,7 @@ jobs: with: path: "gnovm/stdlibs" stdlibs-lint: - name: Run gno test on stdlibs + name: Run gno lint on stdlibs uses: ./.github/workflows/template_gnolint.yml with: path: "gnovm/stdlibs" diff --git a/.github/workflows/template_gnofmt.yml b/.github/workflows/template_gnofmt.yml index 21ceaf18065..b4d2f70909f 100644 --- a/.github/workflows/template_gnofmt.yml +++ b/.github/workflows/template_gnofmt.yml @@ -15,13 +15,13 @@ jobs: fmt: runs-on: ubuntu-latest steps: + - name: Checkout code + uses: actions/checkout@v5 + - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ inputs.go-version }} - - name: Checkout code - uses: actions/checkout@v5 - - name: Format code with gno fmt run: go run ./gnovm/cmd/gno -C ${{ inputs.path }} fmt -diff ./... diff --git a/.github/workflows/template_gnolint.yml b/.github/workflows/template_gnolint.yml index 8c394306c22..6ad918e4f97 100644 --- a/.github/workflows/template_gnolint.yml +++ b/.github/workflows/template_gnolint.yml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@v5 - name: Install Go - uses: ./.github/actions/setup-go + uses: actions/setup-go@v5 with: go-version: ${{ inputs.go-version }} diff --git a/.github/workflows/template_gnotest.yml b/.github/workflows/template_gnotest.yml index da67bc103f1..d13636d6d15 100644 --- a/.github/workflows/template_gnotest.yml +++ b/.github/workflows/template_gnotest.yml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@v5 - name: Install Go - uses: ./.github/actions/setup-go + uses: actions/setup-go@v5 with: go-version: ${{ inputs.go-version }} From 4f06991d28c1515acad9d40f9fa512da4cc9c5a2 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 10:32:40 +0200 Subject: [PATCH 12/14] chore: rename job --- .github/workflows/gnovm.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gnovm.yml b/.github/workflows/gnovm.yml index c90114f0134..48da1fbcf3d 100644 --- a/.github/workflows/gnovm.yml +++ b/.github/workflows/gnovm.yml @@ -24,17 +24,17 @@ jobs: secrets: codecov-token: ${{ secrets.CODECOV_TOKEN }} stdlibs-fmt: - name: Run gno fmt on stdlibs + name: stdlibs - fmt uses: ./.github/workflows/template_gnofmt.yml with: path: "gnovm/stdlibs" stdlibs-test: - name: Run gno test on stdlibs + name: stdlibs - test uses: ./.github/workflows/template_gnofmt.yml with: path: "gnovm/stdlibs" stdlibs-lint: - name: Run gno lint on stdlibs + name: stdlibs - lint uses: ./.github/workflows/template_gnolint.yml with: path: "gnovm/stdlibs" From 109c06a89d41dcee2af489438d530ac3a63a36ab Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 10:34:04 +0200 Subject: [PATCH 13/14] fix: gno lint action --- .github/workflows/template_gnolint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/template_gnolint.yml b/.github/workflows/template_gnolint.yml index 6ad918e4f97..6ba92e04bfc 100644 --- a/.github/workflows/template_gnolint.yml +++ b/.github/workflows/template_gnolint.yml @@ -31,4 +31,4 @@ jobs: go-version: ${{ inputs.go-version }} - name: Run gno lint - run: go run ./gnovm/cmd/gno lint -C ${{ inputs.path }} -v . + run: go run ./gnovm/cmd/gno lint -C ${{ inputs.path }} -v ./... From 7c891f7810992f988c623fbba900c38b5e83a38b Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 12 Sep 2025 10:45:02 +0200 Subject: [PATCH 14/14] fix wrong template name --- .github/workflows/gnovm.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gnovm.yml b/.github/workflows/gnovm.yml index 48da1fbcf3d..319e6870e66 100644 --- a/.github/workflows/gnovm.yml +++ b/.github/workflows/gnovm.yml @@ -24,17 +24,17 @@ jobs: secrets: codecov-token: ${{ secrets.CODECOV_TOKEN }} stdlibs-fmt: - name: stdlibs - fmt + name: stdlibs - Run fmt uses: ./.github/workflows/template_gnofmt.yml with: path: "gnovm/stdlibs" stdlibs-test: - name: stdlibs - test - uses: ./.github/workflows/template_gnofmt.yml + name: stdlibs - Run tests + uses: ./.github/workflows/template_gnotest.yml with: path: "gnovm/stdlibs" stdlibs-lint: - name: stdlibs - lint + name: stdlibs - Run lint uses: ./.github/workflows/template_gnolint.yml with: path: "gnovm/stdlibs"