Skip to content

Commit

Permalink
Add CI and update to test multiple rails versions
Browse files Browse the repository at this point in the history
  • Loading branch information
diasjorge committed Oct 25, 2024
1 parent 60a9e41 commit f750ed4
Show file tree
Hide file tree
Showing 50 changed files with 1,279 additions and 276 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
pull_request:
push:
branches: [ main ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby-3.2.5
bundler-cache: true

- name: Lint code for consistent style
run: bin/rubocop -f github

test:
runs-on: ubuntu-latest
steps:
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libjemalloc2 libvips sqlite3

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

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby-3.2.5
bundler-cache: true

- name: Run tests
env:
RAILS_ENV: test
# REDIS_URL: redis://localhost:6379/0
run: bin/rails test

- name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots
path: ${{ github.workspace }}/tmp/screenshots
if-no-files-found: ignore
18 changes: 10 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.bundle/
log/*.log
pkg/
test/dummy/db/*.sqlite3
test/dummy/db/*.sqlite3-journal
test/dummy/log/*.log
test/dummy/tmp/
/Gemfile.lock
/.bundle/
/doc/
/log/*.log
/pkg/
/tmp/
/test/dummy/db/*.sqlite3
/test/dummy/db/*.sqlite3-*
/test/dummy/log/*.log
/test/dummy/storage/
/test/dummy/tmp/
11 changes: 11 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require:
- standard

inherit_gem:
standard: config/base.yml

AllCops:
NewCops: enable
Exclude:
- node_modules/**/*
- test/dummy/**/*
8 changes: 8 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
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
9 changes: 2 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
begin
require "bundler/setup"
rescue LoadError
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
end
require "bundler/setup"

require "rdoc/task"

Expand All @@ -14,13 +10,12 @@ RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include("lib/**/*.rb")
end

APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
load "rails/tasks/engine.rake"

load "rails/tasks/statistics.rake"

require "bundler/gem_tasks"

require "rake/testtask"

require "standard/rake"
Expand Down
Loading

0 comments on commit f750ed4

Please sign in to comment.