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
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release Gem to rubygems.org

on:
push:
tags:
- v*

jobs:
push:
if: github.repository == 'refinery/refinerycms-authentication-devise'
runs-on: ubuntu-latest
environment: release

permissions:
contents: write
id-token: write

steps:
# Set up
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby

# Release
#
# The gem is built with `gem build` and pushed with `gem push` rather than
# through `rake release`, so no bundle is installed. This keeps the same
# workflow working on older release lines whose bundle does not resolve
# on a current Ruby.
#
# rubygems/configure-rubygems-credentials exchanges the GitHub Actions OIDC
# token for a temporary RubyGems API key, enabling trusted publishing without
# storing any secrets.
- name: Configure RubyGems credentials
uses: rubygems/configure-rubygems-credentials@v2.0.0
- name: Release gem
run: |
gem build refinerycms-authentication-devise.gemspec --output refinerycms-authentication-devise.gem
gem push refinerycms-authentication-devise.gem
18 changes: 13 additions & 5 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ jobs:
test:
strategy:
matrix:
database: [ mysql, postgresql ]
ruby: [ 2.7, 2.6 ]
database: [ sqlite3, mysql, postgresql ]
ruby: [ 4.0, 3.4, 3.3, 3.2 ]
rails: [ '~> 8.1.0', '~> 8.0.0', '~> 7.2.0', '~> 6.1.0' ]
exclude:
- ruby: 3.4
rails: '~> 6.1.0'
- ruby: 4.0
rails: '~> 6.1.0'
- database: sqlite3
rails: '~> 6.1.0'
fail-fast: false
max-parallel: 20
runs-on: ubuntu-latest

env:
Expand All @@ -24,12 +31,13 @@ jobs:
PGPASSWORD: runner
PGUSER: runner
RAILS_ENV: test
RAILS_VERSION: ${{ matrix.rails }}
RETRY_COUNT: 3

name: ${{ matrix.ruby }} ${{ matrix.database }}
name: rails ${{ matrix.rails }} ruby ${{ matrix.ruby }} ${{ matrix.database }}
steps:
- run: sudo apt-get update && sudo apt-get install libsqlite3-dev -y
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
Expand Down
12 changes: 9 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ source "https://rubygems.org"

gemspec

git "https://github.com/refinery/refinerycms", branch: "master" do
gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']

git "https://github.com/refinery/refinerycms", branch: "main" do
gem "refinerycms"

group :test do
Expand All @@ -11,7 +13,7 @@ git "https://github.com/refinery/refinerycms", branch: "master" do
end

# Database Configuration
unless ENV["CI"]
if !ENV["CI"] || ENV["DB"] == "sqlite3"
gem "activerecord-jdbcsqlite3-adapter", :platform => :jruby
gem "sqlite3", :platform => :ruby
end
Expand All @@ -29,7 +31,6 @@ end

gem "jruby-openssl", :platform => :jruby

# Refinery/rails should pull in the proper versions of these
group :assets do
gem "sass-rails"
gem "coffee-rails"
Expand All @@ -38,6 +39,11 @@ end

gem 'listen'

# Ruby 3.4+ extracted mutex_m from stdlib, but older Rails versions need it
gem 'mutex_m' if RUBY_VERSION >= '3.4' && ENV['RAILS_VERSION']&.match?(/^~> [67]\./)

gem 'json', '< 3' if ENV['RAILS_VERSION']&.match?(/^~> (6|7|8\.0)\./)

group :test do
gem "database_cleaner-active_record"
gem "launchy"
Expand Down
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env rake
require 'logger'
begin
require 'bundler/setup'
rescue LoadError
Expand All @@ -8,7 +9,7 @@ end
ENGINE_PATH = File.dirname(__FILE__)
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)

if File.exists?(APP_RAKEFILE)
if File.exist?(APP_RAKEFILE)
load 'rails/tasks/engine.rake'
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class UsersController < Refinery::AdminController

crudify :'refinery/authentication/devise/user',
order: 'username ASC',
title_attribute: 'username'
title_attribute: 'username',
exclude_from_find: :show

before_action :find_available_plugins, :find_available_roles,
only: [:new, :create, :edit, :update]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ module Refinery
module Authentication
module Devise
module ControllerMacros
def self.extended(base)
base.send :include, ::Devise::Test::ControllerHelpers
end

def refinery_login_with_devise(*roles)
roles = handle_deprecated_roles!(roles).flatten
let(:logged_in_user) do
Expand Down Expand Up @@ -44,5 +40,6 @@ def handle_deprecated_roles!(*roles)
end

RSpec.configure do |config|
config.include ::Devise::Test::ControllerHelpers, type: :controller
config.extend Refinery::Authentication::Devise::ControllerMacros, type: :controller
end
Loading