mirror of
https://github.com/LBRYFoundation/lbcd.git
synced 2025-08-23 17:47:24 +00:00
build: replace travis-ci with github actions.
test go 1.14 use golangci-lint
This commit is contained in:
parent
b470eee477
commit
a505b99ba3
7 changed files with 45 additions and 46 deletions
27
.github/workflows/go.yml
vendored
Normal file
27
.github/workflows/go.yml
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
name: Build and Test
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Go CI
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go: [1.13, 1.14]
|
||||||
|
steps:
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go }}
|
||||||
|
- name: Check out source
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install Linters
|
||||||
|
run: "curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.26.0"
|
||||||
|
- name: Build
|
||||||
|
env:
|
||||||
|
GO111MODULE: "on"
|
||||||
|
run: go build ./...
|
||||||
|
- name: Test
|
||||||
|
env:
|
||||||
|
GO111MODULE: "on"
|
||||||
|
run: |
|
||||||
|
sh ./goclean.sh
|
18
.travis.yml
18
.travis.yml
|
@ -1,18 +0,0 @@
|
||||||
language: go
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $GOCACHE
|
|
||||||
- $GOPATH/pkg/mod
|
|
||||||
- $GOPATH/github.com/golang
|
|
||||||
- $GOPATH/gopkg.in/alecthomas
|
|
||||||
go:
|
|
||||||
- "1.13.x"
|
|
||||||
sudo: false
|
|
||||||
install:
|
|
||||||
- export PATH=$PATH:$PWD/linux-amd64/
|
|
||||||
- GO111MODULE=on go install . ./cmd/...
|
|
||||||
- GO111MODULE=off go get -u gopkg.in/alecthomas/gometalinter.v2
|
|
||||||
- GO111MODULE=off gometalinter.v2 --install
|
|
||||||
script:
|
|
||||||
- export PATH=$PATH:$HOME/gopath/bin
|
|
||||||
- ./goclean.sh
|
|
|
@ -1,9 +1,9 @@
|
||||||
btcd
|
btcd
|
||||||
====
|
====
|
||||||
|
|
||||||
[](https://travis-ci.org/btcsuite/btcd)
|
[](https://github.com/btcsuite/btcd/actions)
|
||||||
[](http://copyfree.org)
|
[](http://copyfree.org)
|
||||||
[](http://godoc.org/github.com/btcsuite/btcd)
|
[](https://godoc.org/github.com/btcsuite/btcd)
|
||||||
|
|
||||||
btcd is an alternative full node bitcoin implementation written in Go (golang).
|
btcd is an alternative full node bitcoin implementation written in Go (golang).
|
||||||
|
|
||||||
|
|
|
@ -271,7 +271,7 @@ type GetBlockTemplateResult struct {
|
||||||
|
|
||||||
type MempoolFees struct {
|
type MempoolFees struct {
|
||||||
Base float64 `json:"base"`
|
Base float64 `json:"base"`
|
||||||
Modified float64 `json:"base"`
|
Modified float64 `json:"modified"`
|
||||||
Ancestor float64 `json:"ancestor"`
|
Ancestor float64 `json:"ancestor"`
|
||||||
Descendant float64 `json:"descendant"`
|
Descendant float64 `json:"descendant"`
|
||||||
}
|
}
|
||||||
|
|
18
goclean.sh
18
goclean.sh
|
@ -6,26 +6,16 @@
|
||||||
# 4. gosimple (https://github.com/dominikh/go-simple)
|
# 4. gosimple (https://github.com/dominikh/go-simple)
|
||||||
# 5. unconvert (https://github.com/mdempsky/unconvert)
|
# 5. unconvert (https://github.com/mdempsky/unconvert)
|
||||||
#
|
#
|
||||||
# gometalinter (github.com/alecthomas/gometalinter) is used to run each static
|
|
||||||
# checker.
|
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
# Make sure gometalinter is installed and $GOPATH/bin is in your path.
|
go test -tags="rpctest" ./...
|
||||||
# $ go get -v github.com/alecthomas/gometalinter"
|
|
||||||
# $ gometalinter --install"
|
|
||||||
if [ ! -x "$(type -p gometalinter.v2)" ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
linter_targets=$(go list ./...)
|
|
||||||
|
|
||||||
# Automatic checks
|
# Automatic checks
|
||||||
test -z "$(gometalinter.v2 -j 4 --disable-all \
|
golangci-lint run --deadline=10m --disable-all \
|
||||||
--enable=gofmt \
|
--enable=gofmt \
|
||||||
--enable=golint \
|
--enable=golint \
|
||||||
--enable=vet \
|
--enable=vet \
|
||||||
--enable=gosimple \
|
--enable=gosimple \
|
||||||
--enable=unconvert \
|
--enable=unconvert
|
||||||
--deadline=10m $linter_targets 2>&1 | grep -v 'ALL_CAPS\|OP_' 2>&1 | tee /dev/stderr)"
|
|
||||||
GO111MODULE=on go test -tags="rpctest" $linter_targets
|
|
||||||
|
|
|
@ -1418,8 +1418,8 @@ func TestAncestorsDescendants(t *testing.T) {
|
||||||
// We'll be querying for the ancestors of E. We should expect to see all
|
// We'll be querying for the ancestors of E. We should expect to see all
|
||||||
// of the transactions that it depends on.
|
// of the transactions that it depends on.
|
||||||
expectedAncestors := map[chainhash.Hash]struct{}{
|
expectedAncestors := map[chainhash.Hash]struct{}{
|
||||||
*a.Hash(): struct{}{}, *b.Hash(): struct{}{},
|
*a.Hash(): {}, *b.Hash(): {},
|
||||||
*c.Hash(): struct{}{}, *d.Hash(): struct{}{},
|
*c.Hash(): {}, *d.Hash(): {},
|
||||||
}
|
}
|
||||||
ancestors := ctx.harness.txPool.txAncestors(e, nil)
|
ancestors := ctx.harness.txPool.txAncestors(e, nil)
|
||||||
if len(ancestors) != len(expectedAncestors) {
|
if len(ancestors) != len(expectedAncestors) {
|
||||||
|
@ -1436,8 +1436,8 @@ func TestAncestorsDescendants(t *testing.T) {
|
||||||
// Then, we'll query for the descendants of A. We should expect to see
|
// Then, we'll query for the descendants of A. We should expect to see
|
||||||
// all of the transactions that depend on it.
|
// all of the transactions that depend on it.
|
||||||
expectedDescendants := map[chainhash.Hash]struct{}{
|
expectedDescendants := map[chainhash.Hash]struct{}{
|
||||||
*b.Hash(): struct{}{}, *c.Hash(): struct{}{},
|
*b.Hash(): {}, *c.Hash(): {},
|
||||||
*d.Hash(): struct{}{}, *e.Hash(): struct{}{},
|
*d.Hash(): {}, *e.Hash(): {},
|
||||||
}
|
}
|
||||||
descendants := ctx.harness.txPool.txDescendants(a, nil)
|
descendants := ctx.harness.txPool.txDescendants(a, nil)
|
||||||
if len(descendants) != len(expectedDescendants) {
|
if len(descendants) != len(expectedDescendants) {
|
||||||
|
|
|
@ -337,9 +337,9 @@ func TestComputePkScript(t *testing.T) {
|
||||||
name: "P2WSH witness",
|
name: "P2WSH witness",
|
||||||
sigScript: nil,
|
sigScript: nil,
|
||||||
witness: [][]byte{
|
witness: [][]byte{
|
||||||
[]byte{},
|
{},
|
||||||
// Witness script.
|
// Witness script.
|
||||||
[]byte{
|
{
|
||||||
0x21, 0x03, 0x82, 0x62, 0xa6, 0xc6,
|
0x21, 0x03, 0x82, 0x62, 0xa6, 0xc6,
|
||||||
0xce, 0xc9, 0x3c, 0x2d, 0x3e, 0xcd,
|
0xce, 0xc9, 0x3c, 0x2d, 0x3e, 0xcd,
|
||||||
0x6c, 0x60, 0x72, 0xef, 0xea, 0x86,
|
0x6c, 0x60, 0x72, 0xef, 0xea, 0x86,
|
||||||
|
@ -367,9 +367,9 @@ func TestComputePkScript(t *testing.T) {
|
||||||
witness: [][]byte{
|
witness: [][]byte{
|
||||||
// Signature is not needed to re-derive the
|
// Signature is not needed to re-derive the
|
||||||
// pkScript.
|
// pkScript.
|
||||||
[]byte{},
|
{},
|
||||||
// Compressed pubkey.
|
// Compressed pubkey.
|
||||||
[]byte{
|
{
|
||||||
0x03, 0x82, 0x62, 0xa6, 0xc6, 0xce,
|
0x03, 0x82, 0x62, 0xa6, 0xc6, 0xce,
|
||||||
0xc9, 0x3c, 0x2d, 0x3e, 0xcd, 0x6c,
|
0xc9, 0x3c, 0x2d, 0x3e, 0xcd, 0x6c,
|
||||||
0x60, 0x72, 0xef, 0xea, 0x86, 0xd0,
|
0x60, 0x72, 0xef, 0xea, 0x86, 0xd0,
|
||||||
|
@ -398,9 +398,9 @@ func TestComputePkScript(t *testing.T) {
|
||||||
witness: [][]byte{
|
witness: [][]byte{
|
||||||
// Signature is not needed to re-derive the
|
// Signature is not needed to re-derive the
|
||||||
// pkScript.
|
// pkScript.
|
||||||
[]byte{},
|
{},
|
||||||
// Malformed compressed pubkey.
|
// Malformed compressed pubkey.
|
||||||
[]byte{
|
{
|
||||||
0x03, 0x82, 0x62, 0xa6, 0xc6, 0xce,
|
0x03, 0x82, 0x62, 0xa6, 0xc6, 0xce,
|
||||||
0xc9, 0x3c, 0x2d, 0x3e, 0xcd, 0x6c,
|
0xc9, 0x3c, 0x2d, 0x3e, 0xcd, 0x6c,
|
||||||
0x60, 0x72, 0xef, 0xea, 0x86, 0xd0,
|
0x60, 0x72, 0xef, 0xea, 0x86, 0xd0,
|
||||||
|
|
Loading…
Add table
Reference in a new issue