Skip to content

Commit 6238e65

Browse files
committed
make+GitHub: collect coverage for itests
1 parent 6e4fb28 commit 6238e65

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

.github/workflows/main.yaml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ jobs:
252252
uses: ./.github/actions/setup-go
253253

254254
- name: run itest
255-
run: make itest
255+
run: make itest cover=1
256256

257257
- name: Zip log files on failure
258258
if: ${{ failure() }}
@@ -266,6 +266,15 @@ jobs:
266266
path: logs-itest.zip
267267
retention-days: 5
268268

269+
- name: Send coverage
270+
uses: shogo82148/actions-goveralls@v1
271+
if: ${{ success() }}
272+
continue-on-error: true
273+
with:
274+
path-to-profile: itest/coverage.txt
275+
flag-name: 'itest'
276+
parallel: true
277+
269278
########################
270279
# run integration tests with Postgres backend
271280
########################
@@ -280,7 +289,7 @@ jobs:
280289
uses: ./.github/actions/setup-go
281290

282291
- name: run itest
283-
run: make itest dbbackend=postgres
292+
run: make itest dbbackend=postgres cover=1
284293

285294
- name: Zip log files on failure
286295
if: ${{ failure() }}
@@ -294,6 +303,15 @@ jobs:
294303
path: logs-itest-postgres.zip
295304
retention-days: 5
296305

306+
- name: Send coverage
307+
uses: shogo82148/actions-goveralls@v1
308+
if: ${{ success() }}
309+
continue-on-error: true
310+
with:
311+
path-to-profile: itest/coverage.txt
312+
flag-name: 'itest'
313+
parallel: true
314+
297315
########################
298316
# Run LiTd tests
299317
########################

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ itest-trace: build-itest itest-only-trace
203203
itest-only: aperture-dir
204204
@$(call print, "Running integration tests with ${backend} backend.")
205205
rm -rf itest/regtest; date
206-
$(GOTEST) ./itest -v -tags="$(ITEST_TAGS)" $(TEST_FLAGS) $(ITEST_FLAGS) -btcdexec=./btcd-itest -logdir=regtest
206+
$(GOTEST) ./itest -v $(ITEST_COVERAGE) -tags="$(ITEST_TAGS)" $(TEST_FLAGS) $(ITEST_FLAGS) -btcdexec=./btcd-itest -logdir=regtest
207207

208208
itest-only-trace: aperture-dir
209209
@$(call print, "Running integration tests with ${backend} backend.")

make/testing_flags.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ RPC_TAGS = autopilotrpc chainrpc invoicesrpc peersrpc routerrpc signrpc verrpc w
44
LOG_TAGS =
55
TEST_FLAGS =
66
ITEST_FLAGS = -logoutput
7+
ITEST_COVERAGE =
78
COVER_PKG = $$(go list -deps -tags="$(DEV_TAGS)" ./... | grep '$(PKG)' | grep -v taprpc)
89
COVER_HTML = go tool cover -html=coverage.txt -o coverage.html
910
POSTGRES_START_DELAY = 5
@@ -64,6 +65,11 @@ ifneq ($(tags),)
6465
DEV_TAGS += ${tags}
6566
endif
6667

68+
# Enable integration test coverage (requires Go >= 1.20.0).
69+
ifneq ($(cover),)
70+
ITEST_COVERAGE = -coverprofile=itest/coverage.txt -coverpkg=./...
71+
endif
72+
6773
# Define the log tags that will be applied only when running unit tests. If none
6874
# are provided, we default to "nolog" which will be silent.
6975
ifneq ($(log),)

0 commit comments

Comments
 (0)