forked from passbolt/passbolt_api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
85 lines (77 loc) · 2.89 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
image: alpine:latest
variables:
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2
stages:
- test
- release
include:
- template: Code-Quality.gitlab-ci.yml
- local: '/.gitlab-ci/Jobs/php_unit_tests.yml'
- local: '/.gitlab-ci/Jobs/artifact_build.yml'
- local: '/.gitlab-ci/Jobs/style_check.yml'
############################################################
# Local debug setup to run tests locally
# This code can't be organized as include due to:
# https://gitlab.com/gitlab-org/gitlab-runner/issues/3327
############################################################
.local-debug-functions: &local-debug-functions |
function init_test_db() {
mysql -h $DATASOURCES_DEFAULT_HOST -u root -p$MYSQL_ROOT_PASSWORD -e "GRANT ALL ON $DATASOURCES_TEST_DATABASE.* to $DATASOURCES_TEST_USERNAME@'%' identified by '$DATASOURCES_TEST_PASSWORD';"
}
function interactive_debug() {
if ${INTERACTIVE:-false}; then
echo "======================================================================="
echo "Interactive session, please attach a tty to run tests in this container"
echo "Once you are done debugging please press CTRL+C to kill the session "
echo "======================================================================="
sleep infinity
else
$PHPUNIT_COMMAND
fi
}
local-debug:
variables:
# MySQL services variables
MYSQL_USER: user
MYSQL_PASSWORD: testing-password
MYSQL_ROOT_PASSWORD: testing-password2
MYSQL_DATABASE: test
# Passbolt unit test job common variables
DEBUG: "true"
DATASOURCES_DEFAULT_DATABASE: $MYSQL_DATABASE
DATASOURCES_DEFAULT_USERNAME: $MYSQL_USER
DATASOURCES_DEFAULT_PASSWORD: $MYSQL_PASSWORD
DATASOURCES_DEFAULT_HOST: mariadb
DATASOURCES_TEST_DATABASE: $MYSQL_DATABASE
DATASOURCES_TEST_USERNAME: $MYSQL_USER
DATASOURCES_TEST_PASSWORD: $MYSQL_PASSWORD
DATASOURCES_TEST_HOST: mariadb
PASSBOLT_GPG_SERVER_KEY_PUBLIC: config/gpg/unsecure.key
PASSBOLT_GPG_SERVER_KEY_PRIVATE: config/gpg/unsecure_private.key
APP_FULL_BASE_URL: http://127.0.0.1
PASSBOLT_REGISTRATION_PUBLIC: "true"
PASSBOLT_SELENIUM_ACTIVE: "true"
# This is the development dummy fingerprint
PASSBOLT_GPG_SERVER_KEY_FINGERPRINT: 2FC8945833C51946E937F9FED47B0811573EE67E
PHPUNIT_COMMAND: vendor/bin/phpunit --log-junit unitreport.xml
services:
- name: mariadb:10.4
command:
- /bin/bash
- -c
- |
mount -t tmpfs -o size=1024m tmpfs /var/lib/mysql
docker-entrypoint.sh mysqld
image: $CI_REGISTRY_IMAGE_TEST:$PHP_VERSION
script:
- init_test_db
- cp config/app.default.php config/app.php
- composer install --dev --no-interaction
- composer cs-check
- gpg --import config/gpg/unsecure_private.key
- gpg --import config/gpg/unsecure.key
- interactive_debug
when: manual
before_script:
- *local-debug-functions