You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
39 lines
1.0 KiB
2 years ago
|
language: go
|
||
|
|
||
|
go:
|
||
|
- 1.14.x
|
||
|
- 1.15.x
|
||
|
- 1.16.x
|
||
|
- 1.17.x
|
||
|
|
||
|
env:
|
||
|
- GO111MODULE=on
|
||
|
|
||
|
services:
|
||
|
- mongodb
|
||
|
|
||
|
before_install:
|
||
|
- go get -t -v
|
||
|
|
||
|
# Add user and replica set to mongo by help of https://georgeshank.com/how-to-enable-a-mongodb-replica-set-on-travis/
|
||
|
before_script:
|
||
|
- sleep 15 # To Fix issue of https://docs.travis-ci.com/user/database-setup/#mongodb-does-not-immediately-accept-connections
|
||
|
- |
|
||
|
mongo admin --eval 'db.createUser(
|
||
|
{
|
||
|
user: "root",
|
||
|
pwd: "12345",
|
||
|
roles: [ { role: "root", db: "admin" } ]
|
||
|
}
|
||
|
)'
|
||
|
- 'echo "replication:" | sudo tee -a /etc/mongod.conf'
|
||
|
- 'echo " replSetName: rs0" | sudo tee -a /etc/mongod.conf'
|
||
|
- sudo systemctl restart mongod
|
||
|
- sleep 20 # To Fix issue of https://docs.travis-ci.com/user/database-setup/#mongodb-does-not-immediately-accept-connections
|
||
|
- mongo -u root -p 12345 --eval 'rs.initiate()'
|
||
|
|
||
|
script:
|
||
|
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
||
|
|
||
|
after_success:
|
||
|
- bash <(curl -s https://codecov.io/bash)
|