Skip to content

Instantly share code, notes, and snippets.

@sabril
Last active September 6, 2017 00:26
Show Gist options
  • Save sabril/0735a237d3958b0aa7b59d0f0ba5ee17 to your computer and use it in GitHub Desktop.
Save sabril/0735a237d3958b0aa7b59d0f0ba5ee17 to your computer and use it in GitHub Desktop.
version: 2
jobs:
build:
working_directory: ~/circleci-demo-ruby-rails
docker:
- image: circleci/ruby:2.4.1-node
environment:
RAILS_ENV: test
PGHOST: 127.0.0.1
PGUSER: root
- image: circleci/postgres:9.6.2-alpine
environment:
POSTGRES_USER: root
POSTGRES_DB: circle-test_test
steps:
- checkout
# Restore bundle cache
- restore_cache:
keys:
- rails-demo-{{ checksum "Gemfile.lock" }}
- rails-demo-
# Bundle install dependencies
- run:
name: Install dependencies
command: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs 4 --retry 3
- run: sudo apt install postgresql-client
# Store bundle cache
- save_cache:
key: rails-demo-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- run:
name: Database Setup
command: |
bundle exec rake db:create
bundle exec rake db:migrate
- run:
name: Run All Test
command: DISABLE_SPRING=true bin/rake test test/
- run:
name: Deploy to heroku
branch: master
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
echo 'heroku.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAu8erSx6jh+8ztsfHwkNeFr/SZaSOcvoa8AyMpaerGIPZDB2TKNgNkMSYTLYGDK2ivsqXopo2W7dpQRBIVF80q9mNXy5tbt1WE04gbOBB26Wn2hF4bk3Tu+BNMFbvMjPbkVlC2hcFuQJdH4T2i/dtauyTpJbD/6ExHR9XYVhdhdMs0JsjP/Q5FNoWh2ff9YbZVpDQSTPvusUp4liLjPfa/i0t+2LpNCeWy8Y+V9gUlDWiyYwrfMVI0UwNCZZKHs1Unpc11/4HLitQRtvuk0Ot5qwwBxbmtvCDKZvj1aFBid71/mYdGRPYZMIxq1zgP1acePC1zfTG/lvuQ7d0Pe0kaw==' >> ~/.ssh/known_hosts
git push [email protected]:sabril-kampus-ror.git master
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment