Skip to content
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
53 changes: 53 additions & 0 deletions .github/workflows/ancient.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Ancient Ruby Support

on:
push:
branches:
- 'main'
tags:
- '!*' # Do not execute on tags
pull_request:
branches:
- '*'
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Ruby ${{ matrix.ruby }}
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
strategy:
fail-fast: false
matrix:
experimental: [false]
rubygems:
- "2.7.11"
bundler:
- none
gemfile:
- ancient
ruby:
- "2.3.8"
- "2.2.10"
runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby & Bundle
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
rubygems: ${{ matrix.rubygems }}
bundler: ${{ matrix.bundler }}
bundler-cache: true
- name: Run tests
run: bundle exec rspec
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Omniauth JWT Tests
on:
push:
branches:
- 'master'
- 'main'
tags:
- '!*' # Do not execute on tags
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ env:
on:
push:
branches:
- 'master'
- 'main'
tags:
- '!*' # Do not execute on tags
Expand All @@ -25,7 +24,7 @@ concurrency:

jobs:
test:
name: Specs with Coverage - Ruby ${{ matrix.ruby }} ${{ matrix.name_extra || '' }}
name: Specs with Coverage - Ruby ${{ matrix.ruby }}
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/legacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Legacy Ruby Support

on:
push:
branches:
- 'main'
tags:
- '!*' # Do not execute on tags
pull_request:
branches:
- '*'
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Ruby ${{ matrix.ruby }}
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
strategy:
fail-fast: false
matrix:
experimental: [false]
rubygems:
- "2.7.11"
bundler:
- none
gemfile:
- legacy
ruby:
- "2.6"
- "2.5"
- "2.4"
runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby & Bundle
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
rubygems: ${{ matrix.rubygems }}
bundler: ${{ matrix.bundler }}
bundler-cache: true
- name: Run tests
run: bundle exec rspec
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ spec/reports
test/tmp
test/version_tmp
tmp
gemfiles/*.gemfile.lock
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 2.3.8
13 changes: 12 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,15 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in omniauth-jwt.gemspec
gemspec

gem 'byebug'
# Development dependencies that rely on Ruby version >=
# Style
eval_gemfile "gemfiles/contexts/style.gemfile"

# Coverage
eval_gemfile "gemfiles/contexts/coverage.gemfile"

# Testing
eval_gemfile "gemfiles/contexts/testing.gemfile"

# Debug
eval_gemfile "gemfiles/contexts/debug.gemfile"
8 changes: 6 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ RSpec::Core::RakeTask.new(:spec)
desc "alias test task to spec"
task test: :spec

require "kettle-soup-cover"
Kettle::Soup::Cover.install_tasks
begin
require "kettle-soup-cover"
Kettle::Soup::Cover.install_tasks
rescue LoadError
# NOOP
end

task default: :spec
37 changes: 0 additions & 37 deletions discourse-omniauth-jwt.gemspec

This file was deleted.

20 changes: 20 additions & 0 deletions gemfiles/ancient.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

source "https://rubygems.org"

# Gemfile is only for local development.
# On CI we only need the gemspecs' dependencies (including development dependencies).
# Exceptions, if any, will be found in gemfiles/*

# Testing
gem "rack", "~> 2.1.4.3" # ruby 2.2.2
gem "json", "~> 2.5.1" # ruby 2.0

# Debugging
eval_gemfile "contexts/debug.gemfile"

gemspec path: "../"

gem "omniauth", "< 2"
2 changes: 2 additions & 0 deletions gemfiles/contexts/coverage.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Coverage
gem "kettle-soup-cover", "~> 1.0", ">= 1.0.2" # ruby 2.7
6 changes: 6 additions & 0 deletions gemfiles/contexts/debug.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ancient rubies do not have String#casecmp?
debugging = ENV['CI'].nil? && ENV.fetch('DEBUG', 'false')

if debugging && debugging[/true/i]
gem "byebug"
end
4 changes: 4 additions & 0 deletions gemfiles/contexts/style.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Style
gem "rubocop-lts", "~> 12.1", ">= 12.1.1" # ruby 2.7 - Lint Support for Ruby 2.4+
gem "rubocop-packaging", "~> 0.5", ">= 0.5.2" # ruby 2.6
gem "rubocop-rspec", "~> 2.25" # ruby 2.7
7 changes: 7 additions & 0 deletions gemfiles/contexts/testing.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Testing
gem "rack", "~> 3.0", ">= 3.0.8" # ruby 2.4
gem "rack-session", "~> 2.0" # ruby 2.4
gem "json", "~> 2.6", ">= 2.6.3" # ruby 2.3
gem "openssl", ">= 2.0" # ruby 2.3, v3.0 is >= 2.6, v3.2 is >= 2.7
gem "openssl-signature_algorithm", "~> 1.3" # ruby 2.4
gem "ed25519", "~> 1.3" # ruby 2.4
9 changes: 9 additions & 0 deletions gemfiles/coverage.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@ source "https://rubygems.org"
# On CI we only need the gemspecs' dependencies (including development dependencies).
# Exceptions, if any, will be found in gemfiles/*

# Coverage
eval_gemfile "contexts/coverage.gemfile"

# Testing
eval_gemfile "contexts/testing.gemfile"

# Debugging
eval_gemfile "contexts/debug.gemfile"

gemspec path: "../"
26 changes: 26 additions & 0 deletions gemfiles/legacy.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

source "https://rubygems.org"

# Gemfile is only for local development.
# On CI we only need the gemspecs' dependencies (including development dependencies).
# Exceptions, if any, will be found in gemfiles/*

# Testing
gem "rspec", "~> 3.12" # ruby *
gem "rack-test", "~> 2.1" # ruby 2.0
gem "rack" # ruby 2.4
gem "rack-session", "< 2", github: "pboling/rack-session", branch: "fix-missing-rack-session" # ruby < 2.4
gem "json" # ruby 2.3
gem "openssl" # ruby 2.3
gem "openssl-signature_algorithm" # ruby 2.4
gem "ed25519" # ruby 2.4

# Debugging
eval_gemfile "contexts/debug.gemfile"

gemspec path: "../"

gem "omniauth", "< 2"
9 changes: 9 additions & 0 deletions gemfiles/style.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@ source "https://rubygems.org"
# On CI we only need the gemspecs' dependencies (including development dependencies).
# Exceptions, if any, will be found in gemfiles/*

# Coverage
eval_gemfile "contexts/coverage.gemfile"

# Style
eval_gemfile "contexts/style.gemfile"

# Debugging
eval_gemfile "contexts/debug.gemfile"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/vanilla.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@ source "https://rubygems.org"
# On CI we only need the gemspecs' dependencies (including development dependencies).
# Exceptions, if any, will be found in gemfiles/*

# Coverage
eval_gemfile "contexts/coverage.gemfile"

# Testing
eval_gemfile "contexts/testing.gemfile"

# Debugging
eval_gemfile "contexts/debug.gemfile"

gemspec path: "../"
10 changes: 9 additions & 1 deletion lib/omniauth/jwt.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# External gems
require "version_gem"

# This gem
require "omniauth/jwt/version"
require "omniauth/strategies/jwt"
require "omniauth/strategies/jwt"

Omniauth::JWT::Version.class_eval do
extend VersionGem::Basic
end
4 changes: 3 additions & 1 deletion lib/omniauth/jwt/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Omniauth
module JWT
VERSION = "0.0.3"
module Version
VERSION = "0.1.0"
end
end
end
2 changes: 1 addition & 1 deletion lib/omniauth/strategies/jwt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def decoded
{
algorithms: default_algos,
jwks: options.jwks_loader
}.compact
}.delete_if {|_, v| v.nil? }
)
)[0]
rescue Exception => e
Expand Down
42 changes: 42 additions & 0 deletions omniauth-jwt2.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Get the GEMFILE_VERSION without *require* "my_gem/version", for code coverage accuracy
# See: https://github.com/simplecov-ruby/simplecov/issues/557#issuecomment-825171399
load "lib/omniauth/jwt/version.rb"
gem_version = Omniauth::JWT::Version::VERSION
Omniauth::JWT::Version.send(:remove_const, :VERSION)

Gem::Specification.new do |spec|
spec.name = "omniauth-jwt2"
spec.version = gem_version
spec.authors = ["Michael Bleigh", "Robin Ward", "Peter Boling"]
spec.email = ["mbleigh@mbleigh.com", "robin.ward@gmail.com", "peter.boling@gmail.com"]
spec.description = %q{An OmniAuth strategy to accept JWT-based single sign-on.}
spec.summary = %q{An OmniAuth strategy to accept JWT-based single sign-on.}
spec.homepage = "http://github.com/pboling/omniauth-jwt2"
spec.license = "MIT"
spec.required_ruby_version = ">= 2.2"

spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

# TODO: Since this gem supports Ruby >= 2.2 we need to ensure no gems are
# added here that require a newer version. Once this gem progresses to
# only support non-EOL Rubies, all dependencies can be listed in this
# gemspec, and the gemfiles/* pattern can be dispensed with.
spec.add_dependency "jwt", "~> 2.2", ">= 2.2.1" # ruby 2.1
spec.add_dependency "omniauth", ">= 1.1" # ruby 2.2

# Utilities
spec.add_dependency "version_gem", "~> 1.1", ">= 1.1.3" # ruby 2.2
spec.add_development_dependency "rake", "~> 13.0" # ruby 2.2, v13.1 is >= 2.3

# Hot reload
spec.add_development_dependency "guard" # ruby 1.9.3
spec.add_development_dependency "guard-rspec" # ruby *

# Testing
spec.add_development_dependency "rspec", "~> 3.12" # ruby *
spec.add_development_dependency "rack-test", "~> 2.1" # ruby 2.0
spec.add_development_dependency "rspec-pending_for", "~> 0.1" # ruby *
end
Loading