diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..2a9994d --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,132 @@ +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: + key: + description: "Cache key" + default: "3.1" + type: string + steps: + - restore_cache: + keys: + - bundle-v1-{{ arch }}-<< parameters.key >> + - run: + name: Install Ruby Dependencies + command: | + gem install bundler --conservative --no-document || \ + gem install rubygems-update -v '<3' && update_rubygems && 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.key >>-{{ checksum "Gemfile.lock" }} + +jobs: + rubocop: + executor: + name: ruby + version: "2.7" + steps: + - checkout + - bundle_install: + key: "2.7" + - run: bundle exec rubocop + spec: + parameters: + ruby: + description: "Ruby version number" + default: "3.1" + type: string + executor: + name: ruby + version: << parameters.ruby >> + steps: + - checkout + - run: echo sshkit=master >> $BASH_ENV + - bundle_install: + key: << parameters.ruby >> + - run: bundle exec rake test + spec_legacy_ruby: + parameters: + ruby: + description: "Ruby version number" + default: "1.9" + type: string + sshkit: + description: "sshkit version number" + default: "1.6.1" + type: string + executor: + name: ruby + version: << parameters.ruby >> + steps: + - checkout + - run: | + echo "export sshkit=<< parameters.sshkit >>" >> $BASH_ENV + if [ "<< parameters.ruby >>" == "1.9" ]; then + echo "export RUBYOPT=-Ku" >> $BASH_ENV + fi + - bundle_install: + key: << parameters.ruby >>-<< parameters.sshkit >> + - run: bundle exec rake test + +workflows: + version: 2 + commit-workflow: + jobs: + - rubocop + - spec: + matrix: &matrix + parameters: + ruby: + - "2.4" + - "2.5" + - "2.6" + - "2.7" + - "3.0" + - "3.1" + - spec_legacy_ruby: + matrix: &legacy_ruby_matrix + parameters: + ruby: + - "1.9" + - "2.0" + - "2.1" + - "2.2" + - "2.3" + sshkit: + - "1.6.1" + - "1.7.1" + - master + exclude: + - ruby: "1.9" + sshkit: master + cron-workflow: + jobs: + - rubocop + - spec: + matrix: + <<: *matrix + - spec_legacy_ruby: + matrix: + <<: *legacy_ruby_matrix + triggers: + - schedule: + cron: "0 13 * * 6" + filters: + branches: + only: + - master diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 50ee1d3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -sudo: false -language: ruby -cache: bundler -branches: - only: - - master -rvm: - - 1.9 - - 2.0 - - 2.1 - - 2.2.10 - - 2.3.8 - - 2.4.5 - - 2.5.3 - - ruby-head -env: - - sshkit="master" - - sshkit="= 1.7.1" - - sshkit="= 1.6.1" -matrix: - exclude: - # Older versions of SSHKit don't work with Ruby 2.4+, so skip those - - rvm: 2.4.5 - env: sshkit="= 1.7.1" - - rvm: 2.4.5 - env: sshkit="= 1.6.1" - - rvm: 2.5.3 - env: sshkit="= 1.7.1" - - rvm: 2.5.3 - env: sshkit="= 1.6.1" - - rvm: ruby-head - env: sshkit="= 1.7.1" - - rvm: ruby-head - env: sshkit="= 1.6.1" - # Newer versions of SSHKit don't work with Ruby 1.9 - - rvm: 1.9 - env: sshkit="master" - -before_install: - - gem install bundler -v 1.17.3 --conservative --no-document - - gem install executable-hooks --conservative --no-document -install: - - bundle _1.17.3_ install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle} || bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0d016f7..107834d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,7 @@ Note that Bundler 1.10 is required for development. Run `gem update bundler` to After checking out the airbrussh repo, run `bin/setup` to install dependencies. Run `rake` to execute airbrussh's tests and RuboCop checks. -Airbrussh is designed to work against multiple versions of SSHKit and Ruby. In order to test this, we use the environment variable `sshkit` in order to run the tests against a specific version. The combinations of sshkit and ruby we support are specified in [.travis.yml](.travis.yml). To test all the versions locally, there is a `test_all.rb` bin file. This installs the gems and runs the tests for each sshkit version in [.travis.yml](.travis.yml). *Note: this will update your `Gemfile.lock` as each SSHKit gem version is installed. The gem version is restored to the default when the script exits.* +Airbrussh is designed to work against multiple versions of SSHKit and Ruby. In order to test this, we use the environment variable `sshkit` in order to run the tests against a specific version. The combinations of sshkit and ruby we support are specified in [.circleci/config.yml](.circleci/config.yml). A Guardfile is also present, so if you'd like to use Guard to do a TDD workflow, then: diff --git a/Gemfile b/Gemfile index 585ffa1..abd0120 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,7 @@ gemspec if RUBY_VERSION == "1.9.3" # These gems need specific version for Ruby 1.9 gem "json", "~> 1.8" + gem "minitest", "~> 5.11.3" gem "net-ssh", "~> 2.8" gem "rake", "< 12.3" gem "term-ansicolor", "~> 1.3.2" @@ -40,7 +41,7 @@ if (sshkit_version = ENV["sshkit"]) else ["capistrano", sshkit_version] end - { :github => "#{user}/sshkit", :branch => branch } + { :git => "https://github.com/#{user}/sshkit.git", :branch => branch } end gem "sshkit", requirement end diff --git a/README.md b/README.md index 6d44cad..91a2e7d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Airbrussh [![Gem Version](https://badge.fury.io/rb/airbrussh.svg)](http://badge.fury.io/rb/airbrussh) -[![Build Status](https://travis-ci.org/mattbrictson/airbrussh.svg?branch=master)](https://travis-ci.org/mattbrictson/airbrussh) +[![Build Status](https://circleci.com/gh/mattbrictson/airbrussh/tree/master.svg?style=shield)](https://app.circleci.com/pipelines/github/mattbrictson/airbrussh?branch=master) [![Build status](https://ci.appveyor.com/api/projects/status/h052rlq54sne3md6/branch/master?svg=true)](https://ci.appveyor.com/project/mattbrictson/airbrussh/branch/master) [![Code Climate](https://codeclimate.com/github/mattbrictson/airbrussh/badges/gpa.svg)](https://codeclimate.com/github/mattbrictson/airbrussh) [![Coverage Status](https://coveralls.io/repos/mattbrictson/airbrussh/badge.svg?branch=master)](https://coveralls.io/r/mattbrictson/airbrussh?branch=master) diff --git a/airbrussh.gemspec b/airbrussh.gemspec index 5898957..69ea9e9 100644 --- a/airbrussh.gemspec +++ b/airbrussh.gemspec @@ -29,7 +29,7 @@ Gem::Specification.new do |spec| spec.add_dependency "sshkit", [">= 1.6.1", "!= 1.7.0"] - spec.add_development_dependency "bundler", "~> 1.17" + spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 12.0" spec.add_development_dependency "minitest", "~> 5.10" spec.add_development_dependency "minitest-reporters", "~> 1.1" diff --git a/bin/test_all.rb b/bin/test_all.rb deleted file mode 100755 index e092640..0000000 --- a/bin/test_all.rb +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env ruby -require "yaml" -require "English" - -ruby24 = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.4.0") - -YAML.load_file(".travis.yml")["env"].each do |sshkit_version| - # Older versions of SSHKit don't work with Ruby 2.4, so skip those - next if ruby24 && sshkit_version !~ /master/ - puts "\e[0;34;49m== Running tests against #{sshkit_version} ==\e[0m" - output = `#{sshkit_version} bundle update` - raise "bundle update failed: #{output}" unless $CHILD_STATUS.success? - system("#{sshkit_version} bundle exec rake test") -end - -system("bundle exec rake rubocop") - -at_exit do - puts "\e[0;34;49m== Resetting sshkit ==\e[0m" - system("bundle update") -end diff --git a/test/support/coveralls.rb b/test/support/coveralls.rb index ab2f5f5..f3fe723 100644 --- a/test/support/coveralls.rb +++ b/test/support/coveralls.rb @@ -1,4 +1,4 @@ -if ENV["TRAVIS"] && RUBY_VERSION >= "2.1" +if ENV["CI"] && RUBY_VERSION >= "2.1" require "simplecov" require "coveralls"