2019-01-20 02:56:25 +00:00
|
|
|
# Golang CircleCI 2.0 configuration file
|
|
|
|
#
|
|
|
|
# Check https://circleci.com/docs/2.0/language-go/ for more details
|
|
|
|
version: 2
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
docker:
|
|
|
|
# specify the version
|
|
|
|
- image: circleci/golang:1.10
|
|
|
|
|
|
|
|
- image: circleci/mysql:5.7
|
|
|
|
environment:
|
|
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: true
|
|
|
|
MYSQL_DATABASE: xorm_test
|
|
|
|
MYSQL_HOST: 127.0.0.1
|
|
|
|
MYSQL_ROOT_HOST: '%'
|
|
|
|
MYSQL_USER: root
|
|
|
|
|
|
|
|
# CircleCI PostgreSQL images available at: https://hub.docker.com/r/circleci/postgres/
|
|
|
|
- image: circleci/postgres:9.6.2-alpine
|
|
|
|
environment:
|
|
|
|
POSTGRES_USER: root
|
|
|
|
POSTGRES_DB: xorm_test
|
|
|
|
|
2019-01-21 09:31:35 +00:00
|
|
|
- image: microsoft/mssql-server-linux:2017-CU11
|
|
|
|
environment:
|
|
|
|
ACCEPT_EULA: Y
|
|
|
|
SA_PASSWORD: yourStrong(!)Password
|
|
|
|
MSSQL_PID: Developer
|
|
|
|
|
2019-01-20 02:56:25 +00:00
|
|
|
working_directory: /go/src/github.com/go-xorm/xorm
|
|
|
|
steps:
|
2019-01-21 12:40:13 +00:00
|
|
|
- run:
|
|
|
|
name: Wait for MSSQL
|
|
|
|
command: >
|
|
|
|
c=0;
|
|
|
|
for i in `seq 30`; do
|
|
|
|
echo "Waiting for mssql"
|
|
|
|
sqlcmd -H localhost -U sa -P "yourStrong(!)Password" -Q "CREATE DATABASE xorm_test" > /dev/null > /dev/null && c=0 && break || c=$? && sleep 1
|
|
|
|
done;
|
|
|
|
exit $c
|
|
|
|
|
2019-01-20 02:56:25 +00:00
|
|
|
- checkout
|
|
|
|
|
|
|
|
- run: go get -t -d -v ./...
|
|
|
|
- run: go get -u github.com/go-xorm/core
|
|
|
|
- run: go get -u github.com/go-xorm/builder
|
|
|
|
- run: go build -v
|
|
|
|
|
|
|
|
- run: go get -u github.com/wadey/gocovmerge
|
|
|
|
|
|
|
|
- run: go test -v -race -db="sqlite3" -conn_str="./test.db" -coverprofile=coverage1-1.txt -covermode=atomic
|
|
|
|
- run: go test -v -race -db="sqlite3" -conn_str="./test.db" -cache=true -coverprofile=coverage1-2.txt -covermode=atomic
|
|
|
|
- run: go test -v -race -db="mysql" -conn_str="root:@/xorm_test" -coverprofile=coverage2-1.txt -covermode=atomic
|
|
|
|
- run: go test -v -race -db="mysql" -conn_str="root:@/xorm_test" -cache=true -coverprofile=coverage2-2.txt -covermode=atomic
|
|
|
|
- run: go test -v -race -db="mymysql" -conn_str="xorm_test/root/" -coverprofile=coverage3-1.txt -covermode=atomic
|
|
|
|
- run: go test -v -race -db="mymysql" -conn_str="xorm_test/root/" -cache=true -coverprofile=coverage3-2.txt -covermode=atomic
|
|
|
|
- run: go test -v -race -db="postgres" -conn_str="dbname=xorm_test sslmode=disable" -coverprofile=coverage4-1.txt -covermode=atomic
|
|
|
|
- run: go test -v -race -db="postgres" -conn_str="dbname=xorm_test sslmode=disable" -cache=true -coverprofile=coverage4-2.txt -covermode=atomic
|
|
|
|
- run: go test -v -race -db="postgres" -conn_str="dbname=xorm_test sslmode=disable" -schema=xorm -coverprofile=coverage5-1.txt -covermode=atomic
|
|
|
|
- run: go test -v -race -db="postgres" -conn_str="dbname=xorm_test sslmode=disable" -schema=xorm -cache=true -coverprofile=coverage5-2.txt -covermode=atomic
|
2019-01-21 09:31:35 +00:00
|
|
|
- run: go test -v -race -db="mssql" -conn_str="server=localhost;user id=sa;password=yourStrong(!)Password;database=xorm_test" -coverprofile=coverage6-1.txt -covermode=atomic
|
|
|
|
- run: go test -v -race -db="mssql" -conn_str="server=localhost;user id=sa;password=yourStrong(!)Password;database=xorm_test" -cache=true -coverprofile=coverage6-2.txt -covermode=atomic
|
|
|
|
- run: 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 coverage6-1.txt coverage6-2.txt > coverage.txt
|
2019-01-20 02:56:25 +00:00
|
|
|
|
|
|
|
- run: bash <(curl -s https://codecov.io/bash)
|