Skip to content

Commit

Permalink
Update CircleCI config
Browse files Browse the repository at this point in the history
  • Loading branch information
godric committed Mar 25, 2021
1 parent ff84123 commit 7420f00
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 40 deletions.
86 changes: 50 additions & 36 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,62 @@
version: 2
jobs:
build:
test-ruby:
docker:
- image: drivy/rails-ci:0.1.2
- image: cimg/ruby:2.6.6
steps:
- checkout

- run: git fetch origin --depth=1000

# Install CodeClimate test reporter binary, rebuild without cache to update the binary
- restore_cache:
key: cc_test_reporter
- run:
name: Install Code Climate test reporter
name: Install CMake, pkg-config and system dependencies
command: sudo apt update && sudo apt install cmake pkg-config libsqlite3-dev
- run:
name: Install Bundler
command: |
[ -f bin/cc-test-reporter ] || curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./bin/cc-test-reporter
chmod +x bin/cc-test-reporter
- restore_cache:
key: cc_test_reporter
paths:
- bin/cc-test-reporter

sudo gem update --system
gem install bundler --no-document
- run:
name: "Creating a Gemfile.lock without bundler's version"
command: "head -n -3 Gemfile.lock > Gemfile.lock.no-version"

# Bundle install with cache, Ignore bundler version
- restore_cache:
key: checker_jobs-{{ checksum "Gemfile.lock.no-version"}}
- run:
name: Install Ruby dependencies
command: bundle install --path vendor/bundle --jobs=`nproc`
- save_cache:
key: checker_jobs-{{ checksum "Gemfile.lock.no-version"}}
paths:
- vendor/bundle

name: Install dependencies (bundler)
command: |
bundle config set frozen 'true'
bundle config set path 'vendor/bundle'
bundle install --jobs=4
- run:
name: RSpec
name: Install linting dependencies (Bundler)
command: |
./bin/cc-test-reporter before-build
bundle exec rspec --format documentation
./bin/cc-test-reporter after-build --exit-code $?
bundle config set frozen 'true'
bundle config set path 'vendor/bundle'
bundle install --jobs=4
- run:
name: Lint Ruby sources (RSpec)
command: bundle exec rspec

lint-ruby:
docker:
- image: cimg/ruby:2.6.6
steps:
- checkout
- run:
name: Install CMake, pkg-config and system dependencies
command: sudo apt update && sudo apt install cmake pkg-config libsqlite3-dev
- run:
name: Install Bundler
command: |
sudo gem update --system
gem install bundler --no-document
- run:
name: Install dependencies (bundler)
command: |
bundle config set frozen 'true'
bundle config set path 'vendor/bundle'
bundle install --jobs=4
- run:
name: Pronto
command: bin/pronto-ci
name: Lint Ruby sources (Rubocop)
command: bundle exec rubocop

workflows:
version: 2
test-and-deploy:
jobs:
- test-ruby:
context: default
- lint-ruby:
context: default
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/tmp/
.*.swp
*.gem
vendor/bundle
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ AllCops:
TargetRubyVersion: 2.3
Exclude:
- "examples/*.rb"
- vendor/**/*

#
# Opinionated cops
Expand All @@ -12,7 +13,7 @@ AllCops:
Layout/DotPosition:
EnforcedStyle: trailing

Layout/IndentHash:
Layout/IndentFirstHashElement:
EnforcedStyle: consistent

Metrics/AbcSize:
Expand Down
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.6.6
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ PLATFORMS
DEPENDENCIES
actionmailer (~> 5.0)
bugsnag
bundler (~> 1.13)
bundler
checker_jobs!
mailcatcher
pronto
Expand All @@ -206,4 +206,4 @@ DEPENDENCIES
simplecov

BUNDLED WITH
1.17.0
2.1.4
2 changes: 1 addition & 1 deletion checker_jobs.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength

spec.add_development_dependency "actionmailer", "~> 5.0"
spec.add_development_dependency "bugsnag"
spec.add_development_dependency "bundler", "~> 1.13"
spec.add_development_dependency "bundler"
spec.add_development_dependency "mailcatcher"
spec.add_development_dependency "pronto"
spec.add_development_dependency "pronto-rubocop"
Expand Down

0 comments on commit 7420f00

Please sign in to comment.