Skip to content

Commit

Permalink
CI setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gerrypower committed Oct 3, 2022
1 parent 73a70f0 commit 08c4f73
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 272 deletions.
56 changes: 48 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,53 @@
version: 2.1

# Note: This circleCi configuration is setup for gem development
# gem development specific configuration notes are below
# Give careful consideration to noted sections for a regular
# service or ruby project
#
references:
test_suite: &test_suite
run:
name: Run test suite
command: bundle exec rake spec

lint: &lint
run:
name: Code Checks
command: bundle exec rubocop --parallel

bundle: &bundle
run:
name: bundle install dependencies
command: bundle install

jobs:
build:
lint:
docker:
- image: ruby:2.7.2
- image: 'cimg/ruby:2.7'
steps:
- checkout
- run:
name: Run the default task
command: |
gem install bundler -v 2.2.11
bundle install
bundle exec rake
- <<: *bundle
- <<: *lint

test:
parameters:
ruby-version:
type: string
docker:
- image: 'cimg/ruby:<< parameters.ruby-version >>'
steps:
- checkout
- <<: *bundle
- <<: *test_suite

workflows:
build_and_test:
jobs:
- lint
- test:
requires:
- lint
matrix:
parameters:
ruby-version: ['2.7', '3.0', '3.1']
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# gem
Gemfile.lock

# Mac
.DS_Store
.AppleDouble
.LSOverride
Expand Down
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RSpec/MultipleMemoizedHelpers:
AllCops:
TargetRubyVersion: 2.4
NewCops: enable
SuggestExtensions: false

Layout/LineLength:
Max: 120
Expand Down
264 changes: 0 additions & 264 deletions Gemfile.lock

This file was deleted.

15 changes: 15 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,19 @@ require 'rubocop/rake_task'
RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new

RUBY_VERSIONS = '2.7, 3.0, 3.1'

desc 'Run guard and spec for each supported ruby'
task :spec_all do
RUBY_VERSIONS.split(',').map(&:strip).each do |ruby_version|
puts "----- #{ruby_version} -----"
Bundler.with_unbundled_env do
File.delete('Gemfile.lock')
system("RBENV_VERSION=#{ruby_version} bundle install")
abort unless system("RBENV_VERSION=#{ruby_version} bundle exec rake rubocop")
abort unless system("RBENV_VERSION=#{ruby_version} bundle exec rake spec")
end
end
end

task default: %i[spec rubocop]

0 comments on commit 08c4f73

Please sign in to comment.