Skip to content

Commit

Permalink
WIP: Configure CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
nepalez committed Oct 7, 2023
1 parent 6595c2c commit 1257482
Show file tree
Hide file tree
Showing 33 changed files with 186 additions and 296 deletions.
18 changes: 0 additions & 18 deletions .codeclimate.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/gemfiles/rails_4.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
source "https://rubygems.org"

gemspec path: '../..'

group :test do
gem "database_cleaner", ">= 1.5"
end

group :test, :development do
gem "pry"
gem "pry-byebug", "3.7.0"
gem "rails", "4.2.0"
gem "rake", ">= 10"
gem "rubocop", "0.81.0"
gem "sqlite3", "~> 1.3.6"
end
16 changes: 16 additions & 0 deletions .github/gemfiles/rails_6.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
source "https://rubygems.org"

gemspec path: '../..'

group :test do
gem "database_cleaner", ">= 1.5"
end

group :test, :development do
gem "pry"
gem "pry-byebug"
gem "rails", "~> 6.0"
gem "rake", ">= 10"
gem "rubocop"
gem "sqlite3", "~> 1.4.0"
end
16 changes: 16 additions & 0 deletions .github/gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
source "https://rubygems.org"

gemspec path: '../..'

group :test do
gem "database_cleaner", ">= 1.5"
end

group :test, :development do
gem "pry"
gem "pry-byebug"
gem "rails", "~> 7.1.0"
gem "rake", ">= 10"
gem "rubocop"
gem "sqlite3", "~> 1.6"
end
64 changes: 64 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Check the code
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
lint:
name: lint (ruby 3.2, rails 7.1)
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/.github/gemfiles/rails_7.1.gemfile
BUNDLE_RETRY: 1
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- run: bundle exec rubocop

test-legacy:
name: test (ruby 2.3, rails 4.2)
runs-on: ubuntu-latest
env:
BUNDLER_VERSION: '1.17.3'
BUNDLE_GEMFILE: ${{ github.workspace }}/.github/gemfiles/rails_4.2.gemfile
BUNDLE_RETRY: 1
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.3
rubygems: 3.2.3
bundler: 1
bundler-cache: true
- run: bundle exec rake

test:
name: test (ruby ${{ matrix.ruby }}, rails ${{ matrix.rails }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ['3.2']
rails: ['6.0', '7.1']
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/.github/gemfiles/rails_${{ matrix.rails }}.gemfile
BUNDLE_RETRY: 1
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release a new version
on:
release:
types: [created]
jobs:
release:
name: Publish new version on RubyGems
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cadwallion/publish-rubygems-action@master
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
RUBYGEMS_API_KEY: ${{secrets.PUSH_RSPEC_SQLIMIT}}
RELEASE_COMMAND: rake release
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
/pkg/
/spec/reports/
/tmp/
/spec/dummy/db/*.sqlite3
/log/
/spec/dummy/log/
/spec/dummy/tmp/
/spec/dummy/storage/
*.gem
.rspec_status
.idea/
17 changes: 11 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
---
AllCops:
DisplayCopNames: true
DisplayStyleGuide: true
DisplayCopNames: true
DisplayStyleGuide: true
NewCops: enable
StyleGuideCopsOnly: true
TargetRubyVersion: 2.6
TargetRubyVersion: 2.3
Exclude:
- spec/dummy/db/schema.rb
- vendor/bundle/**/*
- gemfiles/vendor/**/*

Metrics/ParameterLists:
Max: 5

Style/Alias:
Naming/FileName:
Enabled: false

Style/ClassAndModuleChildren:
Style/Alias:
Enabled: false

Style/FileName:
Style/ClassAndModuleChildren:
Enabled: false

Style/FrozenStringLiteralComment:
Expand All @@ -26,6 +28,9 @@ Style/FrozenStringLiteralComment:
Style/ModuleFunction:
Enabled: false

Style/OptionalBooleanParameter:
Enabled: false

Style/StringLiterals:
EnforcedStyle: double_quotes

Expand Down
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

24 changes: 0 additions & 24 deletions Appraisals

This file was deleted.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.0.6] - [2023-10-06]
- Support of Rails 7.2+ (@terracatta)
- Support of Rails 7+ (@terracatta)

## [0.0.5] - [2022-02-13]
- Support of Rails 7 (@kivanio)
Expand Down
10 changes: 7 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
source "https://rubygems.org"

# Specify your gem's dependencies in tram-form.gemspec
gemspec

gem "rails"
gem "sqlite3"
group :test do
gem "database_cleaner", ">= 1.5"
end

group :test, :development do
gem "pry"
gem "pry-byebug"
gem "rails"
gem "rake", ">= 10"
gem "rubocop"
gem "sqlite3", ">= 1.3"
end
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ It wraps [the answer at Stack Overflow][stack-answer] by [Ryan Bigg][ryan-bigg],
For motivation and details see my [blog post "Fighting the Hydra of N+1 queries" in the Martian Chronicles][hydra].

[![Gem Version][gem-badger]][gem]
[![Build Status][travis-badger]][travis]
[![Dependency Status][gemnasium-badger]][gemnasium]
[![Code Climate][codeclimate-badger]][codeclimate]

<a href="https://evilmartians.com/">
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
Expand Down Expand Up @@ -89,14 +86,8 @@ In the last example you can see that binded values are shown after the query fol

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

[codeclimate-badger]: https://img.shields.io/codeclimate/github/nepalez/rspec-sqlimit.svg?style=flat
[codeclimate]: https://codeclimate.com/github/nepalez/rspec-sqlimit
[gem-badger]: https://img.shields.io/gem/v/rspec-sqlimit.svg?style=flat
[gem]: https://rubygems.org/gems/rspec-sqlimit
[gemnasium-badger]: https://img.shields.io/gemnasium/nepalez/rspec-sqlimit.svg?style=flat
[gemnasium]: https://gemnasium.com/nepalez/rspec-sqlimit
[travis-badger]: https://img.shields.io/travis/nepalez/rspec-sqlimit/master.svg?style=flat
[travis]: https://travis-ci.org/nepalez/rspec-sqlimit
[stack-answer]: http://stackoverflow.com/a/5492207/1869912
[ryan-bigg]: http://ryanbigg.com/
[notification]: http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html
Expand Down
19 changes: 1 addition & 18 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,7 @@ require "rspec/core/rake_task"
# Adds dummy:db tasks.
load "spec/dummy/Rakefile"

# Declares gem's own tasks.
desc "Runs test suite over all rails versions."
task :default do
if ENV["BUNDLE_GEMFILE"] =~ /gemfiles/
Rake::Task["dummy:db:create"].reenable
Rake::Task["dummy:db:migrate"].reenable
Rake::Task[:spec].invoke
else
Rake::Task[:appraise].invoke
end
end

desc "Runs test suite."
task default: %w[dummy:db:create dummy:db:migrate] do
task default: %w[db:reset db:schema:load] do
exec "bundle exec rspec spec"
exec "bundle exec rubocop"
end

task :appraise do
exec "appraisal install && appraisal rake"
end
2 changes: 0 additions & 2 deletions gemfiles/.bundle/config

This file was deleted.

13 changes: 0 additions & 13 deletions gemfiles/rails_4.2.gemfile

This file was deleted.

13 changes: 0 additions & 13 deletions gemfiles/rails_5.0.gemfile

This file was deleted.

13 changes: 0 additions & 13 deletions gemfiles/rails_5.1.gemfile

This file was deleted.

Loading

0 comments on commit 1257482

Please sign in to comment.