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.

.drone.yml 4.2KB

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