ci: use coverpkg for accurate reporting of pkg/gnolang #1815
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: gnovm | |
on: | |
pull_request: | |
paths: | |
- "go.sum" | |
- "gnovm/**.go" | |
- "gnovm/**.gno" | |
- "examples/**.gno" | |
- "gnovm/**/go.sum" | |
- "gnovm/Makefile" | |
- "tm2/**.go" | |
- ".github/workflows/gnovm.yml" | |
# Until the codecov issue is resolved, it's essential to run the tests for gnovm, tm2, and gno.land concurrently. | |
- "gnovm/**" | |
- "tm2/**" | |
- "gno.land/**" | |
- "examples/**" | |
- ".github/workflows/**" | |
push: | |
branches: [ "master" ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
goversion: # two latest versions | |
- "1.20.x" | |
- "1.21.x" | |
goenv: # TODO: replace with pairs, so it's easier to read in the GH interface. | |
- "GOARCH=amd64 GOOS=linux" | |
- "GOARCH=wasm GOOS=js" | |
program: | |
- "gno" | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.goversion }} | |
- name: go install | |
working-directory: gnovm | |
run: ${{ matrix.goenv }} go install ./cmd/${{ matrix.program }} | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
goversion: | |
- "1.20.x" | |
- "1.21.x" | |
args: | |
- _test.cmd | |
- _test.pkg | |
- _test.gnolang.native | |
- _test.gnolang.stdlibs | |
- _test.gnolang.realm | |
- _test.gnolang.pkg0 | |
- _test.gnolang.pkg1 | |
- _test.gnolang.pkg2 | |
- _test.gnolang.other | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.goversion }} | |
- name: test | |
working-directory: gnovm | |
run: | | |
export GOPATH=$HOME/go | |
export GOTEST_FLAGS="-v -p 1 -timeout=30m -coverprofile=coverage.out -covermode=atomic" | |
# prefix check | |
case "${{ matrix.args }}" in _test.gnolang*) | |
GOTEST_FLAGS="$GOTEST_FLAGS -coverpkg github.com/gnolang/gno/gnovm/tests,github.com/gnolang/gno/gnovm/pkg/gnolang" | |
esac | |
make ${{ matrix.args }} | |
- uses: actions/upload-artifact@v3 | |
if: ${{ runner.os == 'Linux' && matrix.goversion == '1.21.x' }} | |
with: | |
name: ${{ runner.os }}-coverage-gnovm-${{ matrix.args }}-${{ matrix.goversion }} | |
path: ./gnovm/coverage.out | |
upload-coverage: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download all previous coverage artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ${{ runner.temp }}/coverage | |
- name: Upload combined coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: ${{ runner.temp }}/coverage | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: ${{ github.repository == 'gnolang/gno' }} | |