Skip to content

Instantly share code, notes, and snippets.

Created November 22, 2017 22:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save chrisroane/3acf0e16203a7206f08d00090e9a5e26 to your computer and use it in GitHub Desktop.
# Start mysql and create database.
sudo service mysql start
mysql -uroot -e "CREATE DATABASE circle_test"
set -ex
# Install the required node modules.
npm install
npm rebuild node-sass
# Install composer dependencies.
composer install --no-ansi --no-interaction --optimize-autoloader --no-progress
# Start EXPORTing needed environment variables
# Circle CI 2.0 does not yet expand environment variables so they have to be manually EXPORTed
# Once environment variables can be expanded this section can be removed
# See:
# See:
# See:
echo 'export PATH=$PATH:$HOME/bin' >> $BASH_ENV
echo 'export BRANCH=$(echo $CIRCLE_BRANCH | grep -v '"'"'^\(master\|[0-9]\+.x\)$'"'"')' >> $BASH_ENV
echo 'export PR_ENV=${BRANCH:+pr-$BRANCH}' >> $BASH_ENV
# Set up global commands.
sudo ln -s ~/medstat/vendor/bin/terminus /usr/bin/terminus
sudo ln -s ~/medstat/vendor/bin/behat /usr/bin/behat
sudo ln -s ~/medstat/node_modules/.bin/aquifer /usr/bin/aquifer
# Refresh the bash.
source $BASH_ENV
# End EXPORTing needed environment variables
# Bail on errors
set +ex
# Setup Terminus and get aliases.
/usr/bin/env COMPOSER_BIN_DIR=$HOME/bin composer --working-dir=$HOME require pantheon-systems/terminus "^1"
terminus auth:login -n --machine-token="$PTOKEN" --email="$PEMAIL"
terminus aliases
# Configure drush.
sudo mkdir -p ~/.drush
cp ~/medstat/.circleci/settings/medstat.aliases.drushrc.php ~/.drush
drush cc drush
# Copy config files.
cp ~/medstat/.circleci/settings/ ~/medstat/behat.local.yml
cp ~/medstat/.circleci/settings/secret.settings.php ~/medstat/settings
echo $'Host *\nLogLevel quiet' >> ~/.ssh/config
# Load aquifer extensions.
test -d .aquifer || aquifer extensions-load
# Create directory for temporary + private files.
sudo mkdir ~/medstat/tmp
sudo mkdir ~/medstat/private
sudo chown -R www-data:www-data ~/medstat/tmp
sudo chown -R www-data:www-data ~/medstat/private
sudo chmod -R 777 ~/medstat/tmp
sudo chmod -R 777 ~/medstat/private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment