-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
78 lines (70 loc) · 2.11 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
image: composer
# Default Variables
variables:
TEST_SITE_NAME: Example D8 Composer Test Site
ADMIN_EMAIL: [email protected]
TERMINUS_SITE: mg-ci-example-d8
TERMINUS_ENV: ci-$CI_PIPELINE_ID
TERMINUS_ENV_LABEL: CI-$CI_PIPELINE_ID
MULTIDEV_DELETE_PATTERN: ^ci-
CGR_BASE_DIR: /composer/.global
CGR_BIN_DIR: /composer/vendor/bin
# Default Cache Directories
cache:
paths:
- /composer/cache
stages:
- build
- test
- deploy
before_script:
# See https://docs.gitlab.com/ee/ci/ssh_keys/README.html
- eval $(ssh-agent -s) && ssh-add <(echo "$SSH_PRIVATE_KEY")
# Avoid ssh prompting when connecting to new ssh hosts
- mkdir -p $HOME/.ssh && echo "StrictHostKeyChecking no" >> "$HOME/.ssh/config"
# Git Config
- git config --global user.email "$GITLAB_USER_EMAIL"
- git config --global user.name "Gitlab CI"
# Composer and Terminus Setup
- export PATH="/composer/vendor/bin:tests/scripts:$PATH"
- composer global require "hirak/prestissimo:^0.3"
- composer global require "consolidation/cgr"
- cgr "pantheon-systems/terminus:~1" --stability beta
- cgr "drush/drush:~8"
- mkdir -p ~/.terminus/plugins
- composer create-project -d ~/.terminus/plugins pantheon-systems/terminus-build-tools-plugin:~1
deploy_multidev:
stage: build
environment:
name: review/ci-$CI_PIPELINE_ID
url: https://ci-$CI_PIPELINE_ID-mg-ci-example-d8.pantheonsite.io/
on_stop: stop_review
script:
- terminus auth:login --machine-token="$TERMINUS_TOKEN"
- terminus build-env:delete "$TERMINUS_SITE" "$MULTIDEV_DELETE_PATTERN" --keep=2 --delete-branch --yes
- composer build-assets
- create-pantheon-multidev
- scripts/gitlab/add-commit-comment
stop_review:
variables:
GIT_STRATEGY: none
script:
- terminus site delete-env --yes
when: manual
environment:
name: review/ci-$CI_PIPELINE_ID
action: stop
test:
stage: test
script:
- run-behat
deploy:
stage: deploy
environment:
name: dev
url: https://dev-$TERMINUS_SITE.pantheonsite.io/
only:
- master
script:
- tests/scripts/merge-pantheon-multidev
- terminus drush $TERMINUS_SITE.dev -- updatedb --yes