mirror of
https://github.com/lightninglabs/aperture.git
synced 2025-12-17 17:14:19 +01:00
ci: run unit tests against sqlite and postgres
This commit is contained in:
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -99,6 +99,8 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
unit_type:
|
unit_type:
|
||||||
- unit-race
|
- unit-race
|
||||||
|
- unit-race dbbackend=postgres
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: git checkout
|
- name: git checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
TEST_FLAGS =
|
TEST_FLAGS =
|
||||||
COVER_PKG = $$(go list -deps ./... | grep '$(PKG)')
|
DEV_TAGS = dev
|
||||||
|
COVER_PKG = $$(go list -deps -tags="$(DEV_TAGS)" ./... | grep '$(PKG)' | grep -v lnrpc)
|
||||||
|
GOLIST := go list -tags="$(DEV_TAGS)" -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/'
|
||||||
|
|
||||||
# If specific package is being unit tested, construct the full name of the
|
# If specific package is being unit tested, construct the full name of the
|
||||||
# subpackage.
|
# subpackage.
|
||||||
@@ -23,6 +25,16 @@ else
|
|||||||
TEST_FLAGS += -test.timeout=20m
|
TEST_FLAGS += -test.timeout=20m
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# If we are targetting postgres make sure our tests have the tags.
|
||||||
|
ifeq ($(dbbackend),postgres)
|
||||||
|
DEV_TAGS += test_db_postgres
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Add any additional tags to the dev tags list.
|
||||||
|
ifneq ($(tags),)
|
||||||
|
DEV_TAGS += ${tags}
|
||||||
|
endif
|
||||||
|
|
||||||
# UNIT_TARGTED is undefined iff a specific package and/or unit test case is
|
# UNIT_TARGTED is undefined iff a specific package and/or unit test case is
|
||||||
# not being targeted.
|
# not being targeted.
|
||||||
UNIT_TARGETED ?= no
|
UNIT_TARGETED ?= no
|
||||||
@@ -30,11 +42,11 @@ UNIT_TARGETED ?= no
|
|||||||
# If a specific package/test case was requested, run the unit test for the
|
# If a specific package/test case was requested, run the unit test for the
|
||||||
# targeted case. Otherwise, default to running all tests.
|
# targeted case. Otherwise, default to running all tests.
|
||||||
ifeq ($(UNIT_TARGETED), yes)
|
ifeq ($(UNIT_TARGETED), yes)
|
||||||
UNIT := $(GOTEST) $(TEST_FLAGS) $(UNITPKG)
|
UNIT := $(GOTEST) -tags="$(DEV_TAGS)" $(TEST_FLAGS) $(UNITPKG)
|
||||||
UNIT_RACE := $(GOTEST) $(TEST_FLAGS) -race $(UNITPKG)
|
UNIT_RACE := $(GOTEST) -tags="$(DEV_TAGS)" $(TEST_FLAGS) -race $(UNITPKG)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(UNIT_TARGETED), no)
|
ifeq ($(UNIT_TARGETED), no)
|
||||||
UNIT := $(GOLIST) | $(XARGS) env $(GOTEST) $(TEST_FLAGS)
|
UNIT := $(GOLIST) | $(XARGS) env $(GOTEST) -tags="$(DEV_TAGS)" $(TEST_FLAGS)
|
||||||
UNIT_RACE := $(UNIT) -race
|
UNIT_RACE := $(GOLIST) | $(XARGS) env $(GOTEST) -tags="$(DEV_TAGS)" -race $(TEST_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user