forked from edusoho/edusoho
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
172 lines (159 loc) · 8.12 KB
/
.gitlab-ci.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
stages:
- automation
- test
variables:
MYSQL_DATABASE: edusoho_test
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
before_script:
- cp app/config/parameters.yml.dist app/config/parameters.yml
- cp app/config/parameters.yml.dist app/config/parameters_test.yml
- "sed -i 's/\\s*database_host.*/ database_host: mysql/g' app/config/parameters_test.yml"
- "sed -i 's/\\s*database_name.*/ database_name: edusoho_test/g' app/config/parameters_test.yml"
- "echo ' redis_host: redis:6379' >> app/config/parameters_test.yml"
- "echo ' redis_timeout: 1' >> app/config/parameters_test.yml"
- "echo ' redis_reserved: null' >> app/config/parameters_test.yml"
- "echo ' redis_retry_interval: 100' >> app/config/parameters_test.yml"
- mkdir web/files
- mkdir -p app/data/private_files
- touch app/config/routing_plugins.yml
5.3 with nothing:
stage: test
image: codeages/ci-php:5.3-2
services:
- mysql:5.5
script:
- bin/phpunit-diff
only:
- develop
- master
- trigger
5.3 with Redis:
stage: test
image: codeages/ci-php:5.3-2
services:
- mysql:5.5
- redis:latest
script:
- bin/phpunit-diff
only:
- develop
- master
- trigger
5.5 with php-cs-fixer:
stage: test
image: codeages/ci-php:5.5-5
services:
- mysql:5.5
- redis:latest
script:
- php-cs-fixer fix --config=.php_cs.dist -v --dry-run --using-cache=no --path-mode=intersection `git diff --name-only --diff-filter=ACMRTUXB HEAD~..HEAD`
- bin/phpunit-diff
7.0 For Non-Develop:
stage: test
image: codeages/ci-php:7.0-7
services:
- mysql:5.5
- redis:latest
script:
- bin/phpunit-diff
only:
- master
- release
- trigger
7.0 For Develop:
stage: test
image: codeages/ci-php:7.0-7
services:
- mysql:5.5
- redis:latest
script:
- sed -i 's/memory_limit.*/memory_limit = 2000M/g' /etc/php/7.0/phpdbg/php.ini
- phpdbg -qrr bin/phpunit -c app/ --coverage-text --colors=never --testsuite UnitA2B --coverage-clover reports_tmp/phpunit.coverage.xml_1 --log-junit reports_tmp/phpunit.xml_1
- phpdbg -qrr bin/phpunit -c app/ --coverage-text --colors=never --testsuite UnitC2D --coverage-clover reports_tmp/phpunit.coverage.xml_2 --log-junit reports_tmp/phpunit.xml_2
- phpdbg -qrr bin/phpunit -c app/ --coverage-text --colors=never --testsuite UnitE2P --coverage-clover reports_tmp/phpunit.coverage.xml_3 --log-junit reports_tmp/phpunit.xml_3
- phpdbg -qrr bin/phpunit -c app/ --coverage-text --colors=never --testsuite UnitQ2T --coverage-clover reports_tmp/phpunit.coverage.xml_4 --log-junit reports_tmp/phpunit.xml_4
- phpdbg -qrr bin/phpunit -c app/ --coverage-text --colors=never --testsuite UnitU2Z --coverage-clover reports_tmp/phpunit.coverage.xml_5 --log-junit reports_tmp/phpunit.xml_5
- mkdir reports
- bin/caculate
- echo "sonar.links.ci=$SONAR_LINKS_CI" >> sonar-project.properties
- echo "sonar.links.issue=$SONAR_LINKS_ISSUE" >> sonar-project.properties
- echo "sonar.host.url=$SONAR_HOST" >> /opt/sonar-scanner/conf/sonar-scanner.properties
- echo "sonar.login=$SONAR_TOKEN" >> /opt/sonar-scanner/conf/sonar-scanner.properties
- /opt/sonar-scanner/bin/sonar-scanner
only:
- develop
AT With Java And Selenium:
stage: automation
image: ruanwenqin/ci:php5.5-jdk8
services:
- mysql:5.7
- selenium/standalone-chrome:latest
script:
# 修改配置文件
- "sed -i 's/\\s*database_host.*/ database_host: mysql/g' app/config/parameters.yml"
- "sed -i 's/\\s*database_name.*/ database_name: edusoho_test/g' app/config/parameters.yml"
# 启动web服务
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/edusohoplugin/vip.git plugins/VipPlugin
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/edusohoplugin/chargecoin.git plugins/ChargeCoinPlugin
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/edusohoplugin/coupon.git plugins/CouponPlugin
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/edusohoplugin/discount.git plugins/DiscountPlugin
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/edusohoplugin/moneycard.git plugins/MoneyCardPlugin
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/edusohoplugin/userimporter.git plugins/UserImporterPlugin
# 安装插件
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/edusoho/GUIAutomation2.git
- mysql -uroot --password="" -h mysql edusoho_test < GUIAutomation2/src/main/resources/fixtures/try3.sql
- tar xzf GUIAutomation2/src/main/resources/fixtures/file.tar.gz
- export SERVICE_IP=$(getent hosts $HOSTNAME | awk '{ print $1 }')
- bin/phpmig migrate
- app/console server:start $SERVICE_IP:8000
- cd GUIAutomation2
- sed -i "s/homePage\.url.*/homePage\.url=http\:\/\/$SERVICE_IP\:8000/g" src/main/resources/testdata_common.properties
- /opt/apache-maven-3.5.2/bin/mvn -B -Dmaven.repo.local=/cache/.m2 clean test -DseleniumBrowserType=chrome -DseleniumHubUrl="http://selenium__standalone-chrome:4444/wd/hub" -DisLocal=false
only:
- schedules
- triggers
- web
- api
Api Test With 5.5:
stage: test
image: ruanwenqin/ci-php:5.5-7
services:
- mysql:5.5
- redis:latest
script:
# 修改配置文件
- "sed -i 's/\\s*database_host.*/ database_host: mysql/g' app/config/parameters.yml"
- "sed -i 's/\\s*database_name.*/ database_name: edusoho_test/g' app/config/parameters.yml"
- touch app/data/specialEnv # 防止 新建uuid 索引报错的问题
- bin/phpmig migrate
# 安装codeception(因为版本问题,放到gitlab ci上运行时安装)
- composer config repo.packagist composer https://packagist.phpcomposer.com
- composer require "codeception/codeception:*" --ignore-platform-reqs
# install plugin
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/edusohoplugin/vip.git plugins/VipPlugin && app/console plugin:register Vip
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/edusohoplugin/chargecoin.git plugins/ChargeCoinPlugin && app/console plugin:register ChargeCoin
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/edusohoplugin/coupon.git plugins/CouponPlugin && app/console plugin:register Coupon
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/edusohoplugin/discount.git plugins/DiscountPlugin && app/console plugin:register Discount
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/edusohoplugin/moneycard.git plugins/MoneyCardPlugin && app/console plugin:register MoneyCard
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/edusohoplugin/userimporter.git plugins/UserImporterPlugin && app/console plugin:register UserImporter
- git clone -b develop --single-branch http://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/qiqiuyun-mp/WeChatAppPlugin.git plugins/WeChatAppPlugin && app/console plugin:register WeChatApp
# - wget -O app/config/plugin.php http://download-devtest.codeages.net/api-test-data/20180620/plugin.php
# - wget -O app/config/routing_plugins.yml http://download-devtest.codeages.net/api-test-data/20180620/routing_plugins.yml
# 启动web服务
- app/console server:start
# 执行codeception的A PI 单元测试
- bin/codecept run api
# 执行newman的 API 单元测试
- cd tests/api/Newman && newman run collection.json --iteration-data param.json --environment environment.json
only:
- develop
5.5 with js-test-unit:
stage: test
image: tianshengjie/codeage-node
script:
- npm install yarn
- node_modules/yarn/bin/yarn config set registry https://registry.npm.taobao.org
- node_modules/yarn/bin/yarn
- npm run test:simple tests/Js/test/*
only:
- develop