From 5fe49bd6ea388b4dba19c658e8ba19d05802945f Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sun, 9 Jan 2022 11:21:33 -0800 Subject: [PATCH] Switch from Travis to Circle CI (#2100) --- .circleci/config.yml | 113 +++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 30 ------------ DEVELOPMENT.md | 4 +- README.md | 2 +- Rakefile | 15 +++--- 5 files changed, 125 insertions(+), 39 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 .travis.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..05be7728 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,113 @@ +version: 2.1 + +executors: + ruby: + parameters: + version: + description: "Ruby version number" + default: "3.1" + type: string + docker: + - image: ruby:<< parameters.version >> + +commands: + bundle_install: + description: Install Ruby dependencies with Bundler + parameters: + version: + description: "Ruby version number" + default: "3.1" + type: string + steps: + - restore_cache: + keys: + - bundle-v1-{{ arch }}-<< parameters.version >> + - run: + name: Install Ruby Dependencies + command: | + gem install bundler --conservative --no-document || gem install bundler -v '< 2' --no-document + bundle config --local path vendor/bundle + bundle check || (bundle install --jobs=4 --retry=3 && bundle clean) + - save_cache: + paths: + - ./vendor/bundle + key: bundle-v1-{{ arch }}-<< parameters.version >>-{{ checksum "Gemfile.lock" }} + +jobs: + danger: + executor: ruby + steps: + - checkout + - bundle_install + - run: bundle exec danger + + rubocop: + executor: ruby + steps: + - checkout + - bundle_install + - run: bundle exec rubocop + + spec: + parameters: + version: + description: "Ruby version number" + default: "3.1" + type: string + executor: + name: ruby + version: << parameters.version >> + steps: + - checkout + - bundle_install: + version: << parameters.version >> + - run: bundle exec rake spec + +workflows: + version: 2 + commit-workflow: + jobs: + - danger + - rubocop + - spec: + matrix: + parameters: + version: + [ + "2.0", + "2.1", + "2.2", + "2.3", + "2.4", + "2.5", + "2.6", + "2.7", + "3.0", + "3.1", + ] + cron-workflow: + jobs: + - rubocop + - spec: + matrix: + parameters: + version: + [ + "2.0", + "2.1", + "2.2", + "2.3", + "2.4", + "2.5", + "2.6", + "2.7", + "3.0", + "3.1", + ] + triggers: + - schedule: + cron: "0 13 * * 6" + filters: + branches: + only: + - master diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 547b0818..00000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: ruby -rvm: - - 3.0 - - 2.7 - - 2.6 - - 2.5 - - 2.4 - - 2.3 - - 2.2 - - 2.1 - - 2.0 -matrix: - # Rubinius periodically fails in general, and it always segfaults for RuboCop - # in particular. Until we figure out how to make it work consistently, allow - # it to fail without breaking the build. - allow_failures: - - rvm: rbx-2 - include: - - rvm: rbx-2 - script: bundle exec rake spec - # Run Danger only once, on 2.5 - - rvm: 2.5 - before_script: bundle exec danger - -script: bundle exec rake spec rubocop -install: bundle install --jobs=1 -cache: bundler -branches: - only: - - master diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index cb07d198..ee10ed67 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -53,7 +53,7 @@ $ bundle exec rake features KEEP_RUNNING=1 ### Report failing Cucumber features! -Currently, the Capistrano Travis build does *not* run the Cucumber suite. This means it is possible for a failing Cucumber feature to sneak in without being noticed by our continuous integration checks. +Currently, the Capistrano CI build does *not* run the Cucumber suite. This means it is possible for a failing Cucumber feature to sneak in without being noticed by our continuous integration checks. **If you come across a failing Cucumber feature, this is a bug.** Please report it by opening a GitHub issue. Or even better: do your best to fix the feature and submit a pull request! @@ -63,7 +63,7 @@ This project uses [RuboCop](https://github.com/bbatsov/rubocop) to enforce stand * Test that your contributions pass with `rake rubocop` * Rubocop is also run as part of the full test suite with `rake` -* Note the Travis build will fail and your PR cannot be merged if Rubocop finds errors +* Note the CI build will fail and your PR cannot be merged if Rubocop finds errors ## Submitting a pull request diff --git a/README.md b/README.md index c36c3b2d..e5511a6c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Capistrano: A deployment automation tool built on Ruby, Rake, and SSH. -[![Gem Version](https://badge.fury.io/rb/capistrano.svg)](http://badge.fury.io/rb/capistrano) [![Build Status](https://travis-ci.org/capistrano/capistrano.svg?branch=master)](https://travis-ci.org/capistrano/capistrano) [![Code Climate](https://codeclimate.com/github/capistrano/capistrano/badges/gpa.svg)](https://codeclimate.com/github/capistrano/capistrano) [![CodersClan](https://img.shields.io/badge/get-support-blue.svg)](http://codersclan.net/?repo_id=325&source=small) +[![Gem Version](https://badge.fury.io/rb/capistrano.svg)](http://badge.fury.io/rb/capistrano) [![Build Status](https://circleci.com/gh/capistrano/capistrano/tree/master.svg?style=shield)](https://app.circleci.com/pipelines/github/capistrano/capistrano?branch=master) [![Code Climate](https://codeclimate.com/github/capistrano/capistrano/badges/gpa.svg)](https://codeclimate.com/github/capistrano/capistrano) [![CodersClan](https://img.shields.io/badge/get-support-blue.svg)](http://codersclan.net/?repo_id=325&source=small) Capistrano is a framework for building automated deployment scripts. Although Capistrano itself is written in Ruby, it can easily be used to deploy projects of any language or framework, be it Rails, Java, or PHP. diff --git a/Rakefile b/Rakefile index bacd10c4..cb0b83c4 100644 --- a/Rakefile +++ b/Rakefile @@ -1,16 +1,19 @@ require "bundler/gem_tasks" require "cucumber/rake/task" require "rspec/core/rake_task" -require "rubocop/rake_task" -task default: %i(spec rubocop) +begin + require "rubocop/rake_task" + desc "Run RuboCop checks" + RuboCop::RakeTask.new + task default: %i(spec rubocop) +rescue LoadError + task default: :spec +end + RSpec::Core::RakeTask.new - Cucumber::Rake::Task.new(:features) -desc "Run RuboCop checks" -RuboCop::RakeTask.new - Rake::Task["release"].enhance do puts "Don't forget to publish the release on GitHub!" system "open https://github.com/capistrano/capistrano/releases"