From e30bd17e6a3de8d7ca9887425b95533f466b408b Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Wed, 27 Sep 2023 15:22:03 +0300 Subject: [PATCH] Bump minimal ruby version to 2.7 and run tests in GitHub Actions --- .github/workflows/ruby.yml | 24 ++++++++++++++++++++++++ .travis.yml | 8 -------- README.md | 4 +--- omniauth-seb-elink.gemspec | 3 ++- spec/omniauth/strategies/seb_spec.rb | 7 ++++--- 5 files changed, 31 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/ruby.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..4a91e36 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,24 @@ +name: Ruby + +on: + push: + branches: + - main + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['2.7', '3.0', '3.1', '3.2'] + + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + 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 rspec diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3756708..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: ruby -rvm: - - 2.3 - - 2.4 - - 2.5 - - 2.6 - - 3.2 -script: bundle exec rspec diff --git a/README.md b/README.md index b39239b..a62353c 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,7 @@ Omniauth strategy for using SEB e-link as an authentication service provider. -[![Build Status](https://travis-ci.org/mitigate-dev/omniauth-seb-elink.svg?branch=master)](https://travis-ci.org/mitigate-dev/omniauth-seb-elink) - -Supported Ruby versions: 2.2+ +Supported Ruby versions: 2.7+ ## Related projects diff --git a/omniauth-seb-elink.gemspec b/omniauth-seb-elink.gemspec index 7d2f9d6..d46eb2e 100644 --- a/omniauth-seb-elink.gemspec +++ b/omniauth-seb-elink.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |gem| gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ['lib'] - gem.required_ruby_version = '>= 2.2.2' + gem.required_ruby_version = '>= 2.7' gem.add_runtime_dependency 'omniauth', '~> 2.1' gem.add_runtime_dependency 'i18n' @@ -27,4 +27,5 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'rspec' gem.add_development_dependency 'bundler' gem.add_development_dependency 'rake' + gem.add_development_dependency 'rack-session' end diff --git a/spec/omniauth/strategies/seb_spec.rb b/spec/omniauth/strategies/seb_spec.rb index e61456e..458f747 100644 --- a/spec/omniauth/strategies/seb_spec.rb +++ b/spec/omniauth/strategies/seb_spec.rb @@ -1,12 +1,13 @@ require 'spec_helper' require 'rack-protection' +require 'rack/session' describe OmniAuth::Strategies::Seb do PUBLIC_CRT = File.read(File.join(RSpec.configuration.cert_folder, 'response.public.pem')) SND_ID = 'AAA' let(:app){ Rack::Builder.new do |b| - b.use Rack::Session::Cookie, {secret: 'abc123'} + b.use Rack::Session::Cookie, {secret: '5242e6bd9daf0e9645c2d4e22b11ba8cee0bed44439906d5f1bd5dad409d8637'} b.use OmniAuth::Strategies::Seb, PUBLIC_CRT, SND_ID b.run lambda{|env| [404, {}, ['Not Found']]} end.to_app } @@ -76,7 +77,7 @@ context 'with non-existant public key file' do let(:app){ Rack::Builder.new do |b| - b.use Rack::Session::Cookie, {secret: 'abc123'} + b.use Rack::Session::Cookie, {secret: '5242e6bd9daf0e9645c2d4e22b11ba8cee0bed44439906d5f1bd5dad409d8637'} b.use(OmniAuth::Strategies::Seb, 'missing-public-key-file.pem', SND_ID ) b.run lambda{|env| [404, {}, ['Not Found']]} end.to_app } @@ -90,7 +91,7 @@ context 'with non-existant SND ID' do let(:app){ Rack::Builder.new do |b| - b.use Rack::Session::Cookie, {secret: 'abc123'} + b.use Rack::Session::Cookie, {secret: '5242e6bd9daf0e9645c2d4e22b11ba8cee0bed44439906d5f1bd5dad409d8637'} b.use(OmniAuth::Strategies::Seb, PUBLIC_CRT, nil ) b.run lambda{|env| [404, {}, ['Not Found']]} end.to_app }