feat(gnolang): increase test coverage from 33% to 70% #4788
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: gno.land | |
on: | |
pull_request: | |
paths: | |
# XXX: for now keep the paths for gnovm, tm2, gnoland and misc the same, | |
# so that coverage information is uploaded for all of them together. | |
# This could be removed in the future. | |
- "gnovm/**" | |
- "tm2/**" | |
- "gno.land/**" | |
- "misc/**" | |
- "examples/**" | |
- ".github/workflows/**" | |
# XXX: end copied part, below is the "ideal" paths on which this workflow should run | |
- "go.sum" | |
- "gnovm/**.go" | |
- "gnovm/**.gno" | |
- "tm2/**.go" | |
- "gno.land/**" | |
- ".github/workflows/gnoland.yml" | |
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: | |
- "1.21.x" | |
- "1.22.x" | |
goarch: [ "amd64" ] | |
goos: [ "linux" ] | |
program: | |
- gnoland | |
- gnokey | |
- gnoweb | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.goversion }} | |
- name: go install | |
working-directory: gno.land | |
run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go install ./cmd/${{ matrix.program }} | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
goversion: | |
- "1.21.x" | |
- "1.22.x" | |
args: | |
- _test.gnoland | |
- _test.gnokey | |
- _test.pkgs | |
- _test.gnoweb | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.goversion }} | |
- name: Set environment variables for debug mode | |
if: ${{ runner.debug == 1 }} | |
run: | | |
export LOG_PATH_DIR=${{ runner.temp }}/logs-go${{ matrix.goversion }}-${{ matrix.args }} | |
mkdir -p $LOG_PATH_DIR | |
echo "LOG_LEVEL=debug" >> $GITHUB_ENV | |
echo "LOG_PATH_DIR=$LOG_PATH_DIR" >> $GITHUB_ENV | |
- name: test | |
working-directory: gno.land | |
run: | | |
export GOPATH=$HOME/go | |
export GOTEST_FLAGS="-v -p 1 -timeout=30m -coverprofile=coverage.out -covermode=atomic" | |
make ${{ matrix.args }} | |
- uses: actions/upload-artifact@v4 | |
if: ${{ runner.os == 'Linux' && matrix.goversion == '1.22.x' }} | |
with: | |
name: ${{runner.os}}-coverage-gnoland-${{ matrix.args}}-${{matrix.goversion}} | |
path: ./gno.land/coverage.out | |
- name: Upload Debug Logs | |
uses: actions/upload-artifact@v4 | |
if: ${{ always() && runner.debug == 1 }} | |
with: | |
name: logs-test-go${{ matrix.goversion }}-${{ matrix.args }} | |
path: ${{ env.LOG_PATH_DIR }}/**/* | |
upload-coverage: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download all previous coverage artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ${{ runner.temp }}/coverage | |
- name: Upload combined coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
directory: ${{ runner.temp }}/coverage | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: ${{ github.repository == 'gnolang/gno' }} | |
docker-integration: | |
strategy: | |
fail-fast: false | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.x | |
# TODO: setup docker caching | |
- run: make test.docker | |
- run: docker logs int_gnoland || true | |
# TODO: docker-less integration test? |