|
| 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 |
0 commit comments