Skip to content

Commit

Permalink
Housekeeping (#437)
Browse files Browse the repository at this point in the history
Housekeeping

This includes :
* Remove useless file
* Move development dependencies to Gemfile
* Switch from CircleCI to GithubActions
* use Appraisal to specify Rails version during CI
* Add support for latest Rails versions
* Add support for latest Ruby versions
* Disable RSpec monkey patch
* Run tests in random order
* Cleanup spec_helper.rb
* Load parent Gemfile in integration tests
* Cleanup spec_helper.rb in integration tests
* Improve RSpec config in integration tests
* Coding style
* Improve DB loading/seeding in integration tests
* Add bin/rackup binstub so we can start dummy application
* Add simplecov to have code coverage
  • Loading branch information
n-rodriguez authored Nov 4, 2024
1 parent ed28e59 commit ccfb3f3
Show file tree
Hide file tree
Showing 63 changed files with 796 additions and 232 deletions.
88 changes: 0 additions & 88 deletions .circleci/config.yml

This file was deleted.

165 changes: 165 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
---
name: CI

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
schedule:
- cron: '0 4 1 * *'

jobs:
rspec:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby:
- '3.3'
- '3.2'
- '3.1'
- '3.0'
- '2.7'
- '2.6'
- '2.5'
rails:
- rails_7.2
- rails_7.1
- rails_7.0
- rails_6.1
- rails_6.0
- rails_5.2

exclude:
- ruby: '2.5'
rails: 'rails_7.0'
- ruby: '2.5'
rails: 'rails_7.1'
- ruby: '2.5'
rails: 'rails_7.2'

- ruby: '2.6'
rails: 'rails_7.0'
- ruby: '2.6'
rails: 'rails_7.1'
- ruby: '2.6'
rails: 'rails_7.2'

- ruby: '2.7'
rails: 'rails_5.2'
- ruby: '2.7'
rails: 'rails_7.2'

- ruby: '3.0'
rails: 'rails_5.2'
- ruby: '3.0'
rails: 'rails_6.0'
- ruby: '3.0'
rails: 'rails_7.2'

- ruby: '3.1'
rails: 'rails_5.2'

- ruby: '3.2'
rails: 'rails_5.2'

- ruby: '3.3'
rails: 'rails_5.2'

env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}.gemfile

steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: RSpec
run: 'echo "current_directory: ${PWD}" && bin/rspec --profile 10 --format RspecJunitFormatter --out ./test-results/rspec/results.xml --format progress'

rspec-integration:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ${{ github.workspace }}/integration

strategy:
fail-fast: false
matrix:
ruby:
- '3.3'
- '3.2'
- '3.1'
- '3.0'
- '2.7'
- '2.6'
- '2.5'
rails:
- rails_7.2
- rails_7.1
- rails_7.0
- rails_6.1
- rails_6.0
- rails_5.2

exclude:
- ruby: '2.5'
rails: 'rails_7.0'
- ruby: '2.5'
rails: 'rails_7.1'
- ruby: '2.5'
rails: 'rails_7.2'

- ruby: '2.6'
rails: 'rails_7.0'
- ruby: '2.6'
rails: 'rails_7.1'
- ruby: '2.6'
rails: 'rails_7.2'

- ruby: '2.7'
rails: 'rails_5.2'
- ruby: '2.7'
rails: 'rails_7.2'

- ruby: '3.0'
rails: 'rails_5.2'
- ruby: '3.0'
rails: 'rails_6.0'
- ruby: '3.0'
rails: 'rails_7.2'

- ruby: '3.1'
rails: 'rails_5.2'

- ruby: '3.2'
rails: 'rails_5.2'

- ruby: '3.3'
rails: 'rails_5.2'

env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}.gemfile

steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: RSpec
run: 'echo "current_directory: ${PWD}" && bin/rspec --profile 10 --format RspecJunitFormatter --out ./test-results/rspec/results.xml --format progress'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ public
Gemfile.lock
integration/Gemfile.lock
integration/gemfiles/*.lock
gemfiles/*.lock
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

25 changes: 25 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

appraise 'rails_5.2' do
gem 'rails', '~> 5.2.0'
end

appraise 'rails_6.0' do
gem 'rails', '~> 6.0.0'
end

appraise 'rails_6.1' do
gem 'rails', '~> 6.1.0'
end

appraise 'rails_7.0' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails_7.1' do
gem 'rails', '~> 7.1.0'
end

appraise 'rails_7.2' do
gem 'rails', '~> 7.2.0'
end
18 changes: 18 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,26 @@ source 'https://rubygems.org'

gemspec

gem 'appraisal', git: 'https://github.com/thoughtbot/appraisal.git'

gem 'aws-sdk-core'
gem 'aws-sdk-s3'
gem 'combustion'
gem 'fog-aws'
gem 'google-cloud-storage'
gem 'rails'
gem 'rake'
gem 'rspec_junit_formatter'
gem 'rspec'
gem 'rspec-rails'
gem 'simplecov'
gem 'sqlite3', '~> 1.5.0'
gem 'webmock'

if RUBY_VERSION =~ /2.5.*/
gem 'nokogiri', '1.12.5'
else
gem 'nokogiri'
end

group :test do
Expand Down
27 changes: 27 additions & 0 deletions bin/appraisal
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'appraisal' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("appraisal", "appraisal")
Loading

0 comments on commit ccfb3f3

Please sign in to comment.