forked from hanchuanchuan/bingo2sql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
69 lines (61 loc) · 2.42 KB
/
circle.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
version: 2
general:
branches:
ignore:
- gh-pages
jobs:
build:
branches:
ignore: gh-pages
environment:
TZ: "Asia/Shanghai"
docker:
- image: circleci/golang:1.13
# - image: circleci/mysql:5.7
- image: mysql:5.7
command: mysqld --lower_case_table_names=1 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --innodb-large-prefix=true --log-bin=on --server_id=111 --explicit_defaults_for_timestamp=true --gtid-mode=1 --enforce_gtid_consistency=1 --log-slave-updates=1 --innodb_buffer_pool_size=512M --max_allowed_packet=64M
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: true
TZ: "Asia/Shanghai"
# volumes:
# - /var/lib/mysql:/var/lib/mysql
working_directory: /go/src/github.com/hanchuanchuan/bingo2sql
steps:
- run:
name: Install mysql-client
command: sudo apt install default-mysql-client
- checkout
- run:
name: Waiting for MySQL to be ready
command: |
for i in `seq 1 10`;
do
nc -z localhost 3306 && echo Success && exit 0
echo -n .
sleep 1
done
echo Failed waiting for MySQL && exit 1
- run:
name: mysql init
command: mysql -h 127.0.0.1 -u root -e "select version();create database if not exists test DEFAULT CHARACTER SET utf8;create database if not exists test_inc DEFAULT CHARACTER SET utf8;grant all on *.* to test@'127.0.0.1' identified by 'test';FLUSH PRIVILEGES;show databases;show variables like 'explicit_defaults_for_timestamp';"
- run:
name: "Show Variables"
command: mysql -h 127.0.0.1 -u root -e "show variables"
- run: rm -f go.sum
- run: mysql -h 127.0.0.1 -u root -e "set global GTID_MODE = ON_PERMISSIVE;"
- run: mysql -h 127.0.0.1 -u root -e "set global GTID_MODE = ON;"
- run:
name: "Build & Test"
command: make test
no_output_timeout: 1200
# - setup_remote_docker:
# docker_layer_caching: false
# - run:
# name: Publish Docker Image to Docker Hub
# command: |
# if [ "${CIRCLE_BRANCH}" == "master" ]; then
# echo "$DOCKERHUB_USERNAME"
# echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
# make docker
# make docker-push
# fi