From bd3c3cf7075c00441e599e2e9ba6bd357cd42247 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Thu, 11 Jun 2026 15:49:04 +0200 Subject: [PATCH 1/2] ci(gnovm): skip print-only coverage instrumentation Since #5795 the per-module coverage percentages are only printed to the job log; nothing uploads or tracks them. The instrumentation costs a measured ~1.24x on the gnovm interpreter-heavy tests (TestStdlibs/sort: 22.1s -> 27.5s) plus an instrumented rebuild of every package. Add a 'coverage' input to the reusable Go CI workflow (default true, so gno.land/tm2/misc/contribs keep their current behavior) and opt gnovm out of it. --- .github/workflows/_ci-go.yml | 13 +++++++++++++ .github/workflows/ci-dir-gnovm.yml | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_ci-go.yml b/.github/workflows/_ci-go.yml index 89c9b0727fb..18ad964fd58 100644 --- a/.github/workflows/_ci-go.yml +++ b/.github/workflows/_ci-go.yml @@ -16,6 +16,11 @@ on: required: false type: string default: "" + coverage: + description: "Collect coverage and print per-module percentages (the data is not uploaded anywhere; see #5795). Instrumentation slows interpreter-heavy tests measurably." + required: false + type: boolean + default: true permissions: {} @@ -90,9 +95,17 @@ jobs: COVERDIR: /tmp/coverdir INPUTS_MODULEPATH: ${{ inputs.modulepath }} INPUTS_TESTS_EXTRA_ARGS: ${{ inputs.tests-extra-args }} + INPUTS_COVERAGE: ${{ inputs.coverage }} run: | set -x + if [ "$INPUTS_COVERAGE" != "true" ]; then + # INPUTS_TESTS_EXTRA_ARGS must word-split into flags + # shellcheck disable=SC2086 + go test -timeout 30m ${INPUTS_TESTS_EXTRA_ARGS} ./... + exit 0 + fi + mkdir -p "$GOCOVERDIR" "$TXTARCOVERDIR" "$COVERDIR" export filter="-pkg=github.com/gnolang/gno/${INPUTS_MODULEPATH}/..." diff --git a/.github/workflows/ci-dir-gnovm.yml b/.github/workflows/ci-dir-gnovm.yml index 4557414c43e..299dd26008a 100644 --- a/.github/workflows/ci-dir-gnovm.yml +++ b/.github/workflows/ci-dir-gnovm.yml @@ -23,7 +23,10 @@ jobs: uses: ./.github/workflows/_ci-go.yml with: modulepath: "gnovm" - tests-extra-args: "-coverpkg=github.com/gnolang/gno/gnovm/..." + # Coverage instrumentation costs ~1.24x on the interpreter-heavy + # tests, and since #5795 the percentages are only printed to the + # job log; skip it on gnovm's critical path. + coverage: false stdlibs: uses: ./.github/workflows/_ci-gno.yml with: From 56decad2ff3d52b01f4fd8fd80d74c5f6e4ced62 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Thu, 11 Jun 2026 16:03:52 +0200 Subject: [PATCH 2/2] ci: leave coverage env vars unset when coverage is off The coverage dir env vars (TXTARCOVERDIR, GOCOVERDIR, COVERDIR) also steer testscript-based suites: cmd/gno's Test_Scripts fails when TXTARCOVERDIR points at a directory that was never created. With coverage off, leave them empty so those suites skip coverage collection, matching a plain local run. --- .github/workflows/_ci-go.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/_ci-go.yml b/.github/workflows/_ci-go.yml index 18ad964fd58..a775e52ee6b 100644 --- a/.github/workflows/_ci-go.yml +++ b/.github/workflows/_ci-go.yml @@ -90,9 +90,12 @@ jobs: working-directory: ${{ inputs.modulepath }} env: SEQ_TS: ${{ inputs.tests-ts-seq }} - TXTARCOVERDIR: /tmp/txtarcoverdir - GOCOVERDIR: /tmp/gocoverdir - COVERDIR: /tmp/coverdir + # The coverage dir env vars also steer testscript-based suites + # (cmd/gno, gno.land integration): leave them unset without + # coverage so those suites skip coverage collection too. + TXTARCOVERDIR: ${{ inputs.coverage && '/tmp/txtarcoverdir' || '' }} + GOCOVERDIR: ${{ inputs.coverage && '/tmp/gocoverdir' || '' }} + COVERDIR: ${{ inputs.coverage && '/tmp/coverdir' || '' }} INPUTS_MODULEPATH: ${{ inputs.modulepath }} INPUTS_TESTS_EXTRA_ARGS: ${{ inputs.tests-extra-args }} INPUTS_COVERAGE: ${{ inputs.coverage }}