From ac4d3f97928f5b22fc959029780582f4e1da8d62 Mon Sep 17 00:00:00 2001 From: zemyblue Date: Sat, 10 Jun 2023 17:15:34 +0900 Subject: [PATCH] ci: add cli_test and race unittest in ci --- .github/workflows/test.yml | 31 ++++++++++++++++++++++++++ Makefile | 5 ++++- x/wasm/client/testutil/cli_test.go | 4 ++-- x/wasmplus/client/testutil/cli_test.go | 4 ++-- 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 522cbf4b4f..6faba11746 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,6 +15,37 @@ jobs: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'" + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3.5.0 + with: + go-version: 1.18 + - name: Display go version + run: go version + - name: Check if difference + uses: technote-space/get-diff-action@v6.1.2 + id: git_diff + with: + PATTERNS: | + **/**.go + go.mod + go.sum + .github/workflows/test.yml + - name: Build + run: make build + if: env.GIT_DIFF + - name: Test + run: make test + if: env.GIT_DIFF + - name: Test race + run: make test-race + if: env.GIT_DIFF + - name: Test integration + run: make test-integration + if: env.GIT_DIFF + test-cover: runs-on: ubuntu-latest steps: diff --git a/Makefile b/Makefile index 04d2431e43..3da906be4d 100644 --- a/Makefile +++ b/Makefile @@ -122,7 +122,7 @@ distclean: clean test: test-unit -test-all: check test-race test-cover +test-all: test-race test-cover test-integration test-unit: @VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock' ./... @@ -133,6 +133,9 @@ test-race: test-cover: @go test -mod=readonly -timeout 30m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' ./... +test-integration: + @go test -mod=readonly -tags="cli_test" ./.../testutil/... + benchmark: @go test -mod=readonly -bench=. ./... diff --git a/x/wasm/client/testutil/cli_test.go b/x/wasm/client/testutil/cli_test.go index 91cf8dd7c4..66814e75c1 100644 --- a/x/wasm/client/testutil/cli_test.go +++ b/x/wasm/client/testutil/cli_test.go @@ -1,5 +1,5 @@ -//go:build norace -// +build norace +//go:build cli_test +// +build cli_test package testutil diff --git a/x/wasmplus/client/testutil/cli_test.go b/x/wasmplus/client/testutil/cli_test.go index 26b6f4feae..dde213c4d9 100644 --- a/x/wasmplus/client/testutil/cli_test.go +++ b/x/wasmplus/client/testutil/cli_test.go @@ -1,5 +1,5 @@ -//go:build norace -// +build norace +//go:build cli_test +// +build cli_test package testutil