Created
October 24, 2017 16:11
-
-
Save chrisroane/92a97f6f9a99323907879cac8ff6598f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set defaults to use for each job. | |
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs | |
defaults: &defaults | |
docker: | |
- image: chrisroane/frontline-docker-image:0.0.31 | |
working_directory: ~/medstat | |
environment: | |
TZ: "/usr/share/zoneinfo/America/New_York" | |
version: 2 | |
jobs: | |
build: | |
<<: *defaults | |
parallelism: 2 | |
steps: | |
- checkout | |
# If the cache was already created, use that. | |
- restore_cache: | |
key: v2-dependency-cache-{{ checksum "package.json" }} | |
# Install the necessary dependencies. | |
- run: | |
name: Install Dependencies | |
command: | | |
chmod +x ~/medstat/.circleci/build.sh | |
bash ~/medstat/.circleci/build.sh | |
# Save the cache directories. | |
- save_cache: | |
key: v2-dependency-cache-{{ checksum "package.json" }} | |
paths: | |
- $HOME/.composer/cache | |
- ~/medstat/vendor | |
- ~/medstat/.aquifer | |
- ~/.drush | |
- ~/solr | |
- ~/medstat/node_modules | |
- ~/.terminus | |
- ~/terminus | |
# Make sure the PHP + JS code passes validation. | |
- run: | |
name: Linting | |
command: case $CIRCLE_NODE_INDEX in 0) gulp phpcs --exit ;; 1) gulp eslint ;; esac | |
# Run aquifer build. | |
- run: | |
name: Aquifer Build | |
command: aquifer build | |
# Install Registry rebuild module. | |
- run: | |
name: Install Registry Rebuild Module | |
command: drush @medstat.local dl registry_rebuild-7.x-2.3 -n | |
# Start Selenium. | |
- run: | |
name: Start Selenium | |
command: xvfb-run java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar ~/selenium-server-standalone-3.3.1.jar | |
background: true | |
# Start Solr. | |
- run: | |
name: Start Solr | |
command: cd $HOME/solr/example/; java -jar start.jar >> $HOME/solr.log | |
background: true | |
# Restore the db cache. | |
- restore_cache: | |
keys: | |
- v1-db-cache | |
# Get the fresh database. | |
- run: | |
name: Copy Fresh DB Backup | |
no_output_timeout: 720 | |
command: aquifer run fresh-ci | |
# Prevent issues with the files directory. | |
- run: | |
name: Files Directory Permissions | |
command: | | |
sudo chmod -R g+s ~/medstat/files | |
sudo chmod -R 777 ~/medstat/files | |
# Run updates, cache clears, etc. | |
- run: | |
name: Final Aquifer Command - Clear drupal caches | |
command: aquifer run local | |
# Save the db cache directory. | |
- save_cache: | |
key: v1-db-cache | |
paths: | |
- db | |
# Create error screenshots directory. | |
- run: | |
name: Create Error Screenshots Directory | |
command: | | |
mkdir /tmp/behat_screenshots | |
chmod 777 /tmp/behat_screenshots | |
# Run Behat Tests in parallel. | |
- run: | |
name: Run Behat Tests | |
command: case $CIRCLE_NODE_INDEX in 0) behat -c behat.local.yml --tags "@node-0&&~@wip" ;; 1) behat -c behat.local.yml --tags "@node-1&&~@wip" ;; esac | |
# Store the artifacts. | |
- store_artifacts: | |
path: /tmp/behat_screenshots | |
# This is meant to push the code from github master to the Pantheon dev environment. | |
push_to_pantheon_dev: | |
<<: *defaults | |
steps: | |
- checkout | |
- restore_cache: | |
keys: | |
- v2-dependency-cache-{{ checksum "package.json" }} | |
- v1-db-cache | |
# Setup paths to installed software. | |
- run: | |
name: Setup Paths | |
command: | | |
chmod +x ~/medstat/.circleci/deploy.sh | |
bash ~/medstat/.circleci/deploy.sh | |
# Deploy to the master branch on Pantheon. | |
- run: | |
name: Deploy Code to Dev Pantheon | |
command: aquifer deploy-git -m "Automated deployment at $CIRCLE_SHA1" -b "master" -n "Deploy Bot" -a "devs@fourkitchens.com" | |
# Refresh the dev environment against the new codebase. | |
- run: | |
name: Final Aquifer Command - Clear drupal caches on Pantheon Dev | |
command: aquifer run dev | |
workflows: | |
version: 2 | |
build_and_test: | |
jobs: | |
# Install the dev dependencies, import database and run the behat tests. | |
- build | |
# Push to the Pantheon Dev environment. | |
- push_to_pantheon_dev: | |
requires: | |
- build | |
filters: | |
branches: | |
only: master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment