Skip to content
Draft
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
22 changes: 19 additions & 3 deletions .github/workflows/_ci-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}

Expand Down Expand Up @@ -85,14 +90,25 @@ 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 }}
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}/..."
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ci-dir-gnovm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading