Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ci to 1.x stable pg #2

Open
wants to merge 15 commits into
base: 1.x-stable
Choose a base branch
from
92 changes: 92 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Test

on: [push, pull_request]

jobs:
test:
name: RSpec and Cucumber
strategy:
fail-fast: false
matrix:
ruby: [ '2.2', '2.3', '2.4', '2.5', '2.6' ]
gemfile:
- gemfiles/rails-4-0.gemfile
- gemfiles/rails-4-1.gemfile
- gemfiles/rails-4-2.gemfile
- gemfiles/rails-5-0.gemfile
- gemfiles/rails-5-1.gemfile
- gemfiles/rails-5-2.gemfile
experimental: [ false ]
include:
- ruby: '2.7'
gemfile: gemfiles/rails-6-1.gemfile
experimental: false
- ruby: '3.0'
gemfile: gemfiles/rails-6-1.gemfile
experimental: false
- ruby: '3.0'
gemfile: gemfiles/rails-7-0.gemfile
experimental: false
- ruby: '3.1'
gemfile: gemfiles/rails-main.gemfile
experimental: false
exclude:
- ruby: '2.4'
gemfile: gemfiles/rails-4-0.gemfile
- ruby: '2.4'
gemfile: gemfiles/rails-4-1.gemfile
- ruby: '2.5'
gemfile: gemfiles/rails-4-0.gemfile
- ruby: '2.5'
gemfile: gemfiles/rails-4-1.gemfile
- ruby: '2.6'
gemfile: gemfiles/rails-4-0.gemfile
- ruby: '2.6'
gemfile: gemfiles/rails-4-1.gemfile
- ruby: '2.6'
gemfile: gemfiles/rails-4-2.gemfile
runs-on: ubuntu-20.04
services:
postgres:
image: postgres:12
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: carrierwave_test
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
EXPERIMENTAL: ${{ matrix.experimental }}
JRUBY_OPTS: --debug
# GitHub Actions need the application to specify host as 127.0.0.1 in order to find the Postgres.
# However, Ruby version <= 2.3 will throw segfaults / random errors from C if host is provided.
PG_HOST: ${{ matrix.ruby > 2.3 && '127.0.0.1' || null }} # workaround to ternary operator
steps:
- uses: actions/checkout@v3
- name: Setup ImageMagick policy
run: sudo sh -c 'echo '\''<policymap><policy domain="coder" rights="read|write" pattern="PDF" /></policymap>'\'' > /etc/ImageMagick-6/policy.xml'
- name: Update package list
run: sudo apt update
- name: Install ghostscript to process PDF
run: sudo apt-get -y install ghostscript
- name: Install libvips-dev for Carrierwave::Vips
run: sudo apt-get install libvips-dev
- name: Set up Ruby
uses: ruby/setup-ruby@v1
if: ${{ matrix.ruby <= 2.6 }}
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
bundler: 1.17.3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
if: ${{ matrix.ruby > 2.6 }}
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run RSpec
run: bundle exec rake spec || [ "$EXPERIMENTAL" == "true" ] && true
- name: Run Cucumber
run: bundle exec rake features || [ "$EXPERIMENTAL" == "true" ] && true
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
source "https://rubygems.org"

gem "activemodel-serializers-xml"
gem 'pg', '~> 0.21.0', platforms: :ruby

gemspec
9 changes: 7 additions & 2 deletions carrierwave.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |s|
s.add_dependency "activesupport", ">= 4.0.0"
s.add_dependency "activemodel", ">= 4.0.0"
s.add_dependency "mime-types", ">= 1.16"
s.add_dependency "ssrf_filter", "~> 1.0"
s.add_dependency "ssrf_filter", "< 1.1.0", "~> 1.0"
if RUBY_ENGINE == 'jruby'
s.add_development_dependency 'activerecord-jdbcpostgresql-adapter'
else
Expand All @@ -35,9 +35,14 @@ Gem::Specification.new do |s|
s.add_development_dependency "rspec", "~> 3.4"
s.add_development_dependency "webmock"
s.add_development_dependency "fog-aws"
s.add_development_dependency "fog-google", "~> 1.7.1"
if RUBY_VERSION < '2.7'
s.add_development_dependency "fog-google", "~> 1.7.0"
else
s.add_development_dependency "fog-google"
end
s.add_development_dependency "fog-local"
s.add_development_dependency "fog-rackspace"
s.add_development_dependency "fog-core", "~> 2.1.0"
s.add_development_dependency "mini_magick", ">= 3.6.0"
if RUBY_ENGINE != 'jruby'
s.add_development_dependency "rmagick", "~> 2.16"
Expand Down
6 changes: 6 additions & 0 deletions gemfiles/rails-6-1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source "https://rubygems.org"

gem "rails", "~> 6.1.0"
gem "activemodel-serializers-xml"

gemspec :path => "../"
6 changes: 6 additions & 0 deletions gemfiles/rails-7-0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source "https://rubygems.org"

gem "rails", "~> 7.0.0"
gem "activemodel-serializers-xml"

gemspec :path => "../"
6 changes: 6 additions & 0 deletions gemfiles/rails-main.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source "https://rubygems.org"

gem "rails", github: "rails/rails", branch: "main"
gem "activemodel-serializers-xml"

gemspec :path => "../"
12 changes: 0 additions & 12 deletions gemfiles/rails-master.gemfile

This file was deleted.

5 changes: 4 additions & 1 deletion spec/support/activerecord.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
:adapter => 'postgresql',
:database => 'carrierwave_test',
:encoding => 'utf8',
:username => 'postgres'
:username => 'postgres',
:password => 'postgres',
}

dbconfig[:host] = ENV['PG_HOST'] unless ENV['PG_HOST'].nil?

database = dbconfig.delete(:database)

ActiveRecord::Base.establish_connection(dbconfig.merge(database: "template1"))
Expand Down
2 changes: 1 addition & 1 deletion spec/uploader/download_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
let(:test_file) { File.read(file_path(test_file_name)) }
let(:test_file_name) { "test.jpg" }
let(:unicode_named_file) { File.read(file_path(unicode_filename)) }
let(:unicode_URL) { URI.encode(base_url + "/#{unicode_filename}") }
let(:unicode_URL) { URI::DEFAULT_PARSER.escape(base_url + "/#{unicode_filename}") }
let(:unicode_filename) { "юникод.jpg" }
let(:authentication_headers) do
{
Expand Down