diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..c644b0c --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,45 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby + +name: CI - PR/master + +on: + workflow_dispatch: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.0 + bundler-cache: true + - name: Rubocop checks + run: bundle exec rubocop + + test: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['2.6', '2.7', '3.0'] + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, + # change this to (see https://github.com/ruby/setup-ruby#versioning): + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: bundle exec rake diff --git a/.rubocop.yml b/.rubocop.yml index fc91e01..da7eef1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -7,6 +7,14 @@ require: - standard - rubocop-performance +AllCops: + SuggestExtensions: false + Exclude: + - 'node_modules/**/*' + - 'tmp/**/*' + - 'vendor/**/*' + - '.git/**/*' + Style/TrailingCommaInArguments: Enabled: true EnforcedStyleForMultiline: consistent_comma diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a03382f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: ruby -cache: bundler -rvm: - - 2.5.8 - - 2.6.6 - - 2.7.2 -before_install: - - gem install bundler -install: bundle update --jobs=3 --retry=3 - -stages: - - lint - - test - -jobs: - include: - - stage: lint - name: "Linter" - language: ruby - rvm: 2.7.1 - before_install: - - gem install bundler - install: bundle update --jobs=3 --retry=3 - script: bundle exec rubocop diff --git a/scalingo.gemspec b/scalingo.gemspec index 680f5b3..70243d1 100644 --- a/scalingo.gemspec +++ b/scalingo.gemspec @@ -42,7 +42,8 @@ Gem::Specification.new do |s| s.add_development_dependency "bundler", "~> 2.0" s.add_development_dependency "rake", "~> 13.0" s.add_development_dependency "rspec", "~> 3.0" - s.add_development_dependency "standard", "~> 0.10.1" + s.add_development_dependency "standard", "~> 1.1.0" + s.add_development_dependency "rubocop-rspec" s.add_development_dependency "pry", "~> 0.13.1" s.add_development_dependency "webmock", "~> 3.10.0" end diff --git a/spec/scalingo/api/client_spec.rb b/spec/scalingo/api/client_spec.rb index e873902..cbff7f9 100644 --- a/spec/scalingo/api/client_spec.rb +++ b/spec/scalingo/api/client_spec.rb @@ -79,11 +79,11 @@ expect(mock).to receive(:new).with(instance).and_return("1st").once # Not yet loaded... - expect(instance.instance_variable_get(:"@handler")).to eq(nil) + expect(instance.instance_variable_get(:@handler)).to eq(nil) instance.handler # Memoized... - expect(instance.instance_variable_get(:"@handler")).not_to eq(nil) + expect(instance.instance_variable_get(:@handler)).not_to eq(nil) # More calls won't try to perform more instanciations instance.handler diff --git a/spec/scalingo/client_spec.rb b/spec/scalingo/client_spec.rb index a1f3d3d..8169e89 100644 --- a/spec/scalingo/client_spec.rb +++ b/spec/scalingo/client_spec.rb @@ -51,7 +51,7 @@ context "with access token" do it "is successful with valid token" do fake_response = OpenStruct.new( - "successful?": true, + successful?: true, data: {token: "response token"}, ) @@ -64,7 +64,7 @@ it "fails with invalid token" do fake_response = OpenStruct.new( - "successful?": false, + successful?: false, ) expect(subject.auth.tokens).to receive(:exchange).and_return(fake_response)