Skip to content

Commit f959b81

Browse files
committed
feat!: modernize omniauth-spotify for ruby 4 and rails matrix
1 parent 45c14b0 commit f959b81

16 files changed

Lines changed: 782 additions & 211 deletions

File tree

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
id-token: write
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v6
19+
20+
- uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: '3.4'
23+
bundler-cache: false
24+
25+
- uses: rubygems/configure-rubygems-credentials@v1.0.0
26+
27+
- name: Build gem
28+
run: gem build omniauth-spotify.gemspec
29+
30+
- name: Publish gem
31+
run: gem push omniauth-spotify-*.gem

.github/workflows/test.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Test
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: test-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
test_strategy:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
ruby: ['3.2', '3.3', '3.4', '4.0']
24+
omniauth_oauth2: ['1.8.0']
25+
26+
steps:
27+
- uses: actions/checkout@v5
28+
29+
- name: Set up Ruby
30+
uses: ruby/setup-ruby@v1
31+
with:
32+
ruby-version: ${{ matrix.ruby }}
33+
bundler-cache: false
34+
35+
- name: Set matrix environment
36+
run: echo "OMNIAUTH_OAUTH2=${{ matrix.omniauth_oauth2 }}" >> "$GITHUB_ENV"
37+
38+
- name: Install dependencies
39+
run: |
40+
bundle config set frozen false
41+
bundle install --jobs 4 --retry 2
42+
43+
- name: Lint
44+
run: bundle exec rake lint
45+
46+
- name: Strategy tests
47+
run: bundle exec rake test_unit
48+
49+
- name: Strategy warnings check
50+
run: |
51+
bundle exec ruby -w -Itest test/omniauth_spotify_test.rb 2> warnings.log
52+
if grep -q "warning:" warnings.log; then
53+
cat warnings.log
54+
exit 1
55+
fi
56+
57+
test_rails_integration:
58+
runs-on: ubuntu-latest
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
ruby: ['3.2', '3.3', '3.4', '4.0']
63+
rails: ['~> 7.1.0', '~> 7.2.0', '~> 8.0.0', '~> 8.1.0']
64+
omniauth_oauth2: ['1.8.0']
65+
66+
steps:
67+
- uses: actions/checkout@v5
68+
69+
- name: Set up Ruby
70+
uses: ruby/setup-ruby@v1
71+
with:
72+
ruby-version: ${{ matrix.ruby }}
73+
bundler-cache: false
74+
75+
- name: Set matrix environment
76+
run: |
77+
echo "RAILS_VERSION=${{ matrix.rails }}" >> "$GITHUB_ENV"
78+
echo "OMNIAUTH_OAUTH2=${{ matrix.omniauth_oauth2 }}" >> "$GITHUB_ENV"
79+
80+
- name: Install dependencies
81+
run: |
82+
bundle config set frozen false
83+
bundle install --jobs 4 --retry 2
84+
85+
- name: Rails integration test
86+
run: bundle exec rake test_rails_integration
87+
88+
- name: Rails integration warnings check
89+
run: |
90+
bundle exec ruby -w -Itest test/rails_integration_test.rb 2> warnings.log
91+
if grep -q "warning:" warnings.log; then
92+
cat warnings.log
93+
exit 1
94+
fi

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*.rbc
33
.bundle
44
.config
5+
.DS_Store
56
.yardoc
67
Gemfile.lock
78
InstalledFiles

.rubocop.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
plugins:
2+
- rubocop-minitest
3+
4+
AllCops:
5+
TargetRubyVersion: 3.2
6+
NewCops: enable
7+
SuggestExtensions: false
8+
Exclude:
9+
- 'lib/omniauth-spotify.rb'
10+
- 'tmp/**/*'
11+
12+
Metrics/AbcSize:
13+
Exclude:
14+
- 'test/**/*'
15+
16+
Metrics/ClassLength:
17+
Exclude:
18+
- 'lib/omniauth/strategies/spotify.rb'
19+
- 'test/rails_integration_test.rb'
20+
- 'test/omniauth_spotify_test.rb'
21+
22+
Metrics/MethodLength:
23+
Exclude:
24+
- 'test/**/*'
25+
26+
Style/OneClassPerFile:
27+
Exclude:
28+
- 'test/rails_integration_test.rb'
29+
30+
Minitest/MultipleAssertions:
31+
Exclude:
32+
- 'test/rails_integration_test.rb'
33+
- 'test/omniauth_spotify_test.rb'

Gemfile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24

3-
# Specify your gem's dependencies in omniauth-box2.gemspec
45
gemspec
6+
7+
if ENV['OMNIAUTH_OAUTH2'] == 'head'
8+
gem 'omniauth-oauth2', git: 'https://github.com/omniauth/omniauth-oauth2.git'
9+
elsif ENV['OMNIAUTH_OAUTH2']
10+
gem 'omniauth-oauth2', ENV['OMNIAUTH_OAUTH2']
11+
end
12+
13+
gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
14+
15+
gem 'minitest', '>= 5.20'
16+
gem 'rack-test', '>= 2.1'
17+
gem 'rake', '>= 13.1'
18+
gem 'rubocop', '>= 1.70'
19+
gem 'rubocop-minitest', '>= 0.36'
20+
gem 'webmock', '>= 3.24'

0 commit comments

Comments
 (0)