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
72 changes: 59 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,66 @@
name: Ruby
name: CI

on: [push,pull_request]
on: [push, pull_request]

jobs:
build:
lint:
name: RuboCop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true
- run: bundle exec rubocop

test:
# Faraday 3 gemfiles exist under gemfiles/ for forward-readiness and can be
# run locally via `bundle exec appraisal rspec`. They're not wired into CI
# until Faraday 3 is published to RubyGems. The ruby-head cell tracks Ruby
# master (including future Ruby 4) and is marked experimental.
name: Test (Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }})
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
ruby-version: ['2.7', '3.3']
ruby: ['3.2', '3.3', '3.4', '4.0']
gemfile:
- gemfiles/faraday2_jwt2.gemfile
- gemfiles/faraday2_jwt3.gemfile
experimental: [false]
include:
- ruby: 'head'
gemfile: gemfiles/faraday2_jwt3.gemfile
experimental: true
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
CENTRIFUGO_API_URL: http://localhost:8000/api
CENTRIFUGO_API_KEY: api_key
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Run the default task
run: |
bundle install
bundle exec rake
- uses: actions/checkout@v4

- name: Start Centrifugo
run: docker compose up -d

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Wait for Centrifugo
run: |
for i in $(seq 1 30); do
if curl -sf -X POST -H 'X-API-Key: api_key' -H 'Content-Type: application/json' \
-d '{}' http://localhost:8000/api/info >/dev/null; then
echo "Centrifugo ready"; exit 0
fi
sleep 1
done
echo "Centrifugo did not become healthy"
docker compose logs centrifugo
exit 1

- name: Run tests
run: bundle exec rspec
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.0
ruby-version: '3.4'

- name: Bundle install
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/.bundle/
/.yardoc
/Gemfile.lock
/gemfiles/*.lock
/gemfiles/vendor/
/_yardoc/
/coverage/
/doc/
Expand Down
45 changes: 42 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,52 @@
require:
plugins:
- rubocop-rspec
- rubocop-rake

AllCops:
TargetRubyVersion: 2.5
TargetRubyVersion: 3.0
NewCops: enable
RSpec/ExampleLength:
Exclude:
- 'gemfiles/**/*'
- 'vendor/**/*'

Metrics/ClassLength:
Max: 160

Metrics/MethodLength:
Max: 30

Metrics/ParameterLists:
Max: 15
CountKeywordArgs: false

Metrics/AbcSize:
Max: 25

Metrics/BlockLength:
Exclude:
- 'spec/**/*'
- '*.gemspec'
- 'Appraisals'

RSpec/ExampleLength:
Max: 25

RSpec/MultipleExpectations:
Max: 5

RSpec/NestedGroups:
Max: 4

# Stubs with `with(body: ...)` act as implicit expectations: a mismatched
# request body leaves no matching stub and fails the request.
RSpec/NoExpectationExample:
Exclude:
- 'spec/cent/client_spec.rb'

# Integration specs live under spec/integration/ by design.
RSpec/SpecFilePathFormat:
Exclude:
- 'spec/integration/**/*'

Gemspec/RequireMFA:
Enabled: false
21 changes: 21 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

appraise 'faraday2-jwt2' do
gem 'faraday', '~> 2.0'
gem 'jwt', '~> 2.2'
end

appraise 'faraday2-jwt3' do
gem 'faraday', '~> 2.0'
gem 'jwt', '~> 3.0'
end

appraise 'faraday3-jwt2' do
gem 'faraday', '~> 3.0'
gem 'jwt', '~> 2.2'
end

appraise 'faraday3-jwt3' do
gem 'faraday', '~> 3.0'
gem 'jwt', '~> 3.0'
end
16 changes: 7 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in cent.gemspec
gemspec

gem 'rake', '~> 13.0'

gem 'rspec', '~> 3.0'
gem 'webmock', '~> 3.7.5'

gem 'rubocop', '~> 1.7'
gem 'rubocop-rake'
gem 'rubocop-rspec'

gem 'appraisal', '~> 2.5'
gem 'pry'
gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.12'
gem 'rubocop', '~> 1.60'
gem 'rubocop-rake', '~> 0.6'
gem 'rubocop-rspec', '~> 3.0'
gem 'webmock', '~> 3.19'
Loading
Loading