This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy path.gitlab-ci.yml
93 lines (84 loc) · 2.43 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
# Build tools Dockerfile v4
image: quay.io/pantheon-public/build-tools-ci:4.x
# Default Variables
variables:
BEHAT_ADMIN_USERNAME: pantheon-ci-testing-$CI_JOB_ID
BEHAT_ADMIN_EMAIL: [email protected]
CI_PR_URL: $CI_MERGE_REQUEST_IID
CURRENT_BRANCH: $CI_COMMIT_REF_NAME
CGR_BASE_DIR: /composer/.global
CGR_BIN_DIR: /composer/vendor/bin
# Cache libraries in between jobs
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- vendor/
- /composer/cache
- $HOME/.composer/cache
stages:
- build
- test
- cleanup
before_script:
# See https://docs.gitlab.com/ee/ci/ssh_keys/README.html
- eval $(ssh-agent -s) && ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p $HOME/.ssh && echo "StrictHostKeyChecking no" >> "$HOME/.ssh/config"
- export PATH=$PATH:$HOME/bin:$HOME/terminus/bin
- export PR_ENV=${CI_MERGE_REQUEST_IID:+pr-$CI_MERGE_REQUEST_IID}
- export TERMINUS_ENV=${PR_ENV:-dev}
- export BEHAT_ADMIN_PASSWORD=$(openssl rand -base64 24)
- terminus auth:login --machine-token="$TERMINUS_TOKEN"
- git config --global user.email "$GITLAB_USER_EMAIL"
- git config --global user.name "Gitlab CI"
deploy:multidev:
stage: build
environment:
name: review/pr-$CI_MERGE_REQUEST_IID
url: https://pr-$CI_MERGE_REQUEST_IID-$TERMINUS_SITE.pantheonsite.io/
script:
- terminus build:env:delete:pr -n "$TERMINUS_SITE" --yes
- composer build-assets
- terminus env:wake -n "$TERMINUS_SITE.dev"
- terminus build-env:create -n "$TERMINUS_SITE.dev" "$TERMINUS_ENV" --yes
only:
- merge_requests
deploy:dev:
stage: build
environment:
name: dev
url: https://dev-$TERMINUS_SITE.pantheonsite.io/
script:
- composer build-assets
- terminus build-env:push-code $TERMINUS_SITE.dev
- terminus build:env:delete:pr -n "$TERMINUS_SITE" --yes
only:
- master
test:code_sniff_unit_test:
stage: test
script:
- composer install --no-ansi --no-interaction --optimize-autoloader --no-progress
- rm -rf web
- git checkout web
- composer -n code-sniff
- composer -n unit-test
only:
- merge_requests
- master
test:behat:
stage: test
script:
- composer install --no-ansi --no-interaction --optimize-autoloader --no-progress
- ./.ci/behat-test.sh
only:
- merge_requests
- master
test:behat:cleanup:
stage: cleanup
when: always
script:
- ./.ci/behat-test-cleanup.sh
only:
- merge_requests
- master
dependencies:
- test:behat