Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit 3e8290c

Browse files
authored
Add drone ci (#1092)
* add drone ci * add db tests on drone * fix drone * update drone * fix drone config * improve drone ci * improve postgres * update mymysql drone config * comment codecov on drone ci
1 parent 7a9249d commit 3e8290c

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed

.drone.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
workspace:
2+
base: /go
3+
path: src/github.com/go-xorm/xorm
4+
5+
clone:
6+
git:
7+
image: plugins/git:next
8+
depth: 50
9+
tags: true
10+
11+
services:
12+
mysql:
13+
image: mysql:5.7
14+
environment:
15+
- MYSQL_DATABASE=xorm_test
16+
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
17+
when:
18+
event: [ push, tag, pull_request ]
19+
20+
pgsql:
21+
image: postgres:9.5
22+
environment:
23+
- POSTGRES_USER=postgres
24+
- POSTGRES_DB=xorm_test
25+
when:
26+
event: [ push, tag, pull_request ]
27+
28+
#mssql:
29+
# image: microsoft/mssql-server-linux:2017-CU11
30+
# environment:
31+
# - ACCEPT_EULA=Y
32+
# - SA_PASSWORD=yourStrong(!)Password
33+
# - MSSQL_PID=Developer
34+
# commands:
35+
# - echo 'CREATE DATABASE xorm_test' > create.sql
36+
# - /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P yourStrong(!)Password -i "create.sql"
37+
38+
matrix:
39+
GO_VERSION:
40+
- 1.8
41+
- 1.9
42+
- 1.10
43+
- 1.11
44+
45+
pipeline:
46+
init_postgres:
47+
image: postgres:9.5
48+
commands:
49+
# wait for postgres service to become available
50+
- |
51+
until psql -U postgres -d xorm_test -h pgsql \
52+
-c "SELECT 1;" >/dev/null 2>&1; do sleep 1; done
53+
# query the database
54+
- |
55+
psql -U postgres -d xorm_test -h pgsql \
56+
-c "create schema xorm;"
57+
58+
build:
59+
image: golang:${GO_VERSION}
60+
commands:
61+
- go get -t -d -v ./...
62+
- go get -u github.com/go-xorm/core
63+
- go get -u github.com/go-xorm/builder
64+
- go build -v
65+
when:
66+
event: [ push, pull_request ]
67+
68+
test-sqlite:
69+
image: golang:${GO_VERSION}
70+
commands:
71+
- go get -u github.com/wadey/gocovmerge
72+
- go test -v -race -db="sqlite3" -conn_str="./test.db" -coverprofile=coverage1-1.txt -covermode=atomic
73+
- go test -v -race -db="sqlite3" -conn_str="./test.db" -cache=true -coverprofile=coverage1-2.txt -covermode=atomic
74+
when:
75+
event: [ push, pull_request ]
76+
77+
test-mysql:
78+
image: golang:${GO_VERSION}
79+
commands:
80+
- go test -v -race -db="mysql" -conn_str="root:@tcp(mysql)/xorm_test" -coverprofile=coverage2-1.txt -covermode=atomic
81+
- go test -v -race -db="mysql" -conn_str="root:@tcp(mysql)/xorm_test" -cache=true -coverprofile=coverage2-2.txt -covermode=atomic
82+
when:
83+
event: [ push, pull_request ]
84+
85+
test-mymysql:
86+
image: golang:${GO_VERSION}
87+
commands:
88+
- go test -v -race -db="mymysql" -conn_str="tcp:mysql:3306*xorm_test/root/" -coverprofile=coverage3-1.txt -covermode=atomic
89+
- go test -v -race -db="mymysql" -conn_str="tcp:mysql:3306*xorm_test/root/" -cache=true -coverprofile=coverage3-2.txt -covermode=atomic
90+
when:
91+
event: [ push, pull_request ]
92+
93+
test-postgres:
94+
image: golang:${GO_VERSION}
95+
commands:
96+
- go test -v -race -db="postgres" -conn_str="postgres://postgres:@pgsql/xorm_test?sslmode=disable" -coverprofile=coverage4-1.txt -covermode=atomic
97+
- go test -v -race -db="postgres" -conn_str="postgres://postgres:@pgsql/xorm_test?sslmode=disable" -cache=true -coverprofile=coverage4-2.txt -covermode=atomic
98+
when:
99+
event: [ push, pull_request ]
100+
101+
test-postgres-schema:
102+
image: golang:${GO_VERSION}
103+
commands:
104+
- go test -v -race -db="postgres" -conn_str="postgres://postgres:@pgsql/xorm_test?sslmode=disable" -schema=xorm -coverprofile=coverage5-1.txt -covermode=atomic
105+
- go test -v -race -db="postgres" -conn_str="postgres://postgres:@pgsql/xorm_test?sslmode=disable" -schema=xorm -cache=true -coverprofile=coverage5-2.txt -covermode=atomic
106+
- gocovmerge coverage1-1.txt coverage1-2.txt coverage2-1.txt coverage2-2.txt coverage3-1.txt coverage3-2.txt coverage4-1.txt coverage4-2.txt coverage5-1.txt coverage5-2.txt > coverage.txt
107+
when:
108+
event: [ push, pull_request ]
109+
110+
#coverage:
111+
# image: robertstettner/drone-codecov
112+
# secrets: [ codecov_token ]
113+
# files:
114+
# - coverage.txt
115+
# when:
116+
# event: [ push, pull_request ]
117+
# branch: [ master ]

0 commit comments

Comments
 (0)