diff --git a/.circleci/config.yml b/.circleci/config.yml index a3b3957..ccde50d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/.gitignore b/.gitignore index 0b5422d..892d936 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /tmp/ .*.swp *.gem +vendor/bundle \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml index 5bfb1f4..c51d94d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,6 +4,7 @@ AllCops: TargetRubyVersion: 2.3 Exclude: - "examples/*.rb" + - vendor/**/* # # Opinionated cops @@ -12,7 +13,7 @@ AllCops: Layout/DotPosition: EnforcedStyle: trailing -Layout/IndentHash: +Layout/IndentFirstHashElement: EnforcedStyle: consistent Metrics/AbcSize: diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..338a5b5 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.6.6 diff --git a/Gemfile.lock b/Gemfile.lock index 293c5d8..5a68b66 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -192,7 +192,7 @@ PLATFORMS DEPENDENCIES actionmailer (~> 5.0) bugsnag - bundler (~> 1.13) + bundler checker_jobs! mailcatcher pronto @@ -206,4 +206,4 @@ DEPENDENCIES simplecov BUNDLED WITH - 1.17.0 + 2.1.4 diff --git a/checker_jobs.gemspec b/checker_jobs.gemspec index 7fe671e..d4cfbae 100644 --- a/checker_jobs.gemspec +++ b/checker_jobs.gemspec @@ -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"