-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
40 lines (33 loc) · 1.02 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
language: go
go:
- 1.17.x
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.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)