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

TravisCI: Test and lint latest version modules. #1776

Merged
merged 3 commits into from
Jun 27, 2019
Merged
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
2 changes: 1 addition & 1 deletion chaincfg/mainnetparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func MainNetParams() *Params {
Nonce: 0x00000000,
StakeVersion: 0,
},
Transactions: []*wire.MsgTx{&wire.MsgTx{
Transactions: []*wire.MsgTx{{
SerType: wire.TxSerializeFull,
Version: 1,
TxIn: []*wire.TxIn{{
Expand Down
2 changes: 1 addition & 1 deletion chaincfg/regnetparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func RegNetParams() *Params {
StakeVersion: 0,
Height: 0,
},
Transactions: []*wire.MsgTx{&wire.MsgTx{
Transactions: []*wire.MsgTx{{
SerType: wire.TxSerializeFull,
Version: 1,
TxIn: []*wire.TxIn{{
Expand Down
2 changes: 1 addition & 1 deletion chaincfg/simnetparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func SimNetParams() *Params {
StakeVersion: 0,
Height: 0,
},
Transactions: []*wire.MsgTx{&wire.MsgTx{
Transactions: []*wire.MsgTx{{
SerType: wire.TxSerializeFull,
Version: 1,
TxIn: []*wire.TxIn{{
Expand Down
2 changes: 1 addition & 1 deletion chaincfg/testnetparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestNet3Params() *Params {
Nonce: 0x18aea41a,
StakeVersion: 6,
},
Transactions: []*wire.MsgTx{&wire.MsgTx{
Transactions: []*wire.MsgTx{{
SerType: wire.TxSerializeFull,
Version: 1,
TxIn: []*wire.TxIn{{
Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/decred/dcrd/chaincfg v1.5.1
github.com/decred/dcrd/chaincfg/chainhash v1.0.1
github.com/decred/dcrd/connmgr v1.0.2
github.com/decred/dcrd/database v1.0.3
github.com/decred/dcrd/database v1.1.0
github.com/decred/dcrd/dcrec v1.0.0
github.com/decred/dcrd/dcrec/secp256k1 v1.0.2
github.com/decred/dcrd/dcrjson/v2 v2.0.0
Expand Down Expand Up @@ -43,10 +43,12 @@ replace (
github.com/decred/dcrd/blockchain/stake => ./blockchain/stake
github.com/decred/dcrd/certgen => ./certgen
github.com/decred/dcrd/chaincfg/chainhash => ./chaincfg/chainhash
github.com/decred/dcrd/chaincfg/v2 => ./chaincfg
github.com/decred/dcrd/connmgr => ./connmgr
github.com/decred/dcrd/database => ./database
github.com/decred/dcrd/dcrec => ./dcrec
github.com/decred/dcrd/dcrjson/v2 => ./dcrjson
github.com/decred/dcrd/dcrutil/v2 => ./dcrutil
github.com/decred/dcrd/fees => ./fees
github.com/decred/dcrd/gcs => ./gcs
github.com/decred/dcrd/hdkeychain/v2 => ./hdkeychain
Expand All @@ -56,5 +58,6 @@ replace (
github.com/decred/dcrd/mining => ./mining
github.com/decred/dcrd/peer => ./peer
github.com/decred/dcrd/rpcclient/v2 => ./rpcclient
github.com/decred/dcrd/txscript/v2 => ./txscript
github.com/decred/dcrd/wire => ./wire
)
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ github.com/decred/dcrd/chaincfg v1.4.0 h1:dIJhXQooiVW5AVZ0c4brylsiwkc8KSawpZ3NPq
github.com/decred/dcrd/chaincfg v1.4.0/go.mod h1:ypuM30F+XgZmZTFfAkWHWd0lwwkWWAOAQYNRkRDlYLc=
github.com/decred/dcrd/chaincfg v1.5.1 h1:u1Xbq0VTnAXIHW5ECqrWe0VYSgf5vWHqpSiwoLBzxAQ=
github.com/decred/dcrd/chaincfg v1.5.1/go.mod h1:FukMzTjkwzjPU+hK7CqDMQe3NMbSZAYU5PAcsx1wlv0=
github.com/decred/dcrd/chaincfg/v2 v2.0.2 h1:VeGY52lHuYT01tIGbvYj+OO0GaGxGaJmnh+4vGca1+U=
github.com/decred/dcrd/chaincfg/v2 v2.0.2/go.mod h1:hpKvhLCDAD/xDZ3V1Pqpv9fIKVYYi11DyxETguazyvg=
github.com/decred/dcrd/dcrec/edwards v0.0.0-20180721005212-59fe2b293f69/go.mod h1:+ehP0Hk/mesyZXttxCtBbhPX23BMpZJ1pcVBqUfbmvU=
github.com/decred/dcrd/dcrec/edwards v0.0.0-20181208004914-a0816cf4301f/go.mod h1:+ehP0Hk/mesyZXttxCtBbhPX23BMpZJ1pcVBqUfbmvU=
github.com/decred/dcrd/dcrec/edwards v0.0.0-20190130161649-59ed4247a1d5/go.mod h1:+ehP0Hk/mesyZXttxCtBbhPX23BMpZJ1pcVBqUfbmvU=
Expand Down
20 changes: 20 additions & 0 deletions require.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) 2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

// +build ignore

// This file exists to prevent go mod tidy from removing requires for newer
// module versions that are not yet fully integrated and to allow them to be
// automatically discovered by the testing infrastructure.
//
// It is excluded from the build to avoid including unused modules in the final
// binary.

package main

import (
_ "github.com/decred/dcrd/chaincfg/v2"
_ "github.com/decred/dcrd/dcrutil/v2"
_ "github.com/decred/dcrd/txscript/v2"
)
29 changes: 17 additions & 12 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,28 @@ testrepo () {
cp "$REPO" "$GOPATH/bin/"

# run tests on all modules
ROOTPATH=$($GO list -m -f {{.Dir}} 2>/dev/null)
ROOTPATH=$($GO list -m)
ROOTPATHPATTERN=$(echo $ROOTPATH | sed 's/\\/\\\\/g' | sed 's/\//\\\//g')
MODPATHS=$($GO list -m -f {{.Dir}} all 2>/dev/null | grep "^$ROOTPATHPATTERN"\
| sed -e "s/^$ROOTPATHPATTERN//" -e 's/^\\//' -e 's/^\///')
MODPATHS=". $MODPATHS"
MODPATHS=$($GO list -m all | grep "^$ROOTPATHPATTERN" | cut -d' ' -f1)
for module in $MODPATHS; do
echo "==> ${module}"
env CC=gcc $GO test -short -tags rpctest ./${module}/...
env CC=gcc $GO test -short -tags rpctest ${module}/...

# check linters
golangci-lint run --build-tags rpctest --disable-all --deadline=10m \
--enable=gofmt \
--enable=gosimple \
--enable=unconvert \
--enable=ineffassign \
--enable=govet \
--enable=misspell ./${module}/...
MODNAME=$(echo $module | sed -e "s/^$ROOTPATHPATTERN//" \
-e 's/^\///' -e 's/\/v[0-9]\+$//')
if [ -z "$MODNAME" ]; then
MODNAME=.
fi
(cd $MODNAME && \
golangci-lint run --build-tags=rpctest --disable-all --deadline=10m \
--enable=gofmt \
--enable=gosimple \
--enable=unconvert \
--enable=ineffassign \
--enable=govet \
--enable=misspell \
)
done

echo "------------------------------------------"
Expand Down