Skip to content

Commit

Permalink
fix: filter txtar output by modulepath
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Jul 23, 2024
1 parent 01050f1 commit 67be832
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/test_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,23 @@ jobs:
mkdir -p "$GOCOVERDIR" "$TXTARCOVERDIR" "$COVERDIR"
# filter by modulepath
export filter="-pkg=github.com/gnolang/gno/${{ inputs.modulepath }}/..."
# 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=atomic -timeout ${{ inputs.tests-timeout }} -v ./... -test.gocoverdir=$GOCOVERDIR
# Print results
(set +x; echo 'go coverage results:')
go tool covdata percent -i=$GOCOVERDIR
go tool covdata percent $filter -i=$GOCOVERDIR
(set +x; echo 'txtar coverage results:')
go tool covdata percent -i=$TXTARCOVERDIR
go tool covdata percent $filter -i=$TXTARCOVERDIR
# Generate final coverage output
go tool covdata textfmt -v 1 -i=$GOCOVERDIR -o gocoverage.out
go tool covdata textfmt -v 1 -i=$TXTARCOVERDIR -o txtarcoverage.out
go tool covdata textfmt -v 1 $filter -i=$GOCOVERDIR,$TXTARCOVERDIR -o gocoverage.out
# go tool covdata textfmt -v 1 $filter -i=$TXTARCOVERDIR -o txtarcoverage.out
- name: Upload go coverage to Codecov
uses: codecov/codecov-action@v4
Expand All @@ -60,15 +63,15 @@ jobs:
token: ${{ secrets.codecov-token }}
verbose: true

- name: Upload txtar coverage to Codecov
uses: codecov/codecov-action@v4
with:
disable_search: true
fail_ci_if_error: true
file: ${{ inputs.modulepath }}/txtarcoverage.out
flags: ${{ inputs.modulepath }}/txtar
token: ${{ secrets.codecov-token }}
verbose: true
# - name: Upload txtar coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# disable_search: true
# fail_ci_if_error: true
# file: ${{ inputs.modulepath }}/txtarcoverage.out
# flags: ${{ inputs.modulepath }}
# token: ${{ secrets.codecov-token }}
# verbose: true

# TODO: We have to fix race conditions before running this job
# test-with-race:
Expand Down

0 comments on commit 67be832

Please sign in to comment.