forked from tessak22/conquering-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
125 lines (105 loc) · 3.45 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
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
machine:
timezone:
America/Chicago
node:
version: 6.1.0
php:
version: 7.1.3
environment:
YARN_VERSION: 0.24.4
PATH: "${PATH}:${HOME}/.yarn/bin:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin:${HOME}/terminus/bin"
WORDPRESS_ADMIN_USERNAME: pantheon
# A random password is set in the dependencies:pre stage as a text file.
# This line reads the same file repeatedly. If the openssl call were used
# in this step, it would result in a different password being used in each
# line of other steps. Each CircleCI command runs in a separate shell.
WORDPRESS_ADMIN_PASSWORD: $(cat ~/WORDPRESS_ADMIN_PASSWORD)
# This will be added to the `/etc/hosts` file
hosts:
wp-best-practices.dev: 127.0.0.1
dependencies:
cache_directories:
- ~/.composer/cache
- ~/.terminus/tokens
- /home/ubuntu/nvm/versions/node/6.1.0/bin
- /home/ubuntu/nvm/versions/node/6.1.0/lib/node_modules
- /usr/local/bin/terminus
- ~/.yarn
- ~/.cache/yarn
- ~/terminus
pre:
# Dynamic hosts through Pantheon mean constantly checking interactively
# that we mean to connect to an unknown host. We ignore those here.
- echo Disabling strict host checking
- echo "StrictHostKeyChecking no" > ~/.ssh/config
# Set the PHP timezone so that Behat script does not fail.
#- echo "date.timezone = 'US/Central'" > /opt/circleci/php/5.6.14/etc/conf.d/xdebug.ini
# The environment step uses this file to set a global variable.
- echo $(openssl rand -hex 8) > ~/WORDPRESS_ADMIN_PASSWORD
# Install Yarn
- |
if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then
echo "Download and install Yarn."
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION
else
echo "The correct version of Yarn is already installed."
fi
# Use cURL to fetch WP-CLI
# - curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
# Make sure WP-CLI is executable
# - chmod +x wp-cli.phar
# Set github token to avoid rate limit
- |
echo "Setting GitHub OAuth token with suppressed ouput"
{
composer config --global github-oauth.github.com $GIT_TOKEN
} &> /dev/null
- git config --global user.email $GIT_EMAIL
- git config --global user.name $GIT_USERNAME
# Install gulp
- >
if [ -z "${RUN_BEHAT_BUILD}" ]; then
echo Installing gulp globally; yarn global add gulp
fi
# Install Terminus
- chmod -R 755 ./bin
- ./bin/install_terminus.sh
# Install jq
- >
if [ -n "${RUN_BEHAT_BUILD}" ]; then
sudo apt-get update; sudo apt-get install jq
fi
# Authenticate with Terminus
- ./bin/terminus_auth.sh
override:
- ./bin/install-composer-dependencies.sh
- >
if [ -z "${RUN_BEHAT_BUILD}" ]; then
./bin/build-gulp-assets.sh
fi
test:
pre:
- >
if [ -n "${RUN_BEHAT_BUILD}" ]; then
./bin/behat-prepare.sh;
fi
override:
- ./bin/test-wordpress-coding-standards.sh
- >
if [ -n "${RUN_BEHAT_BUILD}" ]; then
./bin/behat-test.sh --strict;
fi
- ./vendor/bin/phpunit
post:
- >
if [ -n "${RUN_BEHAT_BUILD}" ]; then
./bin/behat-cleanup.sh;
fi
deployment:
pantheon:
branch: /.*/
commands:
- >
if [ -z "${RUN_BEHAT_BUILD}" ]; then
./bin/deploy_to_pantheon.sh;
fi