/
.pcit.yml
148 lines (129 loc) · 3.26 KB
/
.pcit.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#
# @see https://github.com/khs1994-php/khsci/blob/master/docs/SUMMARY.md
#
languages: php
# cache:
# directories:
# - cache
workspace:
base: /app
# path: .
path: src
pipeline:
# install dep
install:
image: composer:${COMPOSER_VERSION}
shell: bash
commands:
- pwd
- composer config -g repo.packagist composer https://packagist.laravel-china.org
# 由于 composer 镜像缺少某些扩展,故忽略这些
- composer install -q --ignore-platform-reqs
# - composer update -q --ignore-platform-reqs
# test script
script:
image: khs1994/php:${PHP_VERSION}-fpm-alpine
pull: true
shell: bash
environment:
- CI_REDIS_HOST=redis
- CI_REDIS_PORT=6379
- CI_MYSQL_HOST=mysql
- CI_MYSQL_PORT=3306
- CI_MYSQL_USERNAME=root
- CI_MYSQL_PASSWORD=mytest
- CI_MYSQL_DBNAME=test
commands:
- pwd
- mv ${PHP_INI_DIR}/conf.d/docker-php-ext-xdebug.ini.default ${PHP_INI_DIR}/conf.d/docker-php-ext-xdebug.ini
# 服务初始化需要时间,这里延迟执行
- sleep 30
- vendor/bin/phpunit --coverage-clover=coverage.xml
when:
# platform: linux/amd64
# platform: [ linux/*, windows/amd64 ]
# status: changed
# status: [ failure, success ]
# event: tag
# event: [push, pull_request, tag, deployment]
event: [push, pull_request, tag]
# branch: master
# branch: prefix/*
# branch: [master, develop]
# branch:
# include: [ master, release/* ]
# exclude: [ release/1.0.0, release/1.1.* ]
# when tag push build docker image
publish_php:
image: ci_docker_build
# registry: docker.khs1994.com
repo: khs1994/php
tags: ${PHP_VERSION}-swarm-${CI_TAG}-alpine
# target: php
build_args:
- a:1
# dockerfile: Dockerfile
# dockerfile: path/to/Dockerfile
when:
event: tag
after_success:
image: khs1994/php:${PHP_VERSION}-fpm-alpine
shell: bash
when:
status: success
commands:
# please set env CODECOV_TOKEN=XXX
- bash <(curl -s https://codecov.io/bash)
after_failure:
image: bash
when:
status: failure
commands:
- echo "build failure"
changed:
image: bash
when:
status: changed
commands:
- echo "build status changed"
services:
mysql:
image: mysql:${MYSQL_VERSION}
environment:
- MYSQL_DATABASE=test
- MYSQL_ROOT_PASSWORD=mytest
# entrypoint: [ "mysqld" ]
command: [ "--character-set-server=utf8mb4", "--default-authentication-plugin=mysql_native_password" ]
# postgresql:
# image: postgres:${POSTGRESQL_VERSION}
# environment:
# - POSTGRES_USER=postgres
# - POSTGRES_DB=test
redis:
image: redis:${REDIS_VERSION}-alpine
command: ["--bind", "0.0.0.0"]
# mongodb:
# image: mongo:${MONGODB_VERSION}
# command: [ --smallfiles ]
matrix:
COMPOSER_VERSION:
- 1.7.2
PHP_VERSION:
- 7.2.10
- 7.1.22
# - 7.0.32
# - 5.6.38
NGINX_VERSION:
- 1.15.4
REDIS_VERSION:
- 5.0-rc5
MYSQL_VERSION:
# - 8.0.11
- 5.7.22
MONGODB_VERSION:
- 3.7.3
POSTGRESQL_VERSION:
- 10.3-alpine
# branches:
# include: [ master, dev, feature/* ]
# exclude: [ release/1.0.0, release/1.1.* ]