Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #212 from omu/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
msdundar authored Aug 14, 2018
2 parents 95fca1a + ddbeff8 commit 8ca8eaa
Show file tree
Hide file tree
Showing 57 changed files with 938 additions and 166 deletions.
4 changes: 3 additions & 1 deletion .buildpacks
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
https://github.com/heroku/heroku-buildpack-activestorage-preview.git
https://github.com/heroku/heroku-buildpack-nodejs.git#v123
https://github.com/heroku/heroku-buildpack-ruby.git#v183
https://github.com/heroku/heroku-buildpack-ruby.git#v190
https://github.com/mokolabs/heroku-buildpack-vips.git
158 changes: 112 additions & 46 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,114 @@
# Fan In/Fan Out Workflow

# environment variables
postgres_environment: &postgres_environment
environment:
POSTGRES_DB: nokul_test
POSTGRES_USER: nokul
POSTGRES_PASSWORD: nokul
rails_environment: &rails_environment
environment:
TZ: '/usr/share/zoneinfo/Asia/Istanbul'
RAILS_ENV: test
RACK_ENV: test
RDS_USERNAME: nokul
RDS_PASSWORD: nokul
RDS_HOSTNAME: localhost
RDS_PORT: 5432
BUNDLE_JOBS: 4

# flow defaults
defaults: &defaults
parallelism: 4

# cache keys
restore_bundle: &restore_bundle
keys:
- nokul-bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
- nokul-bundle-{{ .Branch }}
- nokul-bundle
restore_yarn: &restore_yarn
keys:
- nokul-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
- nokul-yarn-{{ .Branch }}
- nokul-yarn
repository: &repository
key: nokul-repo-{{ .Environment.CIRCLE_SHA1 }}

# build image
ruby_2_5_1: &ruby_2_5_1
<<: *defaults
docker:
- image: circleci/ruby:2.5.1-node-browsers
<<: *rails_environment
- image: circleci/postgres:10.5-alpine
<<: *postgres_environment

# build jobs
version: 2
jobs:
build:
working_directory: ~/nokul
docker:
- image: circleci/ruby:latest-node-browsers
environment:
TZ: '/usr/share/zoneinfo/Asia/Baghdad'
RAILS_ENV: test
RACK_ENV: test
RDS_USERNAME: nokul
RDS_PASSWORD: nokul
RDS_HOSTNAME: localhost
RDS_PORT: 5432
- image: circleci/postgres:9.6.7
environment:
POSTGRES_DB: nokul_test
POSTGRES_USER: nokul
POSTGRES_PASSWORD: nokul
checkout_code:
<<: *ruby_2_5_1
steps:
- checkout
- save_cache:
<<: *repository
paths:
- ~/project
bundle_dependencies:
<<: *ruby_2_5_1
steps:
- restore_cache:
keys:
- gem-cache-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
- gem-cache-{{ .Branch }}
- gem-cache
<<: *repository
- restore_cache:
keys:
- yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
- yarn-packages-{{ .Branch }}
- yarn-packages-master
- yarn-packages

<<: *restore_bundle
- run: bundle install --path vendor/bundle
- run: bin/yarn install

- save_cache:
key: gem-cache-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- save_cache:
key: gem-cache-{{ .Branch }}
paths:
- vendor/bundle
- save_cache:
key: gem-cache
key: nokul-bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
bundle_assets:
<<: *ruby_2_5_1
steps:
- restore_cache:
<<: *repository
- restore_cache:
<<: *restore_bundle
- restore_cache:
<<: *restore_yarn
- run: bin/yarn install
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
key: nokul-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules/

rake_test:
<<: *ruby_2_5_1
steps:
- restore_cache:
<<: *repository
- restore_cache:
<<: *restore_bundle
- restore_cache:
<<: *restore_yarn
- run: bundle --path vendor/bundle
- run: bundle install
- run: bin/yarn install
- run: bundle exec rake db:create db:schema:load
- run: bundle exec rake test
karma:
<<: *ruby_2_5_1
steps:
- restore_cache:
<<: *repository
- restore_cache:
<<: *restore_bundle
- restore_cache:
<<: *restore_yarn
- run: bundle --path vendor/bundle
- run: bundle install
- run: bin/yarn install
- run: bundle exec rake quality:rails
- run: bundle exec rake security:all
- run: bundle exec rake db:migrate
- run: bundle exec rake test
deploy:
machine:
enabled: true
Expand All @@ -67,14 +120,27 @@ jobs:
git remote add beta [email protected]:nokul &&
git push beta master
# build flow
workflows:
version: 2
build-and-deploy:
build-test-and-deploy:
jobs:
- build
- checkout_code
- bundle_dependencies:
requires:
- checkout_code
- bundle_assets:
requires:
- bundle_dependencies
- rake_test:
requires:
- bundle_assets
- karma:
requires:
- bundle_assets
- deploy:
requires:
- build
- karma
filters:
branches:
only: master
160 changes: 160 additions & 0 deletions .circleci/parallel_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Parallel Jobs Workflow

# environment variables
postgres_environment: &postgres_environment
environment:
POSTGRES_DB: nokul_test
POSTGRES_USER: nokul
POSTGRES_PASSWORD: nokul
rails_environment: &rails_environment
environment:
TZ: '/usr/share/zoneinfo/Asia/Istanbul'
RAILS_ENV: test
RACK_ENV: test
RDS_USERNAME: nokul
RDS_PASSWORD: nokul
RDS_HOSTNAME: localhost
RDS_PORT: 5432
BUNDLE_JOBS: 4

# cache keys
bundle_keys: &bundle_keys
keys:
- nokul-bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
- nokul-bundle-{{ .Branch }}
- nokul-bundle
yarn_keys: &yarn_keys
keys:
- nokul-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
- nokul-yarn-{{ .Branch }}
- nokul-yarn

# common flow steps
build_steps: &build_steps
- restore_cache:
<<: *bundle_keys
- run: bundle install --path vendor/bundle
- save_cache:
key: nokul-bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- restore_cache:
<<: *yarn_keys
- run: bin/yarn install
- save_cache:
key: nokul-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules/
- run: bundle exec rake quality:rails
- run: bundle exec rake security:all
- run: bundle exec rake db:migrate
- run: bundle exec rake test

# build jobs
version: 2
jobs:
build_2_4_4:
docker:
- image: circleci/ruby:2.4.4-node-browsers
<<: *rails_environment
- image: circleci/postgres:9.5.14-alpine
<<: *postgres_environment
steps:
- checkout
- run:
name: Echo ruby 2.4.4
command: |
echo "2.4.4" > .ruby-version
- restore_cache:
<<: *bundle_keys
- run: bundle install --path vendor/bundle
- save_cache:
key: nokul-bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- restore_cache:
<<: *yarn_keys
- run: bin/yarn install
- save_cache:
key: nokul-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules/
- run: bundle exec rake quality:rails
- run: bundle exec rake security:all
- run: bundle exec rake db:migrate
- run: bundle exec rake test
build_2_5_1:
docker:
- image: circleci/ruby:2.5.1-node-browsers
<<: *rails_environment
- image: circleci/postgres:9.6.10-alpine
<<: *postgres_environment
steps:
- checkout
- run:
name: Echo ruby 2.5.1
command: |
echo "2.5.1" > .ruby-version
- restore_cache:
<<: *bundle_keys
- run: bundle install --path vendor/bundle
- save_cache:
key: nokul-bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- restore_cache:
<<: *yarn_keys
- run: bin/yarn install
- save_cache:
key: nokul-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules/
- run: bundle exec rake quality:rails
- run: bundle exec rake security:all
- run: bundle exec rake db:migrate
- run: bundle exec rake test
build_2_6_0_preview2:
docker:
- image: circleci/ruby:2.6.0-preview2-node-browsers
<<: *rails_environment
- image: circleci/postgres:10.5-alpine
<<: *postgres_environment
steps:
- checkout
- run:
name: Echo ruby 2.6.0-preview2
command: |
echo "2.6.0-preview2" > .ruby-version
- restore_cache:
<<: *bundle_keys
- run: bundle install --path vendor/bundle
- save_cache:
key: nokul-bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- restore_cache:
<<: *yarn_keys
- run: bin/yarn install
- save_cache:
key: nokul-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules/
- run: bundle exec rake quality:rails
- run: bundle exec rake security:all
- run: bundle exec rake db:migrate
- run: bundle exec rake test

# build flow
workflows:
version: 2
build-test-and-deploy:
jobs:
- build_2_4_4
- build_2_5_1
- build_2_6_0_preview2
- deploy:
requires:
- build_2_5_1
filters:
branches:
only: master
Loading

0 comments on commit 8ca8eaa

Please sign in to comment.