Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mod: remove btcutil circular dependency with main module #1825

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,34 @@ jobs:
flag-name: btcd
parallel: true

- name: Send address
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: address/coverage.txt
flag-name: address
parallel: true

- name: Send btcec
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: btcec/coverage.txt
flag-name: btcec
parallel: true

- name: Send chaincfg
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: chaincfg/coverage.txt
flag-name: chaincfg
parallel: true

- name: Send chaincfg coverage for chainhash package
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: chaincfg/chainhash/coverage.txt
flag-name: chaincfgchainhash
parallel: true

- name: Send btcutil coverage
uses: shogo82148/actions-goveralls@v1
with:
Expand All @@ -62,8 +83,8 @@ jobs:
- name: Send btcutil coverage for psbt package
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: btcutil/psbt/coverage.txt
flag-name: btcutilpsbt
path-to-profile: psbt/coverage.txt
flag-name: psbt
parallel: true

- name: Notify coveralls all reports sent
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
28 changes: 21 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,41 @@ 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: $(GOACC_BIN)
@$(call print, "Running unit coverage tests.")
$(GOACC_BIN) ./...

# 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; $(GOACC_BIN) ./...; sed -i.bak 's/v2\///g' coverage.txt
cd btcec; $(GOACC_BIN) ./...; sed -i.bak 's/v2\///g' coverage.txt

cd btcutil; $(GOACC_BIN) ./...

cd btcutil/psbt; $(GOACC_BIN) ./...
cd btcutil; $(GOACC_BIN) ./...; sed -i.bak 's/v2\///g' coverage.txt
cd chaincfg; $(GOACC_BIN) ./...; sed -i.bak 's/v2\///g' coverage.txt
cd chainhash; $(GOACC_BIN) ./...; sed -i.bak 's/v2\///g' coverage.txt
cd txscript; $(GOACC_BIN) ./...; sed -i.bak 's/v2\///g' coverage.txt
cd psbt; $(GOACC_BIN) ./...; sed -i.bak 's/v2\///g' coverage.txt
cd wire; $(GOACC_BIN) ./...; sed -i.bak 's/v2\///g' coverage.txt

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 +145,8 @@ lint: $(LINT_BIN)

clean:
@$(call print, "Cleaning source.$(NC)")
$(RM) coverage.txt btcec/coverage.txt btcutil/coverage.txt btcutil/psbt/coverage.txt
find . -name coverage.txt | xargs echo
find . -name coverage.txt.bak | xargs echo

.PHONY: all \
default \
Expand Down
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