-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
80 lines (77 loc) · 3.86 KB
/
circle.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
# https://circleci.com/docs/configuration#machine
machine:
timezone:
America/Chicago
php:
# https://circleci.com/docs/build-image-trusty/#php
version: 7.0.11
environment:
# In addition to the environment variables defined in this file, also
# add the following variables in the Circle CI UI.
#
# See: https://circleci.com/docs/1.0/environment-variables/
#
# TERMINUS_SITE: Name of the Pantheon site to run tests on, e.g. my_site
# TERMINUS_TOKEN: The Pantheon machine token
# GITHUB_TOKEN: The GitHub personal access token
# GIT_EMAIL: The email address to use when making commits
#
# TEST_SITE_NAME: The name of the test site to provide when installing.
# ADMIN_PASSWORD: The admin password to use when installing.
# ADMIN_EMAIL: The email address to give the admin when installing.
#
# The variables below usually do not need to be modified.
BRANCH: $(echo $CIRCLE_BRANCH | grep -v '^\(master\|[0-9]\+.x\)$')
PR_ENV: ${BRANCH:+pr-$BRANCH}
CIRCLE_ENV: ci-$CIRCLE_BUILD_NUM
DEFAULT_ENV: $(echo ${PR_ENV:-$CIRCLE_ENV} | tr '[:upper:]' '[:lower:]' | sed 's/[^0-9a-z-]//g' | cut -c -11 | sed 's/-$//')
TERMINUS_ENV: ${TERMINUS_ENV:-$DEFAULT_ENV}
NOTIFY: 'scripts/github/add-commit-comment {project} {sha} "Created multidev environment [{site}#{env}]({dashboard-url})." {site-url}'
PATH: $PATH:~/bin:tests/scripts
BUILD_TOOLS_VERSION: '^1'
dependencies:
cache_directories:
- ~/.composer/cache
pre:
- echo "Begin build for $CIRCLE_ENV${PR_ENV:+ for }$PR_ENV. Pantheon test environment is $TERMINUS_SITE.$TERMINUS_ENV"
- |
if [ -n "$GITHUB_TOKEN" ] ; then
composer -n config --global github-oauth.github.com $GITHUB_TOKEN
fi
- git config --global user.email "$GIT_EMAIL"
- git config --global user.name "Circle CI"
- git config --global core.fileMode false
override:
- composer -n global require -n "hirak/prestissimo:^0.3"
- /usr/bin/env COMPOSER_BIN_DIR=$HOME/bin composer -n --working-dir=$HOME require pantheon-systems/terminus "^1"
- terminus -n --version
- /usr/bin/env COMPOSER_BIN_DIR=$HOME/bin composer -n --working-dir=$HOME require drush/drush "^8"
- mkdir -p ~/.terminus/plugins
- composer -n create-project -d ~/.terminus/plugins pantheon-systems/terminus-build-tools-plugin:$BUILD_TOOLS_VERSION
- composer -n create-project -d ~/.terminus/plugins pantheon-systems/terminus-secrets-plugin:^1
post:
- terminus -n auth:login --machine-token="$TERMINUS_TOKEN"
- terminus -n build:env:delete:ci "$TERMINUS_SITE" --keep=2 --yes
- composer -n build-assets
- terminus -n env:wake "$TERMINUS_SITE.dev"
- terminus -n build:env:create "$TERMINUS_SITE.dev" "$TERMINUS_ENV" --yes --clone-content --db-only --notify="$NOTIFY"
- terminus -n drush "$TERMINUS_SITE.$TERMINUS_ENV" -- updatedb -y
- |
[ ! -f "config/system.site.yml" ] || terminus -n drush "$TERMINUS_SITE.$TERMINUS_ENV" -- config-import --yes
# Optional: replace lines above with lines below to re-install Drupal for every test.
# - terminus -n build:env:create "$TERMINUS_SITE.dev" "$TERMINUS_ENV" --yes --notify="$NOTIFY"
# - terminus -n build:env:install "$TERMINUS_SITE.$TERMINUS_ENV" --site-name="$TEST_SITE_NAME" --account-mail="$ADMIN_EMAIL" --account-pass="$ADMIN_PASSWORD"
test:
override:
- run-behat
post:
- terminus -n secrets:set "$TERMINUS_SITE.$TERMINUS_ENV" token "$GITHUB_TOKEN" --file='github-secrets.json' --clear --skip-if-empty
deployment:
build-assets:
branch: master
commands:
- terminus -n build:env:merge "$TERMINUS_SITE.$TERMINUS_ENV" --yes
- terminus -n drush $TERMINUS_SITE.dev -- updatedb --yes
- |
[ ! -f "config/system.site.yml" ] || terminus -n drush "$TERMINUS_SITE.dev" -- config-import --yes
- terminus -n build:env:delete:pr "$TERMINUS_SITE" --yes