-
Notifications
You must be signed in to change notification settings - Fork 15
/
.gitlab-ci.yml
114 lines (98 loc) · 3.07 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
stages:
- build
- test
- report
- release
- deploy
- cleanup
variables:
ISOLATION: "buildpipeline${CI_PIPELINE_ID}${CI_PROJECT_NAME}"
COMPOSE_FILE: "./docker-compose.yml:./docker/docker-compose.dev.yml:./docker/docker-compose.test.yml:./docker/docker-compose.selenium.yml"
STACK_PHP_IMAGE: "${PHP_IMAGE_NAME}:${CI_BUILD_REF}"
# ----------------------------------------------------------
# before/after scripts, these will be used in every job within the job-scope
# ----------------------------------------------------------
before_script:
# set docker-compose isolation
- export COMPOSE_PROJECT_NAME=${ISOLATION}${CI_BUILD_NAME}
- pwd
- docker version
- docker-compose version
- docker-compose config
- echo ${ISOLATION}
- echo $(git describe --always --dirty --tags)
- export APP_VERSION=$(git describe --always --dirty --tags)
- export REGISTRY_PHP_IMAGE=${PHP_IMAGE_NAME}:${APP_VERSION}
after_script:
# set docker-compose isolation
- export COMPOSE_PROJECT_NAME=${ISOLATION}${CI_BUILD_NAME}
# run all commands from test environment
- make clean
# ----------------------------------------------------------
# TEMPLATES
# ----------------------------------------------------------
# ----------------------------------------------------------
# templates which can be used in jobs with different flavours
.codeception_tmpl: &codeception_tmpl_ref
stage: test
script:
- make test
except:
- coverage
artifacts:
name: ${CI_PROJECT_PATH}-p${CI_PIPELINE_ID}-codeception
when: always
expire_in: 4 weeks
paths:
- _host-volumes/tests-log
.lint_tmpl: &lint_tmpl_ref
stage: test
script:
- export COMPOSE_PROJECT_NAME=${ISOLATION}${CI_BUILD_NAME}
- make help
- make lint
artifacts:
name: ${CI_PROJECT_PATH}-p${CI_PIPELINE_ID}-lint
when: always
expire_in: 4 weeks
paths:
- _host-volumes/tests-log
.coverage_tmpl: &coverage_tmpl_ref
stage: test
script:
- export COMPOSE_PROJECT_NAME=${ISOLATION}${CI_BUILD_NAME}
- make test-init
- make test-coverage
when: manual
artifacts:
name: ${CI_PROJECT_PATH}-p${CI_PIPELINE_ID}-coverage
when: always
expire_in: 4 weeks
paths:
- _host-volumes/tests-log
.release_tmpl: &release_tmpl_ref
stage: release
environment:
name: image
script:
- docker login --username ${REGISTRY_USER} --password ${REGISTRY_PASS} ${REGISTRY_HOST}
- make version build
- docker tag ${STACK_PHP_IMAGE} ${REGISTRY_PHP_IMAGE}
- docker push ${REGISTRY_PHP_IMAGE}
only:
- releases
- tags
# ----------------------------------------------------------
# job definitions, they should use the defined job and flavour templates
# ----------------------------------------------------------
codeception-debian:
<<: *codeception_tmpl_ref
# ----------------------------------------------------------
coverage-debian:
<<: *coverage_tmpl_ref
# ----------------------------------------------------------
lint-debian:
<<: *lint_tmpl_ref
# ----------------------------------------------------------
release-debian:
<<: *release_tmpl_ref