Skip to content

Commit

Permalink
Merge branch 'master' into fix-invalid-deposit-error
Browse files Browse the repository at this point in the history
  • Loading branch information
linhpn99 authored Jul 29, 2024
2 parents ff3ad23 + bf61069 commit 8326a7e
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions .github/workflows/test_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,44 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Go test
run: go test -coverprofile coverage.out -covermode=atomic -timeout ${{ inputs.tests-timeout }} -v ./...
working-directory: ${{ inputs.modulepath }}
- name: Upload coverage to Codecov
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 }}/..."
# 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 $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@v4
with:
token: ${{ secrets.codecov-token }}
verbose: true
fail_ci_if_error: true
flags: ${{ inputs.modulepath }}
disable_search: true
fail_ci_if_error: true
file: ${{ 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
Expand Down

0 comments on commit 8326a7e

Please sign in to comment.