1+ ---
2+
13version : 2.1
24
35defaults : &defaults
@@ -13,26 +15,42 @@ references:
1315 restore_cache :
1416 keys :
1517 - ruby-smtp-mock-{{ checksum "smtp_mock.gemspec" }}
18+ paths :
19+ - ~/vendor/bundle
1620
1721 bundle_install : &bundle_install
1822 run :
1923 name : Installing gems
2024 command : |
21- bundle config set --local path 'vendor/bundle'
25+ bundle config set --local path '~/ vendor/bundle'
2226 bundle install
2327
2428 save_bundle_cache : &save_bundle_cache
2529 save_cache :
2630 key : ruby-smtp-mock-{{ checksum "smtp_mock.gemspec" }}
2731 paths :
28- - vendor/bundle
32+ - ~/ vendor/bundle
2933
3034 system_dependencies : &system_dependencies
3135 run :
3236 name : Installing system requirements
3337 command : |
3438 bundle exec smtp_mock -s -i ~
3539
40+ install_yamllint : &install_yamllint
41+ run :
42+ name : Installing Yamllint
43+ command : |
44+ sudo apt-get update -y
45+ sudo apt-get install -y yamllint
46+
47+ install_lefthook : &install_lefthook
48+ run :
49+ name : Installing Lefthook
50+ command : |
51+ curl -1sLf 'https://dl.cloudsmith.io/public/evilmartians/lefthook/setup.deb.sh' | sudo -E bash
52+ sudo apt-get install -y lefthook
53+
3654 install_codeclimate_reporter : &install_codeclimate_reporter
3755 run :
3856 name : Installing CodeClimate test reporter
@@ -43,14 +61,12 @@ references:
4361 use_latest_gemspec : &use_latest_gemspec
4462 run :
4563 name : Using latest gemspec
46- command : |
47- cp .circleci/gemspec_latest smtp_mock.gemspec
64+ command : cp .circleci/gemspecs/latest smtp_mock.gemspec
4865
4966 use_compatible_gemspec : &use_compatible_gemspec
5067 run :
5168 name : Using compatible gemspec
52- command : |
53- cp .circleci/gemspec_compatible smtp_mock.gemspec
69+ command : cp .circleci/gemspecs/compatible smtp_mock.gemspec
5470
5571jobs :
5672 linters-ruby :
@@ -67,12 +83,23 @@ jobs:
6783 - << : *restore_bundle_cache
6884 - << : *bundle_install
6985 - << : *save_bundle_cache
86+ - << : *install_yamllint
87+ - << : *install_lefthook
88+
89+ - run :
90+ name : Running code style linters
91+ command : lefthook run code-style-linters
7092
7193 - run :
72- name : Running Overcommit
94+ name : Running code performance linters
7395 command : |
74- bundle exec overcommit -s
75- SKIP=AuthorEmail,AuthorName bundle exec overcommit -r
96+ cp .circleci/linter_configs/.fasterer.yml .fasterer.yml
97+ lefthook run code-performance-linters
98+ rm .fasterer.yml
99+
100+ - run :
101+ name : Running code vulnerability linters
102+ command : lefthook run code-vulnerability-linters
76103
77104 tests-ruby :
78105 parameters :
@@ -116,22 +143,45 @@ jobs:
116143 parameters :
117144 ruby-version :
118145 type : string
119- docker :
120- - image : cimg/ruby:<< parameters.ruby-version >>
146+
147+ << : *defaults
148+
121149 steps :
122150 - checkout
151+
123152 - << : *use_compatible_gemspec
153+
124154 - ruby/install-deps :
125155 bundler-version : " 2.3.26"
126156 with-cache : false
127- path : ' ./vendor/custom_bundle'
157+ path : ' ~/vendor/custom_bundle'
158+
128159 - << : *system_dependencies
160+
129161 - run :
130162 name : Running compatibility tests
131163 command : bundle exec rspec
132164
165+ releasing-gem-from-ruby :
166+ parameters :
167+ ruby-version :
168+ type : string
169+
170+ << : *defaults
171+
172+ steps :
173+ - checkout
174+
175+ - add_ssh_keys :
176+ fingerprints :
177+ - " 55:d3:88:af:10:c9:b1:9d:53:f4:d8:fc:79:4c:69:f7"
178+
179+ - run :
180+ name : Publishing new release
181+ command : ./.circleci/scripts/release.sh
182+
133183workflows :
134- build_and_test :
184+ build_test_deploy :
135185 jobs :
136186 - linters-ruby :
137187 matrix :
@@ -145,3 +195,14 @@ workflows:
145195 matrix :
146196 parameters :
147197 ruby-version : ["2.5", "2.6", "2.7", "3.0"]
198+ - releasing-gem-from-ruby :
199+ requires :
200+ - linters-ruby
201+ - tests-ruby
202+ - compatibility-ruby
203+ matrix :
204+ parameters :
205+ ruby-version : ["2.5"]
206+ filters :
207+ branches :
208+ only : master
0 commit comments