diff --git a/.github/codecov.yml b/.github/codecov.yml index d1ecba7ade3..75766735de1 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -4,7 +4,7 @@ codecov: wait_for_ci: true comment: - require_changes: false + require_changes: true coverage: round: down @@ -13,7 +13,7 @@ coverage: project: default: target: auto - threshold: 10 # Let's decrease this later. + threshold: 5 # Let's decrease this later. base: parent if_no_uploads: error if_not_found: success @@ -22,12 +22,12 @@ coverage: patch: default: target: auto - threshold: 10 # Let's decrease this later. + threshold: 5 # Let's decrease this later. base: auto if_no_uploads: error if_not_found: success if_ci_failed: error - only_pulls: false + only_pulls: true # Only check patch coverage on PRs flag_management: default_rules: @@ -40,6 +40,55 @@ flag_management: target: auto # Let's decrease this later. threshold: 10 + groups: + gno-land: + paths: + - "gno.land/**" + flags: + - gno-land + gnovm: + paths: + - "gnovm/**" + flags: + - gnovm + misc: + paths: + - "misc/**" + flags: + - misc + tm2: + paths: + - "tm2/**" + flags: + - tm2 + contribs: + paths: + - "contribs/**" + flags: + - contribs + + statuses: + - type: project + flag: gno-land + target: auto + threshold: 5 + - type: project + flag: gnovm + target: auto + threshold: 2 # Stricter threshold + - type: project + flag: misc + target: auto + threshold: 10 + - type: project + flag: tm2 + target: auto + threshold: 5 + - type: project + flag: contribs + target: auto + threshold: 5 + ignore: - "gnovm/stdlibs/generated.go" - "gnovm/tests/stdlibs/generated.go" diff --git a/.github/golangci.yml b/.github/golangci.yml index b8bd5537135..fe356b52fff 100644 --- a/.github/golangci.yml +++ b/.github/golangci.yml @@ -44,9 +44,11 @@ linters: linters-settings: gofmt: simplify: true + goconst: min-len: 3 min-occurrences: 3 + gosec: excludes: - G204 # Subprocess launched with a potential tainted input or cmd arguments @@ -56,6 +58,7 @@ linters-settings: checks: [ "all", "-ST1022", "-ST1003" ] errorlint: asserts: false + gocritic: enabled-tags: - diagnostic @@ -63,10 +66,11 @@ linters-settings: - opinionated - performance - style + forbidigo: forbid: - p: '^regexp\.(Match|MatchString)$' - msg: it will re-compile the regexp for each execution; compile the regexp with regexp.Compile and store it as a singleton + msg: "Use compiled regex via regexp.Compile and store as a singleton" issues: whole-files: true @@ -74,6 +78,7 @@ issues: max-same-issues: 0 new: false fix: false + exclude-rules: - path: _test\.go linters: diff --git a/.github/workflows/auto-author-assign.yml b/.github/workflows/auto-author-assign.yml index 06dfb4ab903..890e70da9ae 100644 --- a/.github/workflows/auto-author-assign.yml +++ b/.github/workflows/auto-author-assign.yml @@ -1,4 +1,4 @@ -name: auto-author-assign +name: Auto Assign PR Author on: pull_request_target: diff --git a/.github/workflows/autocounterd.yml b/.github/workflows/autocounterd.yml index 9217fe2eef2..dcba56178bd 100644 --- a/.github/workflows/autocounterd.yml +++ b/.github/workflows/autocounterd.yml @@ -1,19 +1,13 @@ -name: autocounterd +name: Portal Loop - autocounterd on: - pull_request: - branches: - - master push: + branches: + - "master" paths: - misc/autocounterd - misc/loop - .github/workflows/autocounterd.yml - branches: - - "master" - - "misc/autocounterd" - tags: - - "v*" permissions: contents: read diff --git a/.github/workflows/benchmark-master-push.yml b/.github/workflows/benchmark-master-push.yml index 622baefc0de..b84cfb06475 100644 --- a/.github/workflows/benchmark-master-push.yml +++ b/.github/workflows/benchmark-master-push.yml @@ -1,4 +1,4 @@ -name: run benchmarks when pushing on main branch +name: Run and Save Benchmarks on: push: @@ -9,6 +9,7 @@ on: - gno.land/** - gnovm/** - tm2/** + - '**/*.go' permissions: # deployments permission to deploy GitHub pages website @@ -22,7 +23,7 @@ env: jobs: benchmarks: if: ${{ github.repository == 'gnolang/gno' }} - runs-on: [self-hosted, Linux, X64, benchmarks] + runs-on: [ self-hosted, Linux, X64, benchmarks ] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d2eef9d7445..270c422b3de 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -9,7 +9,7 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: CodeQL on: push: @@ -41,8 +41,8 @@ jobs: fail-fast: false matrix: include: - - language: go - build-mode: autobuild + - language: go + build-mode: autobuild # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' # Use `c-cpp` to analyze code written in C, C++ or both # Use 'java-kotlin' to analyze code written in Java, Kotlin or both @@ -52,38 +52,38 @@ jobs: # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - build-mode: ${{ matrix.build-mode }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality - # If the analyze step fails for one of the languages you are analyzing with - # "We were unable to automatically build your code", modify the matrix above - # to set the build mode to "manual" for that language. Then modify this step - # to build your code. - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - if: matrix.build-mode == 'manual' - run: | - echo 'If you are using a "manual" build mode for one or more of the' \ - 'languages you are analyzing, replace this with the commands to build' \ - 'your code, for example:' - echo ' make bootstrap' - echo ' make release' - exit 1 + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{matrix.language}}" + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/contribs.yml b/.github/workflows/contribs.yml index 3739339f7be..32baedd2125 100644 --- a/.github/workflows/contribs.yml +++ b/.github/workflows/contribs.yml @@ -1,11 +1,13 @@ -name: contribs +name: Contribs CI Suite on: push: branches: - master - workflow_dispatch: pull_request: + paths: + - contribs/** + workflow_dispatch: jobs: setup: @@ -19,12 +21,13 @@ jobs: main: needs: setup strategy: - fail-fast: false - matrix: - program: ${{ fromJson(needs.setup.outputs.programs) }} + fail-fast: false + matrix: + program: ${{ fromJson(needs.setup.outputs.programs) }} name: Run Main uses: ./.github/workflows/main_template.yml with: modulepath: contribs/${{ matrix.program }} + go-version: "1.22.x" secrets: codecov-token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/dependabot-validate.yml b/.github/workflows/dependabot-validate.yml index b1387dc0bb2..3d7b2c315c6 100644 --- a/.github/workflows/dependabot-validate.yml +++ b/.github/workflows/dependabot-validate.yml @@ -1,10 +1,11 @@ -name: dependabot validate +name: Validate Dependabot Config on: pull_request: paths: - '.github/dependabot.yml' - '.github/workflows/dependabot-validate.yml' + jobs: validate: runs-on: ubuntu-latest diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index d800147a498..f180f1679b1 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -1,4 +1,6 @@ -name: deploy docs on gnolang/docs.gno.land repository +# This workflow triggers a cross-repo workflow call, +# that deploys the monorepo docs on Netlify, using Docusaurus +name: Deploy the Documentation on: push: branches: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs-linter.yml similarity index 95% rename from .github/workflows/docs.yml rename to .github/workflows/docs-linter.yml index c9d9af0fb6f..d603d796ae9 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs-linter.yml @@ -1,8 +1,8 @@ -name: "docs / lint" +name: Docs Linter on: push: - paths: + branches: - master pull_request: paths: diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 41d579c4567..b14bad6b9c5 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -1,9 +1,13 @@ -name: examples +name: Gno Examples CI Suite on: - pull_request: push: - branches: ["master"] + branches: + - master + pull_request: + paths: + - gnovm/**/*.gno + - examples/**/*.gno concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -67,26 +71,23 @@ jobs: # TODO: consider running lint on every other directories, maybe in "warning" mode? # TODO: track coverage fmt: - strategy: - fail-fast: false - matrix: - goversion: ["1.22.x"] + name: Run gno fmt runs-on: ubuntu-latest - timeout-minutes: 10 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + - name: gno fmt + uses: ./.github/workflows/gnofmt_template.yml with: - go-version: ${{ matrix.goversion }} - - run: | - make fmt -C ./examples - # Check if there are changes after running make fmt + path: "examples/..." + go-version: "1.22.x" + - name: Check for unformatted gno files + run: | git diff --exit-code || (echo "Some gno files are not formatted, please run 'make fmt'." && exit 1) + mod-tidy: strategy: fail-fast: false matrix: - go-version: ["1.22.x"] + go-version: [ "1.22.x" ] # unittests: TODO: matrix with contracts runs-on: ubuntu-latest timeout-minutes: 10 diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index 41d9a2cba94..e8defd00f7c 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -1,6 +1,18 @@ name: Dependency License Scanning on: + push: + branches: + - master + paths: + - '**/*.go' + - 'go.mod' + - 'go.sum' + pull_request: + paths: + - '**/*.go' + - 'go.mod' + - 'go.sum' workflow_dispatch: permissions: diff --git a/.github/workflows/genesis-verify.yml b/.github/workflows/genesis-verify.yml index 1288d588100..acc41cc99ad 100644 --- a/.github/workflows/genesis-verify.yml +++ b/.github/workflows/genesis-verify.yml @@ -1,9 +1,10 @@ -name: genesis-verify +name: Deployment genesis.json Verification on: - pull_request: + push: branches: - master + pull_request: paths: - "misc/deployments/**/genesis.json" - ".github/workflows/genesis-verify.yml" @@ -13,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - testnet: ["test5.gno.land"] + testnet: [ "test5.gno.land" ] runs-on: ubuntu-latest steps: - name: Checkout code diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 1b955b52cd0..0b6240e2239 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,9 +1,11 @@ -# generate docs and publish on gh-pages branch -name: gh-pages +# generate Go docs and publish on gh-pages branch +# Live at: https://gnolang.github.io/gno +name: Go Reference Docs Deployment on: push: - branches: [ "master" ] + branches: + - master workflow_dispatch: permissions: diff --git a/.github/workflows/gnofmt_template.yml b/.github/workflows/gnofmt_template.yml index 1ba66d0fbe3..8d4b38f8121 100644 --- a/.github/workflows/gnofmt_template.yml +++ b/.github/workflows/gnofmt_template.yml @@ -1,12 +1,14 @@ on: workflow_call: - inputs: - path: - required: true - type: string - go-version: - required: true - type: string + inputs: + path: + description: "Path to run gno fmt on" + required: true + type: string + go-version: + description: "Go version to use" + required: true + type: string jobs: fmt: @@ -18,7 +20,7 @@ jobs: go-version: ${{ inputs.go-version }} - name: Checkout code uses: actions/checkout@v4 - - name: Fmt + - name: fmt env: GNOFMT_PATH: ${{ inputs.path }} run: go run ./gnovm/cmd/gno fmt -v -diff $GNOFMT_PATH diff --git a/.github/workflows/gnoland.yml b/.github/workflows/gnoland.yml index 4817e2db0e3..8ba7af63cdc 100644 --- a/.github/workflows/gnoland.yml +++ b/.github/workflows/gnoland.yml @@ -1,18 +1,25 @@ -name: gno.land +name: gno.land CI Suite on: push: branches: - master - workflow_dispatch: pull_request: + paths: + - gno.land/** + # We trigger the testing workflow for gno.land on the following, + # since there are integration suites that cover the gnovm / tm2 + - gnovm/** + - tm2/** + workflow_dispatch: jobs: main: - name: Run Main + name: Run gno.land suite uses: ./.github/workflows/main_template.yml with: modulepath: "gno.land" + go-version: "1.22.x" tests-extra-args: "-coverpkg=github.com/gnolang/gno/gno.land/..." secrets: codecov-token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/gnovm.yml b/.github/workflows/gnovm.yml index 7e7586b23d9..aa7b670dda9 100644 --- a/.github/workflows/gnovm.yml +++ b/.github/workflows/gnovm.yml @@ -1,22 +1,27 @@ -name: gnovm +name: GnoVM CI Suite on: push: branches: - master - workflow_dispatch: pull_request: + paths: + - gnovm/** + - tm2/** # GnoVM has a dependency on TM2 types + workflow_dispatch: jobs: main: - name: Run Main + name: Run GnoVM suite uses: ./.github/workflows/main_template.yml with: modulepath: "gnovm" + go-version: "1.22.x" + tests-extra-args: "-coverpkg=github.com/gnolang/gno/gnovm/..." secrets: codecov-token: ${{ secrets.CODECOV_TOKEN }} fmt: - name: Run Gno Fmt + name: Run gno fmt on stdlibs uses: ./.github/workflows/gnofmt_template.yml with: path: "gnovm/stdlibs/..." diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 06b2daa1d3d..56075c31db3 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,6 +1,6 @@ -name: "Pull Request Labeler" +name: Pull Request Labeler on: -- pull_request_target + - pull_request_target jobs: triage: @@ -9,5 +9,5 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/labeler@v5 + - uses: actions/checkout@v4 + - uses: actions/labeler@v5 diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml index 631f764c37f..3c7236b264f 100644 --- a/.github/workflows/lint-pr-title.yml +++ b/.github/workflows/lint-pr-title.yml @@ -1,4 +1,4 @@ -name: "lint-pr-title" +name: PR Title Linter on: pull_request_target: diff --git a/.github/workflows/lint_template.yml b/.github/workflows/lint_template.yml index b7568d19c41..43246572daa 100644 --- a/.github/workflows/lint_template.yml +++ b/.github/workflows/lint_template.yml @@ -8,7 +8,6 @@ on: required: true type: string - jobs: lint: runs-on: ubuntu-latest diff --git a/.github/workflows/main_template.yml b/.github/workflows/main_template.yml index 5b3437b54a1..4cfd49fb1ed 100644 --- a/.github/workflows/main_template.yml +++ b/.github/workflows/main_template.yml @@ -1,41 +1,41 @@ on: - workflow_call: - inputs: - modulepath: - required: true - type: string - tests-extra-args: - required: false - type: string - secrets: - codecov-token: - required: true - -# TODO: environment variables cannot be sent to reusable workflows: https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations -# env: -# GO_VERSION: "1.22.x" + workflow_call: + inputs: + modulepath: + required: true + type: string + tests-extra-args: + required: false + type: string + go-version: + description: "Go version to use" + required: true + type: string + secrets: + codecov-token: + required: true jobs: - lint: - name: Go Linter - uses: ./.github/workflows/lint_template.yml - with: - modulepath: ${{ inputs.modulepath }} - go-version: "1.22.x" - build: - name: Go Build - uses: ./.github/workflows/build_template.yml - with: - modulepath: ${{ inputs.modulepath }} - go-version: "1.22.x" - test: - name: Go Test - uses: ./.github/workflows/test_template.yml - with: - modulepath: ${{ inputs.modulepath }} - tests-timeout: "30m" - go-version: "1.22.x" - tests-extra-args: ${{ inputs.tests-extra-args }} - secrets: - codecov-token: ${{ secrets.codecov-token }} + lint: + name: Go Lint + uses: ./.github/workflows/lint_template.yml + with: + modulepath: ${{ inputs.modulepath }} + go-version: ${{ inputs.go-version }} + build: + name: Go Build + uses: ./.github/workflows/build_template.yml + with: + modulepath: ${{ inputs.modulepath }} + go-version: ${{ inputs.go-version }} + test: + name: Go Test + uses: ./.github/workflows/test_template.yml + with: + modulepath: ${{ inputs.modulepath }} + tests-timeout: "30m" + go-version: ${{ inputs.go-version }} + tests-extra-args: ${{ inputs.tests-extra-args }} + secrets: + codecov-token: ${{ secrets.codecov-token }} diff --git a/.github/workflows/misc.yml b/.github/workflows/misc.yml index ad2c886e2ac..622c62d9a92 100644 --- a/.github/workflows/misc.yml +++ b/.github/workflows/misc.yml @@ -1,13 +1,15 @@ # tests the "misc" directory & tools # (not meant for miscellaneous workflows) -name: misc +name: misc CI Suite on: push: branches: - master - workflow_dispatch: pull_request: + paths: + - misc/** + workflow_dispatch: jobs: main: @@ -21,9 +23,11 @@ jobs: - genstd - goscan - loop - name: Run Main + name: Run misc suite uses: ./.github/workflows/main_template.yml with: modulepath: misc/${{ matrix.program }} + go-version: "1.22.x" + tests-extra-args: "-coverpkg=github.com/gnolang/gno/misc/..." secrets: codecov-token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/mod-tidy.yml b/.github/workflows/mod-tidy.yml index 24eab553d19..5b6401b0d13 100644 --- a/.github/workflows/mod-tidy.yml +++ b/.github/workflows/mod-tidy.yml @@ -1,11 +1,19 @@ -name: Ensure go.mods are tidied +name: go.mod Tidy Checker on: push: branches: - master - workflow_dispatch: + paths: + - '**/*.go' + - 'go.mod' + - 'go.sum' pull_request: + paths: + - '**/*.go' + - 'go.mod' + - 'go.sum' + workflow_dispatch: jobs: main: diff --git a/.github/workflows/portal-loop.yml b/.github/workflows/portal-loop.yml index b898a149e9d..478c5a8280c 100644 --- a/.github/workflows/portal-loop.yml +++ b/.github/workflows/portal-loop.yml @@ -1,19 +1,13 @@ -name: portal-loop +name: Portal Loop CI Suite on: - pull_request: - branches: - - master push: + branches: + - "master" + pull_request: paths: - "misc/loop/**" - ".github/workflows/portal-loop.yml" - branches: - - "master" - # NOTE(albttx): branch name to simplify tests for this workflow - - "ci/portal-loop" - tags: - - "v*" permissions: contents: read @@ -69,14 +63,14 @@ jobs: while block_height=$(curl -s localhost:26657/status | jq -r '.result.sync_info.latest_block_height') echo "Current block height: $block_height" - [[ "$block_height" -lt 10 ]] + [[ "$block_height" -lt 2 ]] do sleep 1 done curl -s localhost:26657/status | jq - - name: "Buid new gnolang/gno image" + - name: "Build new gnolang/gno image" run: | docker build -t ghcr.io/gnolang/gno/gnoland:master -f Dockerfile --target gnoland . @@ -96,7 +90,7 @@ jobs: while block_height=$(curl -s localhost:26657/status | jq -r '.result.sync_info.latest_block_height') echo "Current block height: $block_height" - [[ "$block_height" -lt 10 ]] + [[ "$block_height" -lt 2 ]] do sleep 5 done diff --git a/.github/workflows/releaser-master.yml b/.github/workflows/releaser-master.yml index 3d194e2cb4c..6e3eed31914 100644 --- a/.github/workflows/releaser-master.yml +++ b/.github/workflows/releaser-master.yml @@ -1,9 +1,9 @@ -name: Trigger master build +name: Master Releases on: push: branches: - - "master" + - master workflow_dispatch: permissions: diff --git a/.github/workflows/releaser-nightly.yml b/.github/workflows/releaser-nightly.yml index 4308f1c4a7d..4f6e636af1b 100644 --- a/.github/workflows/releaser-nightly.yml +++ b/.github/workflows/releaser-nightly.yml @@ -1,4 +1,4 @@ -name: Trigger nightly build +name: Nightly Releases on: schedule: diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml deleted file mode 100644 index 309664bdcce..00000000000 --- a/.github/workflows/releaser.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Go Releaser - -on: - push: - tags: - - "v*" - -permissions: - contents: write # needed to write releases - id-token: write # needed for keyless signing - packages: write # needed for ghcr access - -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - cache: true - - - uses: sigstore/cosign-installer@v3.7.0 - - uses: anchore/sbom-action/download-syft@v0.17.8 - - - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - uses: goreleaser/goreleaser-action@v6 - with: - distribution: goreleaser-pro - version: ~> v2 - args: release --clean --config ./.github/goreleaser.yaml - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} diff --git a/.github/workflows/stale-bot.yml b/.github/workflows/stale-bot.yml index 55a17ac60a8..6eb38ac5728 100644 --- a/.github/workflows/stale-bot.yml +++ b/.github/workflows/stale-bot.yml @@ -1,4 +1,4 @@ -name: "Close stale PRs" +name: Stale PR Bot on: schedule: - cron: "30 1 * * *" diff --git a/.github/workflows/test_template.yml b/.github/workflows/test_template.yml index c7956b4caf4..a1bc58ecebb 100644 --- a/.github/workflows/test_template.yml +++ b/.github/workflows/test_template.yml @@ -1,84 +1,70 @@ on: - workflow_call: - inputs: - modulepath: - required: true - type: string - tests-timeout: - required: true - type: string - go-version: - required: true - type: string - tests-extra-args: - required: false - type: string - secrets: - codecov-token: - required: true + workflow_call: + inputs: + modulepath: + required: true + type: string + tests-timeout: + required: true + type: string + go-version: + required: true + type: string + tests-extra-args: + required: false + type: string + secrets: + codecov-token: + required: true jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: ${{ inputs.go-version }} - - name: Go test - working-directory: ${{ inputs.modulepath }} - env: - TXTARCOVERDIR: /tmp/txtarcoverdir # txtar cover output - GOCOVERDIR: /tmp/gocoverdir # go cover output - COVERDIR: /tmp/coverdir # final output - run: | - set -x # print commands + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: ${{ inputs.go-version }} + - name: Go test + working-directory: ${{ inputs.modulepath }} + env: + TXTARCOVERDIR: /tmp/txtarcoverdir # txtar cover output + GOCOVERDIR: /tmp/gocoverdir # go cover output + COVERDIR: /tmp/coverdir # final output + run: | + set -x # print commands + + mkdir -p "$GOCOVERDIR" "$TXTARCOVERDIR" "$COVERDIR" + + # Craft a filter flag based on the module path to avoid expanding coverage on unrelated tags. + export filter="-pkg=github.com/gnolang/gno/${{ inputs.modulepath }}/..." + + # codecov only supports "boolean" coverage (whether a line is + # covered or not); so using -covermode=count or atomic would be + # pointless here. + # XXX: Simplify coverage of txtar - the current setup is a bit + # confusing and meticulous. There will be some improvements in Go + # 1.23 regarding coverage, so we can use this as a workaround until + # then. + go test -covermode=set -timeout ${{ inputs.tests-timeout }} ${{ inputs.tests-extra-args }} ./... -test.gocoverdir=$GOCOVERDIR + + # Print results + (set +x; echo 'go coverage results:') + go tool covdata percent $filter -i=$GOCOVERDIR + (set +x; echo 'txtar coverage results:') + go tool covdata percent $filter -i=$TXTARCOVERDIR + + # Generate final coverage output + go tool covdata textfmt -v 1 $filter -i=$GOCOVERDIR,$TXTARCOVERDIR -o gocoverage.out - mkdir -p "$GOCOVERDIR" "$TXTARCOVERDIR" "$COVERDIR" - - # Craft a filter flag based on the module path to avoid expanding coverage on unrelated tags. - export filter="-pkg=github.com/gnolang/gno/${{ inputs.modulepath }}/..." - - # codecov only supports "boolean" coverage (whether a line is - # covered or not); so using -covermode=count or atomic would be - # pointless here. - # XXX: Simplify coverage of txtar - the current setup is a bit - # confusing and meticulous. There will be some improvements in Go - # 1.23 regarding coverage, so we can use this as a workaround until - # then. - go test -covermode=set -timeout ${{ inputs.tests-timeout }} ${{ inputs.tests-extra-args }} ./... -test.gocoverdir=$GOCOVERDIR - - # Print results - (set +x; echo 'go coverage results:') - go tool covdata percent $filter -i=$GOCOVERDIR - (set +x; echo 'txtar coverage results:') - go tool covdata percent $filter -i=$TXTARCOVERDIR - - # Generate final coverage output - go tool covdata textfmt -v 1 $filter -i=$GOCOVERDIR,$TXTARCOVERDIR -o gocoverage.out - - - name: Upload go coverage to Codecov - uses: codecov/codecov-action@v5 - with: - disable_search: true - fail_ci_if_error: true - files: ${{ inputs.modulepath }}/gocoverage.out - flags: ${{ inputs.modulepath }} - token: ${{ secrets.codecov-token }} - verbose: true # keep this enable as it help debugging when coverage fail randomly on the CI - - # TODO: We have to fix race conditions before running this job - # test-with-race: - # runs-on: ubuntu-latest - # steps: - # - name: Install Go - # uses: actions/setup-go@v5 - # with: - # go-version: ${{ inputs.go-version }} - # - name: Checkout code - # uses: actions/checkout@v4 - # - name: Go race test - # run: go test -race -timeout ${{ inputs.tests-timeout }} ./... - # working-directory: ${{ inputs.modulepath }} + - name: Upload go coverage to Codecov + uses: codecov/codecov-action@v5 + with: + disable_search: true + fail_ci_if_error: true + files: ${{ inputs.modulepath }}/gocoverage.out + flags: ${{ inputs.modulepath }} + token: ${{ secrets.codecov-token }} + verbose: true # keep this enable as it help debugging when coverage fails randomly on the CI diff --git a/.github/workflows/tm2.yml b/.github/workflows/tm2.yml index 57e84793c94..995b98eea9e 100644 --- a/.github/workflows/tm2.yml +++ b/.github/workflows/tm2.yml @@ -1,17 +1,21 @@ -name: tm2 +name: TM2 CI Suite on: push: branches: - master - workflow_dispatch: pull_request: + paths: + - tm2/** + workflow_dispatch: jobs: main: - name: Run Main + name: Run TM2 suite uses: ./.github/workflows/main_template.yml with: modulepath: "tm2" + go-version: "1.22.x" + tests-extra-args: "-coverpkg=github.com/gnolang/gno/tm2/..." secrets: codecov-token: ${{ secrets.CODECOV_TOKEN }} diff --git a/gno.land/cmd/gnoland/integration_test.go b/gno.land/cmd/gnoland/integration_test.go deleted file mode 100644 index 37451df9704..00000000000 --- a/gno.land/cmd/gnoland/integration_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package main - -import ( - "testing" - - "github.com/gnolang/gno/gno.land/pkg/integration" -) - -func TestTestdata(t *testing.T) { - integration.RunGnolandTestscripts(t, "testdata") -} diff --git a/gno.land/cmd/gnoland/testdata/addpkg.txtar b/gno.land/pkg/integration/testdata/addpkg.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/addpkg.txtar rename to gno.land/pkg/integration/testdata/addpkg.txtar diff --git a/gno.land/cmd/gnoland/testdata/addpkg_domain.txtar b/gno.land/pkg/integration/testdata/addpkg_domain.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/addpkg_domain.txtar rename to gno.land/pkg/integration/testdata/addpkg_domain.txtar diff --git a/gno.land/cmd/gnoland/testdata/addpkg_invalid.txtar b/gno.land/pkg/integration/testdata/addpkg_invalid.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/addpkg_invalid.txtar rename to gno.land/pkg/integration/testdata/addpkg_invalid.txtar diff --git a/gno.land/cmd/gnoland/testdata/addpkg_namespace.txtar b/gno.land/pkg/integration/testdata/addpkg_namespace.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/addpkg_namespace.txtar rename to gno.land/pkg/integration/testdata/addpkg_namespace.txtar diff --git a/gno.land/cmd/gnoland/testdata/alloc_array.txtar b/gno.land/pkg/integration/testdata/alloc_array.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/alloc_array.txtar rename to gno.land/pkg/integration/testdata/alloc_array.txtar diff --git a/gno.land/cmd/gnoland/testdata/alloc_byte_slice.txtar b/gno.land/pkg/integration/testdata/alloc_byte_slice.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/alloc_byte_slice.txtar rename to gno.land/pkg/integration/testdata/alloc_byte_slice.txtar diff --git a/gno.land/cmd/gnoland/testdata/alloc_slice.txtar b/gno.land/pkg/integration/testdata/alloc_slice.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/alloc_slice.txtar rename to gno.land/pkg/integration/testdata/alloc_slice.txtar diff --git a/gno.land/cmd/gnoland/testdata/append.txtar b/gno.land/pkg/integration/testdata/append.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/append.txtar rename to gno.land/pkg/integration/testdata/append.txtar diff --git a/gno.land/cmd/gnoland/testdata/assertorigincall.txtar b/gno.land/pkg/integration/testdata/assertorigincall.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/assertorigincall.txtar rename to gno.land/pkg/integration/testdata/assertorigincall.txtar diff --git a/gno.land/cmd/gnoland/testdata/event_callback.txtar b/gno.land/pkg/integration/testdata/event_callback.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/event_callback.txtar rename to gno.land/pkg/integration/testdata/event_callback.txtar diff --git a/gno.land/cmd/gnoland/testdata/event_defer_callback_loop.txtar b/gno.land/pkg/integration/testdata/event_defer_callback_loop.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/event_defer_callback_loop.txtar rename to gno.land/pkg/integration/testdata/event_defer_callback_loop.txtar diff --git a/gno.land/cmd/gnoland/testdata/event_for_statement.txtar b/gno.land/pkg/integration/testdata/event_for_statement.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/event_for_statement.txtar rename to gno.land/pkg/integration/testdata/event_for_statement.txtar diff --git a/gno.land/cmd/gnoland/testdata/event_multi_msg.txtar b/gno.land/pkg/integration/testdata/event_multi_msg.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/event_multi_msg.txtar rename to gno.land/pkg/integration/testdata/event_multi_msg.txtar diff --git a/gno.land/cmd/gnoland/testdata/event_normal.txtar b/gno.land/pkg/integration/testdata/event_normal.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/event_normal.txtar rename to gno.land/pkg/integration/testdata/event_normal.txtar diff --git a/gno.land/cmd/gnoland/testdata/float_arg.txtar b/gno.land/pkg/integration/testdata/float_arg.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/float_arg.txtar rename to gno.land/pkg/integration/testdata/float_arg.txtar diff --git a/gno.land/cmd/gnoland/testdata/genesis_params.txtar b/gno.land/pkg/integration/testdata/genesis_params.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/genesis_params.txtar rename to gno.land/pkg/integration/testdata/genesis_params.txtar diff --git a/gno.land/cmd/gnoland/testdata/ghverify.txtar b/gno.land/pkg/integration/testdata/ghverify.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/ghverify.txtar rename to gno.land/pkg/integration/testdata/ghverify.txtar diff --git a/gno.land/cmd/gnoland/testdata/gnokey_simulate.txtar b/gno.land/pkg/integration/testdata/gnokey_simulate.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/gnokey_simulate.txtar rename to gno.land/pkg/integration/testdata/gnokey_simulate.txtar diff --git a/gno.land/cmd/gnoland/testdata/gnoweb_airgapped.txtar b/gno.land/pkg/integration/testdata/gnoweb_airgapped.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/gnoweb_airgapped.txtar rename to gno.land/pkg/integration/testdata/gnoweb_airgapped.txtar diff --git a/gno.land/cmd/gnoland/testdata/grc20_invalid_address.txtar b/gno.land/pkg/integration/testdata/grc20_invalid_address.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/grc20_invalid_address.txtar rename to gno.land/pkg/integration/testdata/grc20_invalid_address.txtar diff --git a/gno.land/cmd/gnoland/testdata/grc20_registry.txtar b/gno.land/pkg/integration/testdata/grc20_registry.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/grc20_registry.txtar rename to gno.land/pkg/integration/testdata/grc20_registry.txtar diff --git a/gno.land/cmd/gnoland/testdata/grc721_emit.txtar b/gno.land/pkg/integration/testdata/grc721_emit.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/grc721_emit.txtar rename to gno.land/pkg/integration/testdata/grc721_emit.txtar diff --git a/gno.land/cmd/gnoland/testdata/initctx.txtar b/gno.land/pkg/integration/testdata/initctx.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/initctx.txtar rename to gno.land/pkg/integration/testdata/initctx.txtar diff --git a/gno.land/cmd/gnoland/testdata/issue_1167.txtar b/gno.land/pkg/integration/testdata/issue_1167.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/issue_1167.txtar rename to gno.land/pkg/integration/testdata/issue_1167.txtar diff --git a/gno.land/cmd/gnoland/testdata/issue_1588.txtar b/gno.land/pkg/integration/testdata/issue_1588.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/issue_1588.txtar rename to gno.land/pkg/integration/testdata/issue_1588.txtar diff --git a/gno.land/cmd/gnoland/testdata/issue_1786.txtar b/gno.land/pkg/integration/testdata/issue_1786.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/issue_1786.txtar rename to gno.land/pkg/integration/testdata/issue_1786.txtar diff --git a/gno.land/cmd/gnoland/testdata/issue_2283.txtar b/gno.land/pkg/integration/testdata/issue_2283.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/issue_2283.txtar rename to gno.land/pkg/integration/testdata/issue_2283.txtar diff --git a/gno.land/cmd/gnoland/testdata/issue_2283_cacheTypes.txtar b/gno.land/pkg/integration/testdata/issue_2283_cacheTypes.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/issue_2283_cacheTypes.txtar rename to gno.land/pkg/integration/testdata/issue_2283_cacheTypes.txtar diff --git a/gno.land/cmd/gnoland/testdata/issue_gnochess_97.txtar b/gno.land/pkg/integration/testdata/issue_gnochess_97.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/issue_gnochess_97.txtar rename to gno.land/pkg/integration/testdata/issue_gnochess_97.txtar diff --git a/gno.land/cmd/gnoland/testdata/maketx_call_pure.txtar b/gno.land/pkg/integration/testdata/maketx_call_pure.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/maketx_call_pure.txtar rename to gno.land/pkg/integration/testdata/maketx_call_pure.txtar diff --git a/gno.land/cmd/gnoland/testdata/map_delete.txtar b/gno.land/pkg/integration/testdata/map_delete.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/map_delete.txtar rename to gno.land/pkg/integration/testdata/map_delete.txtar diff --git a/gno.land/cmd/gnoland/testdata/map_storage.txtar b/gno.land/pkg/integration/testdata/map_storage.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/map_storage.txtar rename to gno.land/pkg/integration/testdata/map_storage.txtar diff --git a/gno.land/cmd/gnoland/testdata/panic.txtar b/gno.land/pkg/integration/testdata/panic.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/panic.txtar rename to gno.land/pkg/integration/testdata/panic.txtar diff --git a/gno.land/cmd/gnoland/testdata/params.txtar b/gno.land/pkg/integration/testdata/params.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/params.txtar rename to gno.land/pkg/integration/testdata/params.txtar diff --git a/gno.land/cmd/gnoland/testdata/prevrealm.txtar b/gno.land/pkg/integration/testdata/prevrealm.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/prevrealm.txtar rename to gno.land/pkg/integration/testdata/prevrealm.txtar diff --git a/gno.land/cmd/gnoland/testdata/realm_banker_issued_coin_denom.txtar b/gno.land/pkg/integration/testdata/realm_banker_issued_coin_denom.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/realm_banker_issued_coin_denom.txtar rename to gno.land/pkg/integration/testdata/realm_banker_issued_coin_denom.txtar diff --git a/gno.land/cmd/gnoland/testdata/restart_missing_type.txtar b/gno.land/pkg/integration/testdata/restart_missing_type.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/restart_missing_type.txtar rename to gno.land/pkg/integration/testdata/restart_missing_type.txtar diff --git a/gno.land/cmd/gnoland/testdata/restart_nonval.txtar b/gno.land/pkg/integration/testdata/restart_nonval.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/restart_nonval.txtar rename to gno.land/pkg/integration/testdata/restart_nonval.txtar diff --git a/gno.land/cmd/gnoland/testdata/run.txtar b/gno.land/pkg/integration/testdata/run.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/run.txtar rename to gno.land/pkg/integration/testdata/run.txtar diff --git a/gno.land/cmd/gnoland/testdata/simulate_gas.txtar b/gno.land/pkg/integration/testdata/simulate_gas.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/simulate_gas.txtar rename to gno.land/pkg/integration/testdata/simulate_gas.txtar diff --git a/gno.land/cmd/gnoland/testdata/time_simple.txtar b/gno.land/pkg/integration/testdata/time_simple.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/time_simple.txtar rename to gno.land/pkg/integration/testdata/time_simple.txtar diff --git a/gno.land/cmd/gnoland/testdata/wugnot.txtar b/gno.land/pkg/integration/testdata/wugnot.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/wugnot.txtar rename to gno.land/pkg/integration/testdata/wugnot.txtar