forked from OPSnet/Gazelle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
133 lines (128 loc) · 4.17 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
stages:
- analyze
- test
# in gitlab you must define these variables:
# MYSQL_DATABASE - database name prefix
# MYSQL_PASSWORD - mysql user password
# MYSQL_USER - mysql username
# MYSQL_ROOT_PASSWORD - mysql root password
# PG_DATABASE - postgres database
# PG_PASSWORD - postgres user password
# PG_USER - postgres username
#
# optional variables that can be set:
# MYSQL_INIT_DB - create fresh DB with phinx, don't restore sql dump
# TEST_SSL_HOST - The name of hostname you control having a valid SSL certificate
# WAIT_ON_FINISH - sleep for 1h after successful execution, useful for debugging
variables:
POSTGRES_DATABASE: ${PG_DATABASE}_${CI_COMMIT_SHORT_SHA}
POSTGRES_USER: $PG_USER
POSTGRES_PASSWORD: $PG_PASSWORD
MYSQL_DATABASE: ${MYSQL_DATABASE}_${CI_COMMIT_SHORT_SHA}
MYSQL_USER: $MYSQL_USER
MYSQL_PASSWORD: $MYSQL_PASSWORD
MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD
MEMCACHED_NAMESPACE: $CI_COMMIT_SHORT_SHA
COMPOSER_HOME: ${CI_PROJECT_DIR}/.composer
CYPRESS_CACHE_FOLDER: ${CI_PROJECT_DIR}/node_modules/.cypress-cache
phpstan:
stage: analyze
image:
name: gazelle-phpstan:latest
entrypoint: [""]
cache:
- key:
files:
- composer.json
- composer.lock
prefix: vendor
paths:
- vendor
- .composer
script:
- composer install --no-progress
- apk add patch
- /bin/sh scripts/local-patch
- phpstan analyse --no-progress --configuration misc/phpstan.neon
e2e-tests:
stage: test
image:
name: gazelle-e2e-testing
entrypoint: [""]
services:
- name: memcached:1.6.17-alpine
alias: memcached
- name: postgres:14.6-alpine
alias: postgres
- name: percona:ps-8.0.29-21
alias: mysql
command:
- --group-concat-max-len=1048576
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_0900_ai_ci
- --userstat=on
- --sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
# neither sphinxsearch or ocelot are compatible with the mysql8 caching_sha2_password plugin
- --authentication-policy=mysql_native_password
variables:
ENV: dev
MYSQL_HOST: mysql
PGHOST: postgres
POSTGRES_DB_USER: gazelle
PGUSER: $POSTGRES_DB_USER
PGDATABASE: $POSTGRES_DATABASE
TEST_SSL_HOST: $TEST_SSL_HOST
#ELECTRON_RUN_AS_NODE: 1
cache:
- key:
files:
- composer.json
- composer.lock
prefix: vendor
paths:
- vendor
- .composer
- key:
files:
- package.json
- yarn.lock
prefix: yarn
paths:
- node_modules
- key:
files:
- .docker/sphinxsearch/sphinx.conf
prefix: sphinx
paths:
- .sphinxsearch
coverage: /^\s*Lines:\s*\d+.\d+\%/
script:
- /bin/bash "${CI_PROJECT_DIR}/.docker/web/bootstrap-base.sh"
- su gazelle -c "scripts/twig-parse \$(find templates -type f)"
- /bin/bash "${CI_PROJECT_DIR}/.docker/web/start-services.sh"
- su gazelle -c "composer exec -- phpunit --configuration misc/phpunit.xml --coverage-php /tmp/coverage/phpunit.cov --exclude-group no-ci"
- /bin/bash "${CI_PROJECT_DIR}/.docker/web/bootstrap-yarn.sh"
- yarn run cypress run
# note: phpcov has problems if .cov files are somewhere in the src tree
- su gazelle -c '/opt/bin/phpcov merge "/tmp/coverage" --text "/tmp/coverage/coverage.txt" && cat "/tmp/coverage/coverage.txt"'
- test "$WAIT_ON_FINISH" && sleep 3600 || exit 0
# Sonarqube main image: mc1arke/sonarqube-with-community-branch-plugin:9.5-community
# scanner requires SONAR_HOST_URL and SONAR_TOKEN
#sonarqube:
# stage: analysis
# image:
# name: sonarsource/sonar-scanner-cli:latest
# entrypoint: [""]
# variables:
# SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
# GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
# cache:
# key: "${CI_JOB_NAME}"
# paths:
# - .sonar/cache
# script:
# - sonar-scanner -Dsonar.qualitygate.wait=true
# allow_failure: true
# only:
# - merge_requests
# - master