forked from fourkitchens/example-acquia-8-composer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
104 lines (95 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Required environmental variables should be set via the CircleCI web interface:
#
# - ACQUIA_USER
# Cloud API E-mail
# - ACQUIA_TOKEN
# Cloud API Private key. Located in your profile under security.
# See: https://docs.acquia.com/acquia-cloud/api/auth
# - ACQUIA_CANONICAL_ENV
# Environment to get database from. Usually "prod".
# - ACQUIA_ENDPOINT
# Cloud API Endpoint. Usually "https://cloudapi.acquia.com/v1".
# - ACQUIA_REALM
# Cloud API Realm. Usually "prod" or "devcloud".
# See: https://docs.acquia.com/acquia-cloud/api#realm
# - ACQUIA_SITE
# Cloud API Site parameter.
# - ACQUIA_REPO
# Acquia git repo url.
# - ACQUIA_BOT_EMAIL
# Email used to commit deployment commits.
# - ACQUIA_BOT_NAME
# Display name use for the deployment committer.
machine:
php:
version: 5.6.22
node:
version: 8.2.0
pre: []
hosts:
circleci.local: 127.0.0.1
dependencies:
pre:
- echo "memory_limit = 512M" > $PHPENV_ROOT/versions/$(phpenv global)/etc/conf.d/memory.ini
- "[[ ! -s \"$(git rev-parse --git-dir)/shallow\" ]] || git fetch --unshallow"
cache_directories:
- ~/.composer
- node_modules
- ~/.drush
- circle/artifacts
post:
# Set up global commands.
- sudo ln -s ~/$CIRCLE_PROJECT_REPONAME/vendor/bin/drush /usr/bin/drush
- sudo ln -s ~/$CIRCLE_PROJECT_REPONAME/vendor/bin/phpcs /usr/bin/phpcs
# Fail early if code quality is an issue.
- gulp lint
# Build assets here.
- gulp build
# Configure drush.
- sudo mkdir -p ~/.drush
- sudo chown -R ubuntu:ubuntu ~/.drush
- sed "s@{{CIRCLE_PROJECT_REPONAME}}@$CIRCLE_PROJECT_REPONAME@" ./circle/circleci.aliases.drushrc.php > ~/.drush/circleci.aliases.drushrc.php
- drush cc drush
# Drupal settings.
- cp ./circle/settings.local.php ./docroot/sites/default/settings.local.php
# Get the Database. For files I suggest Stage File Proxy.
- sudo chmod +x ./scripts/acquia/acquia-get-db-backup.sh
- sudo chmod +rx ./scripts/acquia/acquia-get-db-backup-id.php
- ./scripts/acquia/acquia-get-db-backup.sh $ACQUIA_REALM:$ACQUIA_SITE $ACQUIA_CANONICAL_ENV $ACQUIA_SITE
# Get the canonical database and files. Try two times. Sometimes the first one stalls out.
- drush @circleci.local fresh
# Run updates, cache clears, etc.
- drush @circleci.local local
# Configure Apache.
#- sed "s@{{CIRCLE_PROJECT_REPONAME}}@$CIRCLE_PROJECT_REPONAME@" ./circle/circleci > /etc/apache2/sites-available/circleci
#- sudo a2ensite circleci
#- sudo a2enmod rewrite
#- sudo service apache2 restart
test:
override:
- echo "Put Test Commands Here"
deployment:
dev:
branch: [develop, /release-.*/ , master]
commands:
- mkdir ~/git_vars
- echo "Deploying to the $CIRCLE_BRANCH on Acquia."
- git config --global user.email "$ACQUIA_BOT_EMAIL"
- git config --global user.name "$ACQUIA_BOT_NAME"
- git remote add acquia $ACQUIA_REPO
- git fetch acquia
- "sed -i '1,/######## ACQUIA IGNORE ABOVE ########/d' .gitignore"
# Remove any .git directories that may exist in vendor libraries* so those
# libraries don't get excluded from our repo. Remember kiddies somedir/*
# returns all files/dirs that are NOT dot (hidden). This protects our repos'
# .git folder from being blown away.
- find ./* -type d | grep .git | xargs rm -rf
# Remove unwanted gitignores here. Follow the example below.
# Remove simplesamlphp .gitignore which would cause our config and metadata
# symlinks to be ignored. If it's already not there, GREAT!
# - rm ./vendor/simplesamlphp/simplesamlphp/.gitignore || exit 0
# Commit and push to Acquia.
- git add .
- git commit -am "Built assets."
- git push acquia $CIRCLE_BRANCH -f --tags
- echo "If deployment was successful, Acquia Cloud dev/post-code-update hook will handle importing config, updating db, and clearing caches."