.travis.yml 2.6 KB
language: go

go:
  - "1.13.x"
services:
  - redis-server
  - mysql
  - postgresql
  - memcached
env:
  global:
    - GO_REPO_FULLNAME="github.com/astaxie/beego"
  matrix:
    - ORM_DRIVER=sqlite3   ORM_SOURCE=$TRAVIS_BUILD_DIR/orm_test.db
    - ORM_DRIVER=postgres ORM_SOURCE="user=postgres dbname=orm_test sslmode=disable"
before_install:
   # link the local repo with ${GOPATH}/src/<namespace>/<repo>
 - GO_REPO_NAMESPACE=${GO_REPO_FULLNAME%/*}
   # relies on GOPATH to contain only one directory...
 - mkdir -p ${GOPATH}/src/${GO_REPO_NAMESPACE}
 - ln -sv ${TRAVIS_BUILD_DIR} ${GOPATH}/src/${GO_REPO_FULLNAME}
 - cd ${GOPATH}/src/${GO_REPO_FULLNAME}
   # get and build ssdb
 - git clone git://github.com/ideawu/ssdb.git
 - cd ssdb
 - make
 - cd ..
install:
  - go get github.com/lib/pq
  - go get github.com/go-sql-driver/mysql
  - go get github.com/mattn/go-sqlite3
  - go get github.com/bradfitz/gomemcache/memcache
  - go get github.com/gomodule/redigo/redis
  - go get github.com/beego/x2j
  - go get github.com/couchbase/go-couchbase
  - go get github.com/beego/goyaml2
  - go get gopkg.in/yaml.v2
  - go get github.com/belogik/goes
  - go get github.com/ledisdb/ledisdb
  - go get github.com/ssdb/gossdb/ssdb
  - go get github.com/cloudflare/golz4
  - go get github.com/gogo/protobuf/proto
  - go get github.com/Knetic/govaluate
  - go get github.com/casbin/casbin
  - go get github.com/elazarl/go-bindata-assetfs
  - go get github.com/OwnLocal/goes
  - go get github.com/shiena/ansicolor
  - go get -u honnef.co/go/tools/cmd/staticcheck
  - go get -u github.com/mdempsky/unconvert
  - go get -u github.com/gordonklaus/ineffassign
  - go get -u golang.org/x/lint/golint
  - go get -u github.com/go-redis/redis
before_script:
  - psql --version
  - sh -c "if [ '$ORM_DRIVER' = 'postgres' ]; then psql -c 'create database orm_test;' -U postgres; fi"
  - sh -c "if [ '$ORM_DRIVER' = 'mysql' ]; then mysql -u root -e 'create database orm_test;'; fi"
  - sh -c "if [ '$ORM_DRIVER' = 'sqlite' ]; then touch $TRAVIS_BUILD_DIR/orm_test.db; fi"
  - sh -c "go get github.com/golang/lint/golint; golint ./...;"
  - sh -c "go list ./... | grep -v vendor | xargs go vet -v"
  - mkdir -p res/var
  - ./ssdb/ssdb-server ./ssdb/ssdb.conf -d
after_script:
  - killall -w ssdb-server
  - rm -rf ./res/var/*
script:
  - go test -v ./...
  - staticcheck -show-ignored -checks "-ST1017,-U1000,-ST1005,-S1034,-S1012,-SA4006,-SA6005,-SA1019,-SA1024"
  - unconvert $(go list ./... | grep -v /vendor/)
  - ineffassign .
  - find . ! \( -path './vendor' -prune \) -type f -name '*.go' -print0 | xargs -0 gofmt -l -s
  - golint ./...
addons:
  postgresql: "9.6"