Skip to content

Commit 72f05ca

Browse files
author
Arne De Herdt
authored
[CIOPS-1081] Set up CircleCI (#1)
### Description This pull request sets up the CircleCI pipeline to actually test our code against the entire build-matrix. This will allow us to verify that the gem is compatible with all supported Ruby on Rails versions used inside Custom Ink. The build matrix is based upon the compatiblity chart located at https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html ### Changes * Set up CircleCI * Set up the entire build matrix * Set up gem publishing ### Ticket [CIOPS-1081](https://customink.atlassian.net/browse/CIOPS-1081)
2 parents d4cd684 + a4482ff commit 72f05ca

File tree

19 files changed

+510
-146
lines changed

19 files changed

+510
-146
lines changed

.circleci/config.yml

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
---
2+
# ---------------------------------------------------------------------------------------------------------------------
3+
# CircleCI Snippets
4+
#
5+
# Reusable snippets are defined below this section. These are yaml fragments that can injected into the standard
6+
# CircleCI configuration, reducing the complexity of the entire block.
7+
# ---------------------------------------------------------------------------------------------------------------------
8+
version: 2.1
9+
10+
# ---------------------------------------------------------------------------------------------------------------------
11+
# CircleCI Commands Configuration
12+
#
13+
# Commands are re-usable steps that can be shared across jobs. For example the installation of gems using bundler or
14+
# waiting on a database connection. By defining them inside the commands section, they can be invoked as any standard
15+
# command on the system, but will already be preconfigured. This allows us to keep the jobs definition small and clean
16+
# ---------------------------------------------------------------------------------------------------------------------
17+
commands:
18+
install_dependencies:
19+
description: "Installs the required OS packages to ensure all gems compile"
20+
steps:
21+
- run:
22+
name: "Aptitude Install"
23+
command: |
24+
apt update
25+
apt install -y --no-install-recommends libsqlite3-dev pkg-config
26+
appraisal_install:
27+
description: "Performs the bundler installation, relying on the CircleCI cache for performance"
28+
parameters:
29+
ruby-version:
30+
type: string
31+
steps:
32+
- restore_cache:
33+
keys:
34+
- appraisal-cache-<< parameters.ruby-version >>-1.1-{{ checksum "is_it_ready.gemspec" }}
35+
- run:
36+
name: "Appraisal Install"
37+
command: |
38+
gem install bundler:1.17.3 --force
39+
bundle config --local path vendor/bundle
40+
bundle install --jobs 4 --retry 3
41+
bundle exec appraisal install
42+
- save_cache:
43+
key: appraisal-cache-<< parameters.ruby-version >>-1.1-{{ checksum "is_it_ready.gemspec" }}
44+
paths:
45+
- vendor/bundle
46+
47+
# ---------------------------------------------------------------------------------------------------------------------
48+
# CircleCI Job Configuration
49+
#
50+
# This section defines all the available jobs that can be executed inside a Workflow.
51+
# Think of a Job as a batch of tasks that need to be performed to setup the environment and perform a specific task
52+
# such as running RSpec, uploading the test results to CodeClimate etc.
53+
# ---------------------------------------------------------------------------------------------------------------------
54+
jobs:
55+
tests:
56+
parameters:
57+
ruby-version:
58+
type: string
59+
gemfile:
60+
type: string
61+
docker:
62+
- image: 916869144969.dkr.ecr.us-east-1.amazonaws.com/customink/ruby:focal-<< parameters.ruby-version >>
63+
user: root
64+
aws_auth:
65+
aws_access_key_id: ${PRODUCTION_AWS_ACCESS_KEY_ID}
66+
aws_secret_access_key: ${PRODUCTION_AWS_SECRET_ACCESS_KEY}
67+
environment:
68+
RAILS_ENV: test
69+
RACK_ENV: test
70+
steps:
71+
- checkout
72+
- install_dependencies
73+
- appraisal_install:
74+
ruby-version: << parameters.ruby-version >>
75+
- run:
76+
name: "Tests"
77+
command: bundle exec appraisal << parameters.gemfile >> rake test
78+
- store_artifacts:
79+
path: ./coverage
80+
- store_test_results:
81+
path: ./test/reports
82+
- store_artifacts:
83+
path: ./test/reports
84+
build_and_publish:
85+
docker:
86+
- image: 916869144969.dkr.ecr.us-east-1.amazonaws.com/customink/ruby:focal-3.0
87+
aws_auth:
88+
aws_access_key_id: ${PRODUCTION_AWS_ACCESS_KEY_ID}
89+
aws_secret_access_key: ${PRODUCTION_AWS_SECRET_ACCESS_KEY}
90+
user: root
91+
steps:
92+
- checkout
93+
- run:
94+
name: "Configure Rubygems"
95+
command: |
96+
mkdir ~/.gem
97+
touch ~/.gem/credentials
98+
echo "---" >> ~/.gem/credentials
99+
echo ":github: Bearer $CINK_CIRCLE_CI_GITHUB_PACKAGES_TOKEN" >> ~/.gem/credentials
100+
chmod 600 ~/.gem/credentials
101+
- run:
102+
name: "Gem build"
103+
command: gem build is_it_up.gemspec
104+
- run:
105+
name: "Gem Push"
106+
command: gem push --key github --host https://rubygems.pkg.github.com/customink is_it_up-*.gem
107+
108+
# ---------------------------------------------------------------------------------------------------------------------
109+
# CircleCI Workflow Execution Order
110+
#
111+
# Here we define the Workflow, the order of the various jobs and their dependencies.
112+
# This allows us to decide whether to run certain tasks sequentially or run several of them in parallel.
113+
# ---------------------------------------------------------------------------------------------------------------------
114+
workflows:
115+
version: 2.1
116+
build-and-test:
117+
jobs:
118+
# Ruby 2.2
119+
- tests:
120+
name: "Ruby 2.2 with Ruby on Rails 3.2"
121+
context: "customink"
122+
gemfile: "rails32"
123+
ruby-version: "2.2"
124+
- tests:
125+
name: "Ruby 2.2 with Ruby on Rails 4.0"
126+
context: "customink"
127+
gemfile: "rails40"
128+
ruby-version: "2.2"
129+
- tests:
130+
name: "Ruby 2.2 with Ruby on Rails 4.1"
131+
context: "customink"
132+
gemfile: "rails41"
133+
ruby-version: "2.2"
134+
- tests:
135+
name: "Ruby 2.2 with Ruby on Rails 4.2"
136+
context: "customink"
137+
gemfile: "rails42"
138+
ruby-version: "2.2"
139+
- tests:
140+
name: "Ruby 2.2 with Ruby on Rails 5.0"
141+
context: "customink"
142+
gemfile: "rails50"
143+
ruby-version: "2.2"
144+
- tests:
145+
name: "Ruby 2.2 with Ruby on Rails 5.1"
146+
context: "customink"
147+
gemfile: "rails51"
148+
ruby-version: "2.2"
149+
- tests:
150+
name: "Ruby 2.2 with Ruby on Rails 5.2"
151+
context: "customink"
152+
gemfile: "rails52"
153+
ruby-version: "2.2"
154+
# Ruby 2.3
155+
- tests:
156+
name: "Ruby 2.3 with Ruby on Rails 5.0"
157+
context: "customink"
158+
gemfile: "rails50"
159+
ruby-version: "2.3"
160+
- tests:
161+
name: "Ruby 2.3 with Ruby on Rails 5.1"
162+
context: "customink"
163+
gemfile: "rails51"
164+
ruby-version: "2.3"
165+
- tests:
166+
name: "Ruby 2.3 with Ruby on Rails 5.2"
167+
context: "customink"
168+
gemfile: "rails52"
169+
ruby-version: "2.3"
170+
# Ruby 2.4
171+
- tests:
172+
name: "Ruby 2.4 with Ruby on Rails 5.0"
173+
context: "customink"
174+
gemfile: "rails50"
175+
ruby-version: "2.4"
176+
- tests:
177+
name: "Ruby 2.4 with Ruby on Rails 5.1"
178+
context: "customink"
179+
gemfile: "rails51"
180+
ruby-version: "2.4"
181+
- tests:
182+
name: "Ruby 2.4 with Ruby on Rails 5.2"
183+
context: "customink"
184+
gemfile: "rails52"
185+
ruby-version: "2.4"
186+
# Ruby 2.5
187+
- tests:
188+
name: "Ruby 2.5 with Ruby on Rails 5.1"
189+
context: "customink"
190+
gemfile: "rails51"
191+
ruby-version: "2.5"
192+
- tests:
193+
name: "Ruby 2.5 with Ruby on Rails 5.2"
194+
context: "customink"
195+
gemfile: "rails52"
196+
ruby-version: "2.5"
197+
- tests:
198+
name: "Ruby 2.5 with Ruby on Rails 6.0"
199+
context: "customink"
200+
gemfile: "rails60"
201+
ruby-version: "2.5"
202+
- tests:
203+
name: "Ruby 2.5 with Ruby on Rails 6.1"
204+
context: "customink"
205+
gemfile: "rails61"
206+
ruby-version: "2.5"
207+
# Ruby 2.6
208+
- tests:
209+
name: "Ruby 2.6 with Ruby on Rails 5.2"
210+
context: "customink"
211+
gemfile: "rails52"
212+
ruby-version: "2.6"
213+
- tests:
214+
name: "Ruby 2.6 with Ruby on Rails 6.0"
215+
context: "customink"
216+
gemfile: "rails60"
217+
ruby-version: "2.6"
218+
- tests:
219+
name: "Ruby 2.6 with Ruby on Rails 6.1"
220+
context: "customink"
221+
gemfile: "rails61"
222+
ruby-version: "2.6"
223+
# Ruby 2.7
224+
- tests:
225+
name: "Ruby 2.7 with Ruby on Rails 6.0"
226+
context: "customink"
227+
gemfile: "rails60"
228+
ruby-version: "2.7"
229+
- tests:
230+
name: "Ruby 2.7 with Ruby on Rails 6.1"
231+
context: "customink"
232+
gemfile: "rails61"
233+
ruby-version: "2.7"
234+
- tests:
235+
name: "Ruby 2.7 with Ruby on Rails 7.0.0"
236+
context: "customink"
237+
gemfile: "rails70"
238+
ruby-version: "2.7"
239+
# Ruby 3.0
240+
- tests:
241+
name: "Ruby 3.0 with Ruby on Rails 7.0.0"
242+
context: "customink"
243+
gemfile: "rails70"
244+
ruby-version: "3.0"
245+
# Ruby 3.1
246+
- tests:
247+
name: "Ruby 3.1 with Ruby on Rails 7.0"
248+
context: "customink"
249+
gemfile: "rails7"
250+
ruby-version: "3.1"
251+
- build_and_publish:
252+
context: "customink"
253+
requires:
254+
- "Ruby 2.2 with Ruby on Rails 3.2"
255+
- "Ruby 2.2 with Ruby on Rails 4.0"
256+
- "Ruby 2.2 with Ruby on Rails 4.1"
257+
- "Ruby 2.2 with Ruby on Rails 4.2"
258+
- "Ruby 2.2 with Ruby on Rails 5.0"
259+
- "Ruby 2.2 with Ruby on Rails 5.1"
260+
- "Ruby 2.2 with Ruby on Rails 5.2"
261+
- "Ruby 2.3 with Ruby on Rails 5.0"
262+
- "Ruby 2.3 with Ruby on Rails 5.1"
263+
- "Ruby 2.3 with Ruby on Rails 5.2"
264+
- "Ruby 2.4 with Ruby on Rails 5.1"
265+
- "Ruby 2.4 with Ruby on Rails 5.2"
266+
- "Ruby 2.5 with Ruby on Rails 5.1"
267+
- "Ruby 2.5 with Ruby on Rails 5.2"
268+
- "Ruby 2.5 with Ruby on Rails 6.0"
269+
- "Ruby 2.5 with Ruby on Rails 6.1"
270+
- "Ruby 2.6 with Ruby on Rails 5.2"
271+
- "Ruby 2.6 with Ruby on Rails 6.0"
272+
- "Ruby 2.6 with Ruby on Rails 6.1"
273+
- "Ruby 2.7 with Ruby on Rails 6.0"
274+
- "Ruby 2.7 with Ruby on Rails 6.1"
275+
- "Ruby 2.7 with Ruby on Rails 7.0.0"
276+
- "Ruby 3.0 with Ruby on Rails 7.0.0"
277+
- "Ruby 3.1 with Ruby on Rails 7.0"
278+
filters:
279+
branches:
280+
only:
281+
- main

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ test/dummy/db/*.sqlite3
55
test/dummy/log/*.log
66
test/dummy/tmp/
77
test/dummy/.sass-cache
8+
gemfiles/
9+
vendor/
10+
Gemfile.lock

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.2.10

Appraisals

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This is the Appraisals file that determines which specific gems should be tested based upon the selected
2+
# Ruby version and Ruby on Rails framework.
3+
# Because each of these configurations have their own requirements, we will build a compatibility matrix and
4+
# make sure that each step includes the correct version of Ruby on Rails, and freezes the dependencies to the
5+
# requirements of that version.
6+
7+
# Ruby 2.2 will be used to test all EOL Ruby on Rails versions still in use by Custom Ink.
8+
# This is simply to provide a guarantee our code works against them until we can drop these versions.
9+
if ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new('2.3.0')
10+
appraise 'rails32' do
11+
gem 'rails', '~> 3.2.0'
12+
gem 'rake', '< 13'
13+
end
14+
15+
appraise 'rails40' do
16+
gem 'rails', '~> 4.0.0'
17+
gem 'rake', '< 13'
18+
end
19+
20+
appraise 'rails41' do
21+
gem 'rails', '~> 4.1.0'
22+
gem 'rake', '< 13'
23+
end
24+
25+
appraise 'rails42' do
26+
gem 'rails', '~> 4.2.0'
27+
gem 'rake', '< 13'
28+
end
29+
end
30+
31+
if ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new('2.5.0')
32+
appraise 'rails50' do
33+
gem 'rails', '~> 5.0.0'
34+
gem 'rake', '< 13'
35+
end
36+
end
37+
38+
if ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new('2.6.0')
39+
appraise 'rails51' do
40+
gem 'rails', '~> 5.1.0'
41+
gem 'rake', '< 13'
42+
end
43+
end
44+
45+
if ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new('2.7.0')
46+
appraise 'rails52' do
47+
gem 'rails', '~> 5.2.0'
48+
gem 'rake', '< 13'
49+
end
50+
end
51+
52+
# For Ruby versions >= 2.5.0 and < 3.0 we can test all Rails 6
53+
if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('2.5.0') && ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new('3.0.0')
54+
appraise 'rails60' do
55+
gem 'rails', '~> 6.0.0'
56+
end
57+
58+
appraise 'rails61' do
59+
gem 'rails', '~> 6.1.0'
60+
end
61+
end
62+
63+
# Ruby on Rails 7.0.0 recommends Ruby to be >= 2.7.0
64+
if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('2.7.0')
65+
appraise 'rails70' do
66+
gem 'rails', '7.0.0'
67+
end
68+
end
69+
70+
# Ruby on Rails 7.0.x recommend Ruby to be >= 3.1.0
71+
if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('3.1.0')
72+
appraise 'rails7' do
73+
gem 'rails', '~> 7.0.0'
74+
end
75+
end

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Is It Ready? CHANGELOG
2+
3+
## 0.0.2
4+
* Enabled the CircleCI Pipeline
5+
* Added the test matrix
6+
* Updated documentation
7+
8+
## 0.0.1
9+
* Initial implementation

0 commit comments

Comments
 (0)