Skip to content

Commit be65d5b

Browse files
committed
Add GitHub Workflow
1 parent 9fa4d35 commit be65d5b

File tree

5 files changed

+167
-8
lines changed

5 files changed

+167
-8
lines changed

.github/workflows/tests.yml

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
include:
11+
- ruby: "2.4"
12+
rails: ~> 4.2.0
13+
bundler: 1.17.3
14+
- ruby: "2.4"
15+
rails: ~> 5.0.0
16+
- ruby: "2.4"
17+
rails: ~> 5.1.0
18+
- ruby: "2.4"
19+
rails: ~> 5.2.0
20+
21+
- ruby: "2.5"
22+
rails: ~> 5.0.0
23+
- ruby: "2.5"
24+
rails: ~> 5.1.0
25+
- ruby: "2.5"
26+
rails: ~> 5.2.0
27+
- ruby: "2.5"
28+
rails: ~> 6.0.0
29+
- ruby: "2.5"
30+
rails: ~> 6.1.0
31+
32+
- ruby: "2.6"
33+
rails: ~> 5.0.0
34+
- ruby: "2.6"
35+
rails: ~> 5.1.0
36+
- ruby: "2.6"
37+
rails: ~> 5.2.0
38+
- ruby: "2.6"
39+
rails: ~> 6.0.0
40+
- ruby: "2.6"
41+
rails: ~> 6.1.0
42+
43+
- ruby: "2.7"
44+
rails: ~> 5.0.0
45+
- ruby: "2.7"
46+
rails: ~> 5.1.0
47+
- ruby: "2.7"
48+
rails: ~> 5.2.0
49+
- ruby: "2.7"
50+
rails: ~> 6.0.0
51+
- ruby: "2.7"
52+
rails: ~> 6.1.0
53+
- ruby: "2.7"
54+
rails: ~> 7.0.0
55+
- ruby: "2.7"
56+
rails: ~> 7.1.0
57+
58+
- ruby: "3.0"
59+
rails: ~> 6.0.0
60+
- ruby: "3.0"
61+
rails: ~> 6.1.0
62+
- ruby: "3.0"
63+
rails: ~> 7.0.0
64+
- ruby: "3.0"
65+
rails: ~> 7.1.0
66+
67+
- ruby: "3.1"
68+
rails: ~> 6.0.0
69+
- ruby: "3.1"
70+
rails: ~> 6.1.0
71+
- ruby: "3.1"
72+
rails: ~> 7.0.0
73+
- ruby: "3.1"
74+
rails: ~> 7.1.0
75+
- ruby: "3.1"
76+
rails: edge
77+
78+
- ruby: "3.2"
79+
rails: ~> 6.0.0
80+
- ruby: "3.2"
81+
rails: ~> 6.1.0
82+
- ruby: "3.2"
83+
rails: ~> 7.0.0
84+
- ruby: "3.2"
85+
rails: ~> 7.1.0
86+
- ruby: "3.2"
87+
rails: edge
88+
89+
- ruby: head
90+
rails: ~> 6.0.0
91+
- ruby: head
92+
rails: ~> 6.1.0
93+
- ruby: head
94+
rails: ~> 7.0.0
95+
- ruby: head
96+
rails: ~> 7.1.0
97+
- ruby: head
98+
rails: edge
99+
100+
env:
101+
RAILS_VERSION: ${{ matrix.rails }}
102+
runs-on: ubuntu-latest
103+
steps:
104+
- uses: actions/checkout@v4
105+
- uses: ruby/setup-ruby@v1
106+
with:
107+
ruby-version: ${{ matrix.ruby }}
108+
bundler: ${{ matrix.bundler }}
109+
- name: Run bundle update
110+
run: bundle update
111+
- name: Run tests
112+
run: bin/rake

Gemfile

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
source "https://rubygems.org"
22

3-
# rubocop:disable Bundler/DuplicatedGem
4-
if ENV["RAILS_VERSION"]
5-
gem "rails", ENV["RAILS_VERSION"]
6-
elsif ENV["RAILS_BRANCH"]
7-
gem "rails", git: "https://github.com/rails/rails.git", branch: ENV["RAILS_BRANCH"]
3+
if ENV["RAILS_VERSION"] == "edge"
4+
gem "rails", git: "https://github.com/rails/rails.git", branch: "main"
5+
end
6+
7+
if RUBY_VERSION > "3.4"
8+
# This gem is required for rails <= 7.1.0
9+
gem "mutex_m"
10+
end
11+
12+
# Lock loofah to old version for Ruby 2.4
13+
unless RUBY_VERSION > "2.5"
14+
gem "loofah", "~> 2.20.0"
815
end
9-
# rubocop:enable Bundler/DuplicatedGem
1016

1117
gemspec

bin/rake

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rake' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12+
13+
bundle_binstub = File.expand_path("bundle", __dir__)
14+
15+
if File.file?(bundle_binstub)
16+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17+
load(bundle_binstub)
18+
else
19+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21+
end
22+
end
23+
24+
require "rubygems"
25+
require "bundler/setup"
26+
27+
load Gem.bin_path("rake", "rake")

omniauth-rails_csrf_protection.gemspec

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ Gem::Specification.new do |spec|
3232

3333
spec.add_development_dependency "bundler"
3434
spec.add_development_dependency "minitest"
35-
spec.add_development_dependency "rails"
35+
36+
# We set requirement for Edge Rails in the Gemfile
37+
unless ENV["RAILS_VERSION"] == "edge"
38+
spec.add_development_dependency "rails", ENV["RAILS_VERSION"]
39+
end
40+
3641
spec.add_development_dependency "rake"
3742
end

test/test_helper.rb

+10-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ def silence_warnings
1818
gemfile do
1919
source "https://rubygems.org"
2020

21-
gem "rails"
21+
if ENV["RAILS_VERSION"] == "edge"
22+
gem "rails", git: "https://github.com/rails/rails.git", branch: "main"
23+
else
24+
gem "rails"
25+
end
26+
27+
if RUBY_VERSION > "3.4"
28+
gem "mutex_m"
29+
end
30+
2231
gem "omniauth"
2332
gem "omniauth-rails_csrf_protection", path: File.expand_path("..", __dir__)
2433
end

0 commit comments

Comments
 (0)