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 Rails 7.1 to CI #15

Merged
merged 1 commit into from
Oct 17, 2023
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
57 changes: 25 additions & 32 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,43 @@
name: Tests

on:
push:
branches:
- master
branches: ['master']
pull_request:
branches:
- '*'

jobs:
test_sqlite:
runs-on: ubuntu-20.04
test:
runs-on: ubuntu-latest

env:
RAILS_ENV: test

strategy:
fail-fast: false
matrix:
include:
### TEST ALL RUBY VERSIONS, USE DEFAULT GEMFILE
- ruby: 2.5
- ruby: 2.6
- ruby: 2.7
- ruby: "3.0" ### must be quoted otherwise will be treated as "3" which will resolve to latest 3.x version
- ruby: 3.1
- ruby: 3.2

### RAILS VERSION TESTING
- ruby: 2.6
env:
RAILS_VERSION: "5.0"
- ruby: 2.6
env:
RAILS_VERSION: "5.1"
- ruby: 2.6
### TEST RUBY VERSIONS
- ruby: "2.5"
- ruby: "2.6"
- ruby: "2.7"
- ruby: "3.0"
- ruby: "3.1"
- ruby: "3.2"
### TEST RAILS VERSIONS
- ruby: "2.6"
env:
RAILS_VERSION: "5.2"
- ruby: 2.6
- ruby: "2.6"
env:
RAILS_VERSION: "6.0"
- ruby: 2.6
- ruby: "2.6"
env:
RAILS_VERSION: "6.1"
- ruby: "3.1"
- ruby: "3.2"
env:
RAILS_VERSION: "7.0"

env:
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
DB_GEM: "sqlite3"
- ruby: "3.2"
env:
RAILS_VERSION: "7.1"

steps:
- uses: actions/checkout@v3
Expand All @@ -54,10 +46,11 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: "${{ matrix.ruby }}"
bundler-cache: true
bundler-cache: false ### not compatible with ENV-style Gemfile

- name: Run tests
- name: Run test
run: |
bundle install
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake test
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
log/*.log
pkg/
spec/dummy/db/*.sqlite3
spec/dummy/db/*.sqlite3-journal
spec/dummy/db/*.sqlite3*
spec/dummy/log/*.log
spec/dummy/storage/
spec/dummy/tmp/
Expand Down
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ gemspec
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

ENV['DB_GEM'] ||= 'sqlite3'
def get_env(name)
(ENV[name] && !ENV[name].empty?) ? ENV[name] : nil
end

gem 'rails', ENV["RAILS_VERSION"]
gem ENV['DB_GEM']
gem "rails", get_env("RAILS_VERSION")
gem "sqlite3"

group :development, :test do
gem "sprockets-rails" ### just for dummy app
Expand Down
10 changes: 5 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ load 'rails/tasks/statistics.rake'

require 'bundler/gem_tasks'

task :test do
system("rspec", out: STDOUT)
exit $?.exitstatus
end
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)

task test: [:spec]

task default: :test
task default: [:spec]