Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
52 changes: 47 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,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:
Expand All @@ -56,6 +64,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
Expand All @@ -65,15 +89,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: 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: btcutil/psbt/coverage.txt
flag-name: btcutilpsbt
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
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 28 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ LINT_PKG := github.com/golangci/golangci-lint/v2/cmd/golangci-lint
GOIMPORTS_PKG := golang.org/x/tools/cmd/goimports

GO_BIN := ${shell go env GOBIN}

# If GOBIN is not set, default to GOPATH/bin.
ifeq ($(GO_BIN),)
GO_BIN := $(shell go env GOPATH)/bin
endif

LINT_BIN := $(GO_BIN)/golangci-lint
GOIMPORTS_BIN := $(GO_BIN)/goimports

Expand Down Expand Up @@ -90,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:
Expand All @@ -101,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
Expand All @@ -132,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:
Expand All @@ -156,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
.PHONY: help
8 changes: 4 additions & 4 deletions btcutil/address.go → address/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

package btcutil
package address

import (
"bytes"
Expand All @@ -11,10 +11,10 @@ import (
"fmt"
"strings"

"github.com/btcsuite/btcd/address/v2/base58"
"github.com/btcsuite/btcd/address/v2/bech32"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcutil/base58"
"github.com/btcsuite/btcd/btcutil/bech32"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/v2"
"golang.org/x/crypto/ripemd160"
)

Expand Down
Loading
Loading