Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Commit

Permalink
Merge branch 'gitlab-migration' into 'master'
Browse files Browse the repository at this point in the history
Gitlab migration

See merge request NebulousLabs/Sia!3167
  • Loading branch information
David Vorick committed Jul 17, 2018
2 parents b49a53d + 6822bc2 commit f0b7cea
Show file tree
Hide file tree
Showing 20 changed files with 106 additions and 62 deletions.
60 changes: 60 additions & 0 deletions .gitlab-ci.yml
@@ -0,0 +1,60 @@
image: golang:1.10

stages:
- lint
- test
- deploy

before_script:
- make dependencies
- cp -R $CI_PROJECT_DIR $GOPATH/src/gitlab.com/NebulousLabs/Sia
- cd $GOPATH/src/gitlab.com/NebulousLabs/Sia

after_script:
- cp -R /tmp/SiaTesting $CI_PROJECT_DIR/SiaTesting

lint:
stage: lint
script:
- go get -u github.com/alecthomas/gometalinter
- gometalinter --install
- gometalinter --vendor --disable-all --enable=vet --enable=gofmt ./...

legacy-tests:
stage: test
artifacts:
name: "SiaTesting-$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/SiaTesting
script: make test-long pkgs="./node ./node/api ./node/api/server" run=.

package-tests:
stage: test
artifacts:
name: "SiaTesting-$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/SiaTesting
script:
- make test-long run=. pkgs="./build ./cmd/siac ./cmd/siad ./compatibility ./crypto ./encoding ./modules ./modules/consensus ./modules/explorer ./modules/gateway ./modules/host ./modules/host/contractmanager ./modules/renter ./modules/renter/contractor ./modules/renter/hostdb ./modules/renter/hostdb/hosttree ./modules/renter/proto ./modules/miner ./modules/wallet ./modules/transactionpool ./persist ./sync ./types"

integration-tests:
stage: test
artifacts:
name: "SiaTesting-$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/SiaTesting
script:
- make test-long run=. pkgs="./siatest ./siatest/consensus ./siatest/renter ./siatest/wallet"

deploy:
stage: deploy
only:
refs:
- master
artifacts:
name: "Binaries"
paths:
- $CI_PROJECT_DIR/artifacts
script:
- make deploy
- cp -R ./artifacts $CI_PROJECT_DIR/artifacts
6 changes: 5 additions & 1 deletion Makefile
Expand Up @@ -83,6 +83,10 @@ release:
release-race:
go install -race -tags='netgo' -a -ldflags='-s -w $(ldflags)' $(pkgs)

# deploy builds release binaries for every platform.
deploy:
./deploy.sh

# clean removes all directories that get automatically created during
# development.
clean:
Expand All @@ -93,7 +97,7 @@ test:
test-v:
go test -race -v -short -tags='debug testing netgo' -timeout=15s $(pkgs) -run=$(run)
test-long: clean fmt vet lint
go test -v -race -tags='testing debug netgo' -timeout=500s $(pkgs) -run=$(run)
go test -v -race -tags='testing debug netgo' -timeout=1200s $(pkgs) -run=$(run)
test-vlong: clean fmt vet lint
go test -v -race -tags='testing debug vlong netgo' -timeout=5000s $(pkgs) -run=$(run)
test-cpu:
Expand Down
2 changes: 1 addition & 1 deletion cmd/siac/daemoncmd.go
Expand Up @@ -3,8 +3,8 @@ package main
import (
"fmt"

"gitlab.com/NebulousLabs/Sia/build"
"github.com/spf13/cobra"
"gitlab.com/NebulousLabs/Sia/build"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/siac/gatewaycmd.go
Expand Up @@ -5,8 +5,8 @@ import (
"os"
"text/tabwriter"

"gitlab.com/NebulousLabs/Sia/modules"
"github.com/spf13/cobra"
"gitlab.com/NebulousLabs/Sia/modules"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/siac/rentercmd.go
Expand Up @@ -33,8 +33,8 @@ import (
"text/tabwriter"
"time"

"gitlab.com/NebulousLabs/errors"
"github.com/spf13/cobra"
"gitlab.com/NebulousLabs/errors"

"gitlab.com/NebulousLabs/Sia/modules"
"gitlab.com/NebulousLabs/Sia/node/api"
Expand Down
24 changes: 24 additions & 0 deletions deploy.sh
@@ -0,0 +1,24 @@
#!/bin/bash

mkdir artifacts
for arch in amd64 arm; do
for os in darwin linux windows; do
for pkg in siac siad; do
if [ "$arch" == "arm" ]; then
if [ "$os" == "windows" ] || [ "$os" == "darwin" ]; then
continue
fi
fi

bin=$pkg
if [ "$os" == "windows" ]; then
bin=${pkg}.exe
fi

GOOS=${os} GOARCH=${arch} go build -tags='netgo' -o artifacts/$arch/$os/$bin ./cmd/$pkg
if [ $? -ne 0 ]; then
exit $?
fi
done
done
done
2 changes: 1 addition & 1 deletion modules/consensus/difficulty.go
Expand Up @@ -7,8 +7,8 @@ import (

"gitlab.com/NebulousLabs/Sia/types"

"gitlab.com/NebulousLabs/errors"
"github.com/coreos/bbolt"
"gitlab.com/NebulousLabs/errors"
)

// Errors returned by this file.
Expand Down
2 changes: 1 addition & 1 deletion modules/consensus/subscribe.go
Expand Up @@ -7,8 +7,8 @@ import (
"gitlab.com/NebulousLabs/Sia/build"
"gitlab.com/NebulousLabs/Sia/modules"

siasync "gitlab.com/NebulousLabs/Sia/sync"
"github.com/coreos/bbolt"
siasync "gitlab.com/NebulousLabs/Sia/sync"
)

// computeConsensusChange computes the consensus change from the change entry
Expand Down
2 changes: 1 addition & 1 deletion modules/consensus/subscribe_test.go
Expand Up @@ -4,8 +4,8 @@ import (
"sync"
"testing"

"gitlab.com/NebulousLabs/Sia/modules"
bolt "github.com/coreos/bbolt"
"gitlab.com/NebulousLabs/Sia/modules"
)

// mockSubscriber receives and holds changes to the consensus set, remembering
Expand Down
2 changes: 1 addition & 1 deletion modules/explorer/info.go
@@ -1,10 +1,10 @@
package explorer

import (
"github.com/coreos/bbolt"
"gitlab.com/NebulousLabs/Sia/build"
"gitlab.com/NebulousLabs/Sia/modules"
"gitlab.com/NebulousLabs/Sia/types"
"github.com/coreos/bbolt"
)

// Block takes a block ID and finds the corresponding block, provided that the
Expand Down
2 changes: 1 addition & 1 deletion modules/gateway/stream.go
Expand Up @@ -3,8 +3,8 @@ package gateway
import (
"net"

"gitlab.com/NebulousLabs/Sia/build"
"github.com/xtaci/smux"
"gitlab.com/NebulousLabs/Sia/build"
)

// A streamSession is a multiplexed transport that can accept or initiate
Expand Down
2 changes: 1 addition & 1 deletion modules/transactionpool/database.go
Expand Up @@ -8,8 +8,8 @@ import (
"gitlab.com/NebulousLabs/Sia/modules"
"gitlab.com/NebulousLabs/Sia/types"

"gitlab.com/NebulousLabs/errors"
"github.com/coreos/bbolt"
"gitlab.com/NebulousLabs/errors"
)

// database.go contains objects related to the layout of the transaction pool's
Expand Down
2 changes: 1 addition & 1 deletion modules/transactionpool/persist.go
Expand Up @@ -11,8 +11,8 @@ import (
"gitlab.com/NebulousLabs/Sia/persist"
"gitlab.com/NebulousLabs/Sia/types"

"gitlab.com/NebulousLabs/errors"
"github.com/coreos/bbolt"
"gitlab.com/NebulousLabs/errors"
)

const tpoolSyncRate = time.Minute * 2
Expand Down
2 changes: 1 addition & 1 deletion modules/transactionpool/transactionpool.go
Expand Up @@ -3,8 +3,8 @@ package transactionpool
import (
"errors"

"gitlab.com/NebulousLabs/demotemutex"
"github.com/coreos/bbolt"
"gitlab.com/NebulousLabs/demotemutex"

"gitlab.com/NebulousLabs/Sia/crypto"
"gitlab.com/NebulousLabs/Sia/modules"
Expand Down
2 changes: 1 addition & 1 deletion modules/wallet/encrypt.go
Expand Up @@ -6,13 +6,13 @@ import (
"fmt"
"time"

"github.com/coreos/bbolt"
"gitlab.com/NebulousLabs/Sia/build"
"gitlab.com/NebulousLabs/Sia/crypto"
"gitlab.com/NebulousLabs/Sia/encoding"
"gitlab.com/NebulousLabs/Sia/modules"
"gitlab.com/NebulousLabs/Sia/types"
"gitlab.com/NebulousLabs/fastrand"
"github.com/coreos/bbolt"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion modules/wallet/seed.go
Expand Up @@ -4,13 +4,13 @@ import (
"runtime"
"sync"

"github.com/coreos/bbolt"
"gitlab.com/NebulousLabs/Sia/crypto"
"gitlab.com/NebulousLabs/Sia/encoding"
"gitlab.com/NebulousLabs/Sia/modules"
"gitlab.com/NebulousLabs/Sia/types"
"gitlab.com/NebulousLabs/errors"
"gitlab.com/NebulousLabs/fastrand"
"github.com/coreos/bbolt"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion node/api/routes.go
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"time"

"gitlab.com/NebulousLabs/Sia/build"
"github.com/julienschmidt/httprouter"
"gitlab.com/NebulousLabs/Sia/build"
)

// buildHttpRoutes sets up and returns an * httprouter.Router.
Expand Down
2 changes: 1 addition & 1 deletion node/api/wallet.go
Expand Up @@ -13,8 +13,8 @@ import (
"gitlab.com/NebulousLabs/Sia/modules"
"gitlab.com/NebulousLabs/Sia/types"

"gitlab.com/NebulousLabs/entropy-mnemonics"
"github.com/julienschmidt/httprouter"
"gitlab.com/NebulousLabs/entropy-mnemonics"
)

type (
Expand Down
46 changes: 1 addition & 45 deletions persist/boltdb_test.go
Expand Up @@ -3,13 +3,12 @@ package persist
import (
"os"
"path/filepath"
"runtime"
"testing"
"time"

"github.com/coreos/bbolt"
"gitlab.com/NebulousLabs/Sia/build"
"gitlab.com/NebulousLabs/fastrand"
"github.com/coreos/bbolt"
)

// testInputs and testFilenames are global variables because most tests require
Expand Down Expand Up @@ -199,49 +198,6 @@ func TestOpenDatabase(t *testing.T) {
}
}

// TestErrPermissionOpenDatabase tests calling OpenDatabase on a database file
// with the wrong filemode (< 0600), which should result in an os.ErrPermission
// error.
func TestErrPermissionOpenDatabase(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("can't reproduce on Windows")
}

const (
dbHeader = "Fake Header"
dbVersion = "0.0.0"
dbFilename = "Fake Filename"
)
testDir := build.TempDir(persistDir, t.Name())
err := os.MkdirAll(testDir, 0700)
if err != nil {
t.Fatal(err)
}
dbFilepath := filepath.Join(testDir, dbFilename)
badFileModes := []os.FileMode{0000, 0001, 0002, 0003, 0004, 0005, 0010, 0040, 0060, 0105, 0110, 0126, 0130, 0143, 0150, 0166, 0170, 0200, 0313, 0470, 0504, 0560, 0566, 0577}

// Make sure OpenDatabase returns a permissions error for each of the modes
// in badFileModes.
for _, mode := range badFileModes {
// Create a file named dbFilename in directory testDir with the wrong
// permissions (mode < 0600).
_, err := os.OpenFile(dbFilepath, os.O_RDWR|os.O_CREATE, mode)
if err != nil {
t.Fatal(err)
}
// OpenDatabase should return a permissions error because the database
// mode is less than 0600.
_, err = OpenDatabase(Metadata{dbHeader, dbVersion}, dbFilepath)
if !os.IsPermission(err) {
t.Errorf("OpenDatabase failed to return expected error when called on a database with the wrong permissions (%o instead of >= 0600);\n wanted:\topen %v: permission denied\n got:\t\t%v", mode, dbFilepath, err)
}
err = os.Remove(dbFilepath)
if err != nil {
t.Error(err)
}
}
}

// TestErrTxNotWritable checks that updateMetadata returns an error when called
// from a read-only transaction.
func TestErrTxNotWritable(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/xtaci/smux/session.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f0b7cea

Please sign in to comment.