diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f290248b..3fb2f37a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,7 +56,15 @@ jobs: format: 'golang' parallel: true - - name: Send btcec + - name: Send address coverage + uses: coverallsapp/github-action@v2 + with: + file: address/coverage.txt + flag-name: address + format: 'golang' + parallel: true + + - name: Send btcec coverage uses: coverallsapp/github-action@v2 continue-on-error: true with: @@ -65,6 +73,22 @@ jobs: format: 'golang' parallel: true + - name: Send chaincfg coverage + uses: coverallsapp/github-action@v2 + with: + file: chaincfg/coverage.txt + flag-name: chaincfg + format: 'golang' + parallel: true + + - name: Send chainhash coverage + uses: coverallsapp/github-action@v2 + with: + file: chainhash/coverage.txt + flag-name: chainhash + format: 'golang' + parallel: true + - name: Send btcutil coverage uses: coverallsapp/github-action@v2 continue-on-error: true @@ -74,15 +98,33 @@ jobs: format: 'golang' parallel: true - - name: Send btcutil coverage for psbt package + - name: Send psbt coverage uses: coverallsapp/github-action@v2 continue-on-error: true with: - file: btcutil/psbt/coverage.txt - flag-name: btcutilpsbt + file: psbt/coverage.txt + flag-name: psbt format: 'golang' parallel: true - + + - name: Send txscript coverage + uses: coverallsapp/github-action@v2 + continue-on-error: true + with: + file: txscript/coverage.txt + flag-name: txscript + format: 'golang' + parallel: true + + - name: Send wire coverage + uses: coverallsapp/github-action@v2 + continue-on-error: true + with: + file: wire/coverage.txt + flag-name: wire + format: 'golang' + parallel: true + - name: Notify coveralls all reports sent uses: coverallsapp/github-action@v2 continue-on-error: true diff --git a/.gitignore b/.gitignore index acfb8c4b..6c5a1a77 100644 --- a/.gitignore +++ b/.gitignore @@ -37,9 +37,7 @@ _testmain.go profile.tmp profile.cov coverage.txt -btcec/coverage.txt -btcutil/coverage.txt -btcutil/psbt/coverage.txt +coverage.txt.bak # vim *.swp diff --git a/Makefile b/Makefile index 4ccc503d..0ea4a21d 100644 --- a/Makefile +++ b/Makefile @@ -96,9 +96,14 @@ check: unit unit: @$(call print, "Running unit tests.") $(GOTEST_DEV) ./... -test.timeout=20m + cd address && $(GOTEST_DEV) ./... -test.timeout=20m cd btcec && $(GOTEST_DEV) ./... -test.timeout=20m cd btcutil && $(GOTEST_DEV) ./... -test.timeout=20m - cd btcutil/psbt && $(GOTEST_DEV) ./... -test.timeout=20m + cd chaincfg && $(GOTEST_DEV) ./... -test.timeout=20m + cd chainhash && $(GOTEST_DEV) ./... -test.timeout=20m + cd txscript && $(GOTEST_DEV) ./... -test.timeout=20m + cd psbt && $(GOTEST_DEV) ./... -test.timeout=20m + cd wire && $(GOTEST_DEV) ./... -test.timeout=20m #? unit-cover: Run unit coverage tests unit-cover: @@ -107,17 +112,27 @@ unit-cover: # We need to remove the /v2 pathing from the module to have it work # nicely with the CI tool we use to render live code coverage. + cd address && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt cd btcec && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt - cd btcutil && $(GOTEST) $(COVER_FLAGS) ./... - cd btcutil/psbt && $(GOTEST) $(COVER_FLAGS) ./... + cd btcutil && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt + cd chaincfg && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt + cd chainhash && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt + cd txscript && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt + cd psbt && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt + cd wire && $(GOTEST) $(COVER_FLAGS) ./... && sed -i.bak 's/v2\///g' coverage.txt #? unit-race: Run unit race tests unit-race: @$(call print, "Running unit race tests.") env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./... + cd address && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./... cd btcec && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./... cd btcutil && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./... - cd btcutil/psbt && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./... + cd chaincfg && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./... + cd chainhash && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./... + cd txscript && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./... + cd psbt && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./... + cd wire && env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOTEST) -race -test.timeout=20m ./... # ========= # UTILITIES @@ -138,7 +153,8 @@ lint: $(LINT_BIN) #? clean: Clean source clean: @$(call print, "Cleaning source.$(NC)") - rm -f coverage.txt btcec/coverage.txt btcutil/coverage.txt btcutil/psbt/coverage.txt + find . -name coverage.txt | xargs $(RM) + find . -name coverage.txt.bak | xargs $(RM) #? tidy-module: Run 'go mod tidy' for all modules tidy-module: @@ -162,4 +178,4 @@ help: Makefile @echo " Choose a command run in btcd:" @sed -n 's/^#?//p' $< | column -t -s ':' | sort | sed -e 's/^/ /' -.PHONY: help \ No newline at end of file +.PHONY: help