Skip to content

Commit 33d53b2

Browse files
committed
ci: run unit tests against sqlite and postgres
1 parent bf96592 commit 33d53b2

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ jobs:
9999
matrix:
100100
unit_type:
101101
- unit-race
102+
- unit-race dbbackend=postgres
103+
102104
steps:
103105
- name: git checkout
104106
uses: actions/checkout@v2

make/testing_flags.mk

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
TEST_FLAGS =
2-
COVER_PKG = $$(go list -deps ./... | grep '$(PKG)')
2+
DEV_TAGS = dev
3+
COVER_PKG = $$(go list -deps -tags="$(DEV_TAGS)" ./... | grep '$(PKG)' | grep -v lnrpc)
4+
GOLIST := go list -tags="$(DEV_TAGS)" -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/'
35

46
# If specific package is being unit tested, construct the full name of the
57
# subpackage.
@@ -23,18 +25,28 @@ else
2325
TEST_FLAGS += -test.timeout=20m
2426
endif
2527

28+
# If we are targetting postgres make sure our tests have the tags.
29+
ifeq ($(dbbackend),postgres)
30+
DEV_TAGS += test_db_postgres
31+
endif
32+
33+
# Add any additional tags to the dev tags list.
34+
ifneq ($(tags),)
35+
DEV_TAGS += ${tags}
36+
endif
37+
2638
# UNIT_TARGTED is undefined iff a specific package and/or unit test case is
2739
# not being targeted.
2840
UNIT_TARGETED ?= no
2941

3042
# If a specific package/test case was requested, run the unit test for the
3143
# targeted case. Otherwise, default to running all tests.
3244
ifeq ($(UNIT_TARGETED), yes)
33-
UNIT := $(GOTEST) $(TEST_FLAGS) $(UNITPKG)
34-
UNIT_RACE := $(GOTEST) $(TEST_FLAGS) -race $(UNITPKG)
45+
UNIT := $(GOTEST) -tags="$(DEV_TAGS)" $(TEST_FLAGS) $(UNITPKG)
46+
UNIT_RACE := $(GOTEST) -tags="$(DEV_TAGS)" $(TEST_FLAGS) -race $(UNITPKG)
3547
endif
3648

3749
ifeq ($(UNIT_TARGETED), no)
38-
UNIT := $(GOLIST) | $(XARGS) env $(GOTEST) $(TEST_FLAGS)
39-
UNIT_RACE := $(UNIT) -race
50+
UNIT := $(GOLIST) | $(XARGS) env $(GOTEST) -tags="$(DEV_TAGS)" $(TEST_FLAGS)
51+
UNIT_RACE := $(GOLIST) | $(XARGS) env $(GOTEST) -tags="$(DEV_TAGS)" -race $(TEST_FLAGS)
4052
endif

0 commit comments

Comments
 (0)