forked from pantheon-systems/example-drops-8-composer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
142 lines (131 loc) · 3.26 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
# Build tools Dockerfile
image: quay.io/pantheon-public/build-tools-ci:6.x
# Default Variables
variables:
CI_BUILD_NUMBER: $CI_PIPELINE_IID
DEFAULT_SITE: $CI_PROJECT_NAME
PR_NUMBER: $CI_MERGE_REQUEST_IID
CI_BRANCH: $CI_COMMIT_REF_NAME
# Cache libraries in between jobs
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- vendor/
- /composer/cache
- $HOME/.composer/cache
stages:
- configure-and-build
- deploy
- visual-test
- behat-test
- cleanup
before_script:
- export PATH="$PATH:$CI_PROJECT_DIR/.ci/scripts"
- export BASH_ENV="$HOME/.envvarsrc"
- /build-tools-ci/scripts/set-environment
- source $BASH_ENV
# See https://docs.gitlab.com/ee/ci/ssh_keys/README.html
- eval $(ssh-agent -s) && ssh-add <(echo "$SSH_PRIVATE_KEY")
- terminus -n auth:login --machine-token="$TERMINUS_TOKEN"
configure:env-vars:
stage: configure-and-build
before_script:
# See https://docs.gitlab.com/ee/ci/ssh_keys/README.html
- eval $(ssh-agent -s) && ssh-add <(echo "$SSH_PRIVATE_KEY")
script:
# Set TERMINUS_ENV and related environment variables.
# https://github.com/pantheon-systems/docker-build-tools-ci/blob/6.x/scripts/set-environment
- export PATH="$PATH:$CI_PROJECT_DIR/.ci/scripts"
- export BASH_ENV="$HOME/.envvarsrc"
- /build-tools-ci/scripts/set-environment
- source $BASH_ENV
- cp $BASH_ENV bash_env.txt
artifacts:
paths:
- bash_env.txt
only:
- merge_requests
- master
test:static:
stage: configure-and-build
script:
- ./.ci/test/static/run
only:
- merge_requests
- master
build:php:
stage: configure-and-build
script:
- ./.ci/build/php
artifacts:
paths:
- web
- vendor
- drush
only:
- merge_requests
- master
deploy:pantheon:
stage: deploy
environment:
name: deploy/$TERMINUS_ENV
url: https://$TERMINUS_ENV-$TERMINUS_SITE.pantheonsite.io/
script:
- echo "Target site.env is $TERMINUS_SITE.$TERMINUS_ENV"
- ./.ci/deploy/pantheon/dev-multidev
dependencies:
- build:php
only:
- merge_requests
- master
test:visual-regression:
stage: visual-test
image:
name: backstopjs/backstopjs:4.1.9
entrypoint: [""]
variables:
CI_BUILD_URL: $CI_PIPELINE_IID
CI_REPOSITORY_URL: $CI_MERGE_REQUEST_IID
ARTIFACTS_DIR_URL: https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/jobs/$CI_JOB_ID/artifacts
before_script:
# See https://docs.gitlab.com/ee/ci/ssh_keys/README.html
- eval $(ssh-agent -s) && ssh-add <(echo "$SSH_PRIVATE_KEY")
- export BASH_ENV="$HOME/.envvarsrc"
- cp bash_env.txt $BASH_ENV
- source $BASH_ENV
script:
- ./.ci/test/visual-regression/run
artifacts:
paths:
- backstop_data
dependencies:
- configure:env-vars
- deploy:pantheon
only:
- merge_requests
test:behat:
stage: behat-test
script:
- ./.ci/test/behat/initialize
# Start headless Chrome
- google-chrome --disable-gpu --headless --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222 --no-sandbox </dev/null &>/dev/null &
- ./.ci/test/behat/run
artifacts:
paths:
- behat-screenshots
dependencies:
- deploy:pantheon
- test:visual-regression
only:
- merge_requests
- master
test:behat:cleanup:
stage: cleanup
when: always
script:
- ./.ci/test/behat/cleanup
only:
- merge_requests
- master
dependencies:
- test:behat