From b6f72e8ef13c8789b9c574cc5e8c4cefb5ecaa5f Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Fri, 22 Dec 2023 20:28:48 +0900 Subject: [PATCH] Add GitHub Workflow --- .github/workflows/tests.yml | 112 +++++++++++++++++++++++++ Gemfile | 13 +-- omniauth-rails_csrf_protection.gemspec | 9 +- 3 files changed, 126 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..7f496f7 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,112 @@ +name: tests + +on: [push, pull_request] + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - ruby: "2.4" + rails: ~> 4.2.0 + bundler: 1.17.3 + - ruby: "2.4" + rails: ~> 5.0.0 + - ruby: "2.4" + rails: ~> 5.1.0 + - ruby: "2.4" + rails: ~> 5.2.0 + + - ruby: "2.5" + rails: ~> 5.0.0 + - ruby: "2.5" + rails: ~> 5.1.0 + - ruby: "2.5" + rails: ~> 5.2.0 + - ruby: "2.5" + rails: ~> 6.0.0 + - ruby: "2.5" + rails: ~> 6.1.0 + + - ruby: "2.6" + rails: ~> 5.0.0 + - ruby: "2.6" + rails: ~> 5.1.0 + - ruby: "2.6" + rails: ~> 5.2.0 + - ruby: "2.6" + rails: ~> 6.0.0 + - ruby: "2.6" + rails: ~> 6.1.0 + + - ruby: "2.7" + rails: ~> 5.0.0 + - ruby: "2.7" + rails: ~> 5.1.0 + - ruby: "2.7" + rails: ~> 5.2.0 + - ruby: "2.7" + rails: ~> 6.0.0 + - ruby: "2.7" + rails: ~> 6.1.0 + - ruby: "2.7" + rails: ~> 7.0.0 + - ruby: "2.7" + rails: ~> 7.1.0 + + - ruby: "3.0" + rails: ~> 6.0.0 + - ruby: "3.0" + rails: ~> 6.1.0 + - ruby: "3.0" + rails: ~> 7.0.0 + - ruby: "3.0" + rails: ~> 7.1.0 + + - ruby: "3.1" + rails: ~> 6.0.0 + - ruby: "3.1" + rails: ~> 6.1.0 + - ruby: "3.1" + rails: ~> 7.0.0 + - ruby: "3.1" + rails: ~> 7.1.0 + - ruby: "3.1" + rails: edge + + - ruby: "3.2" + rails: ~> 6.0.0 + - ruby: "3.2" + rails: ~> 6.1.0 + - ruby: "3.2" + rails: ~> 7.0.0 + - ruby: "3.2" + rails: ~> 7.1.0 + - ruby: "3.2" + rails: edge + + - ruby: head + rails: ~> 6.0.0 + - ruby: head + rails: ~> 6.1.0 + - ruby: head + rails: ~> 7.0.0 + - ruby: head + rails: ~> 7.1.0 + - ruby: head + rails: edge + + env: + RAILS_VERSION: ${{ matrix.rails }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler: ${{ matrix.bundler }} + - name: Run bundle update + run: bundle update + - name: Run tests + run: bundle exec rake diff --git a/Gemfile b/Gemfile index bc6069d..a264c36 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,12 @@ source "https://rubygems.org" -# rubocop:disable Bundler/DuplicatedGem -if ENV["RAILS_VERSION"] - gem "rails", ENV["RAILS_VERSION"] -elsif ENV["RAILS_BRANCH"] - gem "rails", git: "https://github.com/rails/rails.git", branch: ENV["RAILS_BRANCH"] +if ENV["RAILS_VERSION"] == "edge" + gem "rails", git: "https://github.com/rails/rails.git", branch: "main" +end + +# Lock loofah to old version for Ruby 2.4 +unless RUBY_VERSION > "2.5" + gem "loofah", "~> 2.20.0" end -# rubocop:enable Bundler/DuplicatedGem gemspec diff --git a/omniauth-rails_csrf_protection.gemspec b/omniauth-rails_csrf_protection.gemspec index 4f65266..9817a62 100644 --- a/omniauth-rails_csrf_protection.gemspec +++ b/omniauth-rails_csrf_protection.gemspec @@ -31,7 +31,12 @@ Gem::Specification.new do |spec| spec.add_dependency "omniauth", "~> 2.0" spec.add_development_dependency "bundler" - spec.add_development_dependency "minitest" - spec.add_development_dependency "rails" + spec.add_development_dependency "minitest", "< 5.22.0" + + # We set requirement for Edge Rails in the Gemfile + unless ENV["RAILS_VERSION"] == "edge" + spec.add_development_dependency "rails", ENV["RAILS_VERSION"] + end + spec.add_development_dependency "rake" end