Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Travis with CircleCI and add Ruby 3.0 and 3.1 to CI matrix #138

Merged
merged 8 commits into from
Jul 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion airbrussh.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
21 changes: 0 additions & 21 deletions bin/test_all.rb

This file was deleted.

2 changes: 1 addition & 1 deletion test/support/coveralls.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if ENV["TRAVIS"] && RUBY_VERSION >= "2.1"
if ENV["CI"] && RUBY_VERSION >= "2.1"
require "simplecov"
require "coveralls"

Expand Down