-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
.travis.yml
103 lines (91 loc) · 2.78 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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#
# Travis CI
#
# @link https://docs.travis-ci.com/
# @link https://www.khs1994.com/categories/CI/Travis-CI/
#
language: php
os: linux
dist: xenial
cache:
directories:
- cache
services:
- docker
# - rabbitmq
# - memcached
# - redis-server
# - mysql
# - mariadb
# - postgresql
# - mongodb
php:
# - 5.6
# - 7.0
- 7.3
- 7.4
#
# 设置数据库
#
# @link https://docs.travis-ci.com/user/database-setup/
#
# addons:
# mariadb: '10.0'
# postgresql: '9.4'
before_install:
- docker --version
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get update
- sudo apt-get -y install docker-ce
- docker --version
# - sleep 15
- sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'DROP DATABASE IF EXISTS tests;' -U postgres; fi"
- sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'DROP DATABASE IF EXISTS tests_tmp;' -U postgres; fi"
- sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'CREATE DATABASE tests;' -U postgres; fi"
- sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'CREATE DATABASE tests_tmp;' -U postgres; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS tests_tmp; CREATE DATABASE IF NOT EXISTS tests;'; fi"
- sh -c "if [ '$ENABLE_MONGODB' = 'enable' ]; then mongo mydb_test --eval 'db.createUser({user:"travis",pwd:"test",roles:["readWrite"]});'; fi"
# ubuntu 14.04
# https://docs.docker.com/edge/engine/reference/commandline/dockerd/#daemon-socket-option
# - echo 'DOCKER_OPTS="-H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375"' | sudo tee /etc/default/docker
# - sudo service docker restart
# ubuntu 16.04
- sudo mkdir -p /etc/systemd/system/docker.service.d
- echo -e '[Service]\nExecStart=\nExecStart=/usr/bin/dockerd' | sudo tee /etc/systemd/system/docker.service.d/docker.conf
- echo '{"hosts":["unix:///var/run/docker.sock","tcp://0.0.0.0:2375"]}' | sudo tee /etc/docker/daemon.json
- sudo systemctl daemon-reload
- sudo systemctl cat docker
- sudo systemctl restart docker
- sudo curl -fsSL http://get.sensiolabs.org/sami.phar -o /usr/local/bin/sami
- sudo chmod +x /usr/local/bin/sami
install:
- composer install -q || composer install
# - composer update -q
script:
- vendor/bin/phpunit --coverage-clover=coverage.xml
after_success:
- bash <(curl -s https://codecov.io/bash)
- sami update .sami.php
env:
global:
- MONGODB=disable
# - DB=sqlite
# - DB=mysql
# - DB=postgresql
#
# rabbitmq vhost / username guest password guest
#
#
# mysql 127.0.0.1 username-> root/travis 空密码
#
# memcached/redis -> localhost
#
deploy:
provider: pages
skip-cleanup: true
local-dir: build
github-token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable
keep-history: true
on:
branch: master