-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbitbucket-pipelines.yml
executable file
·154 lines (150 loc) · 4.73 KB
/
bitbucket-pipelines.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
143
144
145
146
147
148
149
150
151
152
153
154
# These are yaml anchors, reused later
x-bash-env-steps:
- &bash_env_export export BASH_ENV="$BITBUCKET_CLONE_DIR/.bashrc"
- &bash_env_source source $BASH_ENV
definitions:
steps:
- step: &env_vars
name: Configure Environment Variables
services:
- docker
caches:
- docker
script:
- *bash_env_export
- export CI_BRANCH=${BITBUCKET_BRANCH:-master} && echo $CI_BRANCH
- export PR_NUMBER=$BITBUCKET_PR_ID && echo $PR_NUMBER
- export CI_PR_URL=https://bitbucket.org/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/pull-requests/$BITBUCKET_PR_ID && echo $CI_PR_URL
- export CI_BUILD_NUMBER=$BITBUCKET_BUILD_NUMBER && echo $CI_BUILD_NUMBER
- export CI_PROJECT_USERNAME=$BITBUCKET_REPO_OWNER && echo $CI_PROJECT_USERNAME
- export CI_PROJECT_REPONAME=$BITBUCKET_REPO_SLUG && echo $CI_PROJECT_REPONAME
- export CI_PROJECT_NAME=$BITBUCKET_REPO_FULL_NAME && echo $CI_PROJECT_NAME
- /build-tools-ci/scripts/set-environment
- ./.ci/deploy/pantheon/check-terminus-env
- echo $TERMINUS_ENV
artifacts:
- .bashrc
- step: &static_test
name: Static Tests
services:
- docker
caches:
- docker
- composer
script:
- *bash_env_export
- *bash_env_source
- ./.ci/test/static/run
- step: &build
name: Build PHP
services:
- docker
caches:
- docker
- composer
script:
- *bash_env_export
- *bash_env_source
- ./.ci/build/php
artifacts:
- web/**
- vendor/**
- step: &deploy
name: Deploy to Pantheon
services:
- docker
caches:
- docker
script:
- *bash_env_export
- *bash_env_source
- ./.ci/deploy/pantheon/dev-multidev
artifacts:
- web/**
- vendor/**
- step: &ui_test
name: Test Visual Regression
image: backstopjs/backstopjs:4.1.9
services:
- docker
caches:
- docker
- node
script:
- *bash_env_export
- *bash_env_source
- ./.ci/test/visual-regression/run
artifacts:
- backstop_data/**
- step: &lighthouse_test
name: Run Lighthouse Tests
services:
- docker
script:
- *bash_env_export
- *bash_env_source
- npm i -g @lhci/cli
- ./tests/lighthouse/run
artifacts:
- tests/lighthouse/reports/**
- step: &cypress
name: Run Cypress Tests
services:
- docker
script:
- *bash_env_export
- *bash_env_source
- npm install
- export HAPPO_CURRENT_SHA=$BITBUCKET_COMMIT && echo $HAPPO_CURRENT_SHA
- export HAPPO_PREVIOUS_SHA=$([[ $BITBUCKET_PR_DESTINATION_BRANCH != "" ]] && git rev-parse origin/$BITBUCKET_PR_DESTINATION_BRANCH) && echo $HAPPO_PREVIOUS_SHA
- export HAPPO_CHANGE_URL=$([[ $BITBUCKET_PR_ID != "" ]] && $CI_PR_URL) && echo $HAPPO_CHANGE_URL
- ./tests/cypress/run
image: cypress/included:4.7.0
artifacts:
- tests/cypress/screenshots/**
- tests/cypress/videos/**
image: quay.io/pantheon-public/build-tools-ci:6.x
options:
max-time: 30
pipelines:
default:
- step: *env_vars
- step: *static_test
branches:
'{master,feature/*,bugfix/*,hotfix/*,release/*}':
- step: *env_vars
- parallel:
- step: *static_test
- step: *build
- step: *deploy
- step: *ui_test
- step: *lighthouse_test
- step: *functional_test
pull-requests:
'clu-*':
- step: *env_vars
- parallel:
- step: *static_test
- step: *build
- step: *deploy
- step: *ui_test
- step: *lighthouse_test
- step: *functional_test
custom:
clu:
- step:
name: Composer Lock Update
services:
- docker
caches:
- docker
- composer
script:
- export CI_BRANCH=${BITBUCKET_BRANCH:-master} && echo $CI_BRANCH
- export CI_BUILD_NUMBER=$BITBUCKET_BUILD_NUMBER && echo $CI_BUILD_NUMBER
- export CI_PROJECT_USERNAME=$BITBUCKET_REPO_OWNER && echo $CI_PROJECT_USERNAME
- export CI_PROJECT_REPONAME=$BITBUCKET_REPO_SLUG && echo $CI_PROJECT_REPONAME
- export CI_PROJECT_NAME=$BITBUCKET_REPO_FULL_NAME && echo $CI_PROJECT_NAME
- /build-tools-ci/scripts/set-environment
- terminus -n auth:login --machine-token="$TERMINUS_TOKEN"
- set -e && terminus project:clu $TERMINUS_SITE