This repository has been archived by the owner on Jun 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathparallel_workflow.yml
152 lines (148 loc) · 4.24 KB
/
parallel_workflow.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# 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
# cache keys
restore_bundle_keys: &restore_bundle_keys
keys:
- nokul-bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
- nokul-bundle-{{ checksum "Gemfile.lock" }}
restore_yarn_keys: &restore_yarn_keys
keys:
- nokul-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
- nokul-yarn-{{ checksum "yarn.lock" }}
save_bundle_keys: &save_bundle_keys
key: nokul-bundle-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
save_bundle_branch_keys: &save_bundle_branch_keys
key: nokul-bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
save_yarn_keys: &save_yarn_keys
key: nokul-yarn-{{ checksum "yarn.lock" }}
paths:
- node_modules/
save_yarn_branch_keys: &save_yarn_branch_keys
key: nokul-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules/
# 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:
<<: *restore_bundle_keys
- run: bundle install --path vendor/bundle --without development
- save_cache:
<<: *save_bundle_keys
- save_cache:
<<: *save_bundle_branch_keys
- restore_cache:
<<: *restore_yarn_keys
- run: bin/yarn install
- save_cache:
<<: *save_yarn_keys
- save_cache:
<<: *save_yarn_branch_keys
- 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:
<<: *restore_bundle_keys
- run: bundle install --path vendor/bundle --without development
- save_cache:
<<: *save_bundle_keys
- save_cache:
<<: *save_bundle_branch_keys
- restore_cache:
<<: *restore_yarn_keys
- run: bin/yarn install
- save_cache:
<<: *save_yarn_keys
- save_cache:
<<: *save_yarn_branch_keys
- 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:
<<: *restore_bundle_keys
- run: bundle install --path vendor/bundle --without development
- save_cache:
<<: *save_bundle_keys
- save_cache:
<<: *save_bundle_branch_keys
- restore_cache:
<<: *restore_yarn_keys
- run: bin/yarn install
- save_cache:
<<: *save_yarn_keys
- save_cache:
<<: *save_yarn_branch_keys
- 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