diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml new file mode 100644 index 0000000..9198446 --- /dev/null +++ b/.github/workflows/danger.yml @@ -0,0 +1,19 @@ +name: PR Linter +on: [pull_request] +jobs: + danger: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + ruby-version: 3.1 + - run: | + # the personal token is public, this is ok, base64 encode to avoid tripping Github + TOKEN=$(echo -n NWY1ZmM5MzEyMzNlYWY4OTZiOGU3MmI3MWQ3Mzk0MzgxMWE4OGVmYwo= | base64 --decode) + DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose + diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml new file mode 100644 index 0000000..571aa08 --- /dev/null +++ b/.github/workflows/rubocop.yml @@ -0,0 +1,15 @@ +name: RuboCop +on: [push, pull_request] +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1 + bundler-cache: true + - name: Run RuboCop + run: bundle exec rubocop + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a8f74bc --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,25 @@ +name: Tests +on: [push, pull_request] +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + entry: + - { ruby: "2.7" } + - { ruby: "3.0" } + - { ruby: "3.1" } + - { ruby: ruby-head, ignore: true } + - { ruby: jruby-head, ignore: true } + name: Test (ruby=${{ matrix.entry.ruby }}) + steps: + - uses: actions/checkout@v2 + - name: Install Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + ruby-version: ${{ matrix.entry.ruby }} + - name: Run Tests + continue-on-error: ${{ matrix.entry.ignore || false }} + run: bundle exec rspec + diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3552c84..d65d3e8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,21 +1,44 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-05-15 23:25:38 -0400 using RuboCop version 0.81.0. +# on 2023-03-20 09:58:58 UTC using RuboCop version 1.48.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. # Offense count: 1 -# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms. +# Configuration parameters: Severity, Include. +# Include: **/*.gemspec +Gemspec/RequiredRubyVersion: + Exclude: + - 'open-weather-ruby-client.gemspec' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedMethods. +# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal? +Lint/RedundantSafeNavigation: + Exclude: + - 'lib/open_weather/endpoints/stations.rb' + +# Offense count: 1 +# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. +# CheckDefinitionPathHierarchyRoots: lib, spec, test, src # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS Naming/FileName: Exclude: - 'lib/open-weather-ruby-client.rb' -# Offense count: 76 -# Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/GlobalStdStream: + Exclude: + - 'lib/open_weather/logger.rb' + - 'spec/open_weather/client_spec.rb' + +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https Layout/LineLength: Max: 181 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8882f18..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: ruby - -cache: bundler - -rvm: - - 2.6.6 - -before_script: - - bundle exec danger diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6a7d61b..e27623d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -114,7 +114,7 @@ git push origin my-feature-branch -f ### Check on Your Pull Request -Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above. +Go back to your pull request after a few minutes and see whether it passed muster with GitHub Actions. Everything should look green, otherwise fix issues and amend your commit as described above. ### Be Patient diff --git a/Gemfile b/Gemfile index f83280a..0a417e0 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ group :development, :test do gem 'pry' gem 'rake' gem 'rspec' - gem 'rubocop', '~> 0.81.0' + gem 'rubocop', '~> 1.48.1' gem 'vcr' gem 'webmock' end diff --git a/README.md b/README.md index c7573d9..abe3f0f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ OpenWeather Ruby Client ======================= [![Gem Version](https://badge.fury.io/rb/open-weather-ruby-client.svg)](https://badge.fury.io/rb/open-weather-ruby-client) -[![Build Status](https://travis-ci.org/dblock/open-weather-ruby-client.svg?branch=master)](https://travis-ci.org/dblock/open-weather-ruby-client) A Ruby client for the [OpenWeather API v2.5 and v3.0](https://openweathermap.org/api). diff --git a/RELEASING.md b/RELEASING.md index 9de534a..bda68ae 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -11,7 +11,7 @@ bundle install rake ``` -Check that the last build succeeded in [Travis CI](https://travis-ci.org/dblock/open-weather-ruby-client) for all supported platforms. +Check that the last build succeeded in GitHub Actions for all supported platforms. Change "Next" in [CHANGELOG.md](CHANGELOG.md) to the current date. diff --git a/spec/open_weather/endpoints/stations_spec.rb b/spec/open_weather/endpoints/stations_spec.rb index 1ad56bb..f25fb22 100644 --- a/spec/open_weather/endpoints/stations_spec.rb +++ b/spec/open_weather/endpoints/stations_spec.rb @@ -114,7 +114,7 @@ } expect(client).to receive(:post) - .with('3.0/measurements', body: [create_params]) + .with('3.0/measurements', { body: [create_params] }) .and_call_original data = client.create_measurements([create_params])