Skip to content

Commit

Permalink
ci: add cli_test and race unittest in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
zemyblue committed Jun 10, 2023
1 parent 3d60d3d commit ac4d3f9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
with:
go-version: 1.18
- name: Display go version
run: go version
- name: Check if difference
uses: technote-space/[email protected]
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:
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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' ./...
Expand All @@ -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=. ./...

Expand Down
4 changes: 2 additions & 2 deletions x/wasm/client/testutil/cli_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build norace
// +build norace
//go:build cli_test
// +build cli_test

package testutil

Expand Down
4 changes: 2 additions & 2 deletions x/wasmplus/client/testutil/cli_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build norace
// +build norace
//go:build cli_test
// +build cli_test

package testutil

Expand Down

0 comments on commit ac4d3f9

Please sign in to comment.