From 3ae14f0e8330897ee1c107d394ead3edfb1584b8 Mon Sep 17 00:00:00 2001 From: Kenji Koshikawa Date: Fri, 3 Jul 2020 22:17:21 +0900 Subject: [PATCH 1/2] refs #1 setup GitHub Actions --- .github/workflows/gem-push.yml | 36 ++++++++++++++++++ .github/workflows/test.yml | 21 +++++++++++ .rubocop.yml | 69 ++++++++++++++++++++++++++++++++++ .travis.yml | 6 --- README.md | 3 ++ omniauth-timetree.gemspec | 5 ++- spec/spec_helper.rb | 7 ++++ 7 files changed, 140 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/gem-push.yml create mode 100644 .github/workflows/test.yml create mode 100644 .rubocop.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/gem-push.yml b/.github/workflows/gem-push.yml new file mode 100644 index 0000000..b0de291 --- /dev/null +++ b/.github/workflows/gem-push.yml @@ -0,0 +1,36 @@ +name: Ruby Gem + +on: + push: + branches: [master] + +jobs: + build: + name: Build + Publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby 2.6 + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6 + + - name: Build and test + run: | + gem install bundler + bundle install --jobs 4 --retry 3 + bundle exec rspec + env: + CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} + + - name: Publish to RubyGems + run: | + mkdir -p $HOME/.gem + touch $HOME/.gem/credentials + chmod 0600 $HOME/.gem/credentials + printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials + gem build *.gemspec + gem push *.gem + env: + GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..62679a3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,21 @@ +name: Test + +on: pull_request + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + - name: Build and test + run: | + gem install bundler + bundle install --jobs 4 --retry 3 + bundle exec rspec + env: + CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..20c874e --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,69 @@ +AllCops: + TargetRubyVersion: 2.6 + +Layout/AccessModifierIndentation: + EnforcedStyle: outdent + +Layout/HashAlignment: + Enabled: false + +Layout/DotPosition: + EnforcedStyle: trailing + +Layout/SpaceInsideHashLiteralBraces: + EnforcedStyle: no_space + +Lint/SuppressedException: + Enabled: false + +Metrics/BlockLength: + Enabled: false + +Metrics/BlockNesting: + Max: 2 + +Layout/LineLength: + AllowURI: true + Enabled: false + +Metrics/MethodLength: + CountComments: false + Max: 15 + +Metrics/ParameterLists: + Max: 4 + CountKeywordArgs: true + +Metrics/AbcSize: + Enabled: false + +Style/CollectionMethods: + PreferredMethods: + map: 'collect' + reduce: 'inject' + find: 'detect' + find_all: 'select' + +Style/Documentation: + Enabled: false + +Style/DoubleNegation: + Enabled: false + +Style/EachWithObject: + Enabled: false + +Style/Encoding: + Enabled: false + +Style/ExpandPathArguments: + Enabled: false + +Style/HashSyntax: + EnforcedStyle: hash_rockets + +Style/Lambda: + Enabled: false + +Style/RaiseArgs: + EnforcedStyle: compact \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 774944c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -language: ruby -cache: bundler -rvm: - - 2.6.3 -before_install: gem install bundler -v 2.1.4 diff --git a/README.md b/README.md index 8d67c28..17911fd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # Omniauth::Timetree +[![Test](https://github.com/koshilife/omniauth-timetree/workflows/Test/badge.svg)](https://github.com/koshilife/omniauth-timetree/actions?query=workflow%3ATest) +[![codecov](https://codecov.io/gh/koshilife/omniauth-timetree/branch/master/graph/badge.svg)](https://codecov.io/gh/koshilife/omniauth-timetree) [![Gem Version](https://badge.fury.io/rb/omniauth-timetree.svg)](http://badge.fury.io/rb/omniauth-timetree) +[![license](https://img.shields.io/github/license/koshilife/omniauth-timetree)](https://github.com/koshilife/omniauth-timetree/blob/master/LICENSE.txt) This gem contains the [TimeTree](https://timetreeapp.com/) strategy for OmniAuth. diff --git a/omniauth-timetree.gemspec b/omniauth-timetree.gemspec index 30ed21e..712a68a 100644 --- a/omniauth-timetree.gemspec +++ b/omniauth-timetree.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |spec| spec.metadata['homepage_uri'] = spec.homepage spec.metadata['source_code_uri'] = 'https://github.com/koshilife/omniauth-timetree' spec.metadata['changelog_uri'] = "#{spec.metadata['source_code_uri']}/blob/master/CHANGELOG.md" - spec.metadata['documentation_uri'] = 'https://www.rubydoc.info/gems/omniauth-timetree/' + spec.metadata['documentation_uri'] = "https://www.rubydoc.info/gems/omniauth-timetree/#{spec.version}" # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. @@ -29,7 +29,10 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.6.0' + spec.add_development_dependency 'bundler', '~> 2.0' + spec.add_development_dependency 'codecov', '~> 0.1.17' spec.add_development_dependency 'rake', '~> 12.0' spec.add_development_dependency 'rspec', '~> 3.0' + spec.add_development_dependency 'simplecov', '~> 0.18.5' end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bfda64f..3cfd42e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,10 @@ # frozen_string_literal: true +require 'simplecov' +SimpleCov.start +if ENV['CI'] == 'true' + require 'codecov' + SimpleCov.formatter = SimpleCov::Formatter::Codecov +end + require 'omniauth-timetree' From 88240d26f1c606e9b065259238c410a2d74772bf Mon Sep 17 00:00:00 2001 From: Kenji Koshikawa Date: Fri, 3 Jul 2020 22:23:20 +0900 Subject: [PATCH 2/2] set version '0.1.3' --- CHANGELOG.md | 5 +++++ lib/omniauth-timetree/version.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c868d26..e248603 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.1.3 + +- refs #1 setup GitHub Actions for rspec and pushing to RubyGems. +- measure code coverage + # 0.1.2 - fixed a bug for empty uid diff --git a/lib/omniauth-timetree/version.rb b/lib/omniauth-timetree/version.rb index 1c07f58..d035c14 100644 --- a/lib/omniauth-timetree/version.rb +++ b/lib/omniauth-timetree/version.rb @@ -2,6 +2,6 @@ module Omniauth module Timetree - VERSION = '0.1.2' + VERSION = '0.1.3' end end