From acefeb5f95c540fbea3295334a2510110a7ed5e1 Mon Sep 17 00:00:00 2001 From: Jonathan Abbett Date: Wed, 4 Sep 2019 12:37:23 -0400 Subject: [PATCH] Set up automated testing for Rails 5.1, 5.2, and 6.0 with TravisCI --- .gitignore | 1 + .travis.yml | 14 ++ Gemfile | 14 ++ Gemfile.lock | 194 --------------------------- README.md | 14 +- abraham.gemspec | 2 - lib/abraham/version.rb | 2 +- test/application_system_test_case.rb | 2 +- 8 files changed, 42 insertions(+), 201 deletions(-) create mode 100644 .travis.yml delete mode 100644 Gemfile.lock diff --git a/.gitignore b/.gitignore index 4cb5578..3e3ef8e 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ config/secrets.yml # these should all be checked in to normalize the environment: # Gemfile.lock, .ruby-version, .ruby-gemset +Gemfile.lock # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: .rvmrc diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6979eb4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: ruby + +env: + - 'RAILS_VERSION=5.1' + - 'RAILS_VERSION=5.2' + - 'RAILS_VERSION=6.0' + +before_script: + - 'yarn' + - 'bundle install' + - 'RAILS_ENV=test bundle exec rake db:create' + - 'RAILS_ENV=test bundle exec rake db:migrate' + +script: 'RAILS_ENV=test bundle exec rails test' diff --git a/Gemfile b/Gemfile index 3cec611..b2ce468 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,20 @@ # frozen_string_literal: true source 'http://rubygems.org' +# Set the Rails version. We have this switch so that we can test multiple +# versions for Rails on Travis CI. +# Inspired by http://aaronmiler.com/blog/testing-your-rails-engine-with-multiple-versions-of-rails/ +rails_version = ENV['RAILS_VERSION'] || 'default' +rails = case rails_version + when 'default' + '~> 5.1' + when 'master' + {github: 'rails/rails'} + else + "~> #{rails_version}" + end +gem 'rails', rails + # Declare your gem's dependencies in abraham.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 1cf81cc..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,194 +0,0 @@ -PATH - remote: . - specs: - abraham (1.5.2) - rails (~> 5.1) - -GEM - remote: http://rubygems.org/ - specs: - actioncable (5.2.3) - actionpack (= 5.2.3) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailer (5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (5.2.3) - actionview (= 5.2.3) - activesupport (= 5.2.3) - rack (~> 2.0) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.3) - activesupport (= 5.2.3) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.3) - activesupport (= 5.2.3) - globalid (>= 0.3.6) - activemodel (5.2.3) - activesupport (= 5.2.3) - activerecord (5.2.3) - activemodel (= 5.2.3) - activesupport (= 5.2.3) - arel (>= 9.0) - activestorage (5.2.3) - actionpack (= 5.2.3) - activerecord (= 5.2.3) - marcel (~> 0.3.1) - activesupport (5.2.3) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) - arel (9.0.0) - ast (2.4.0) - builder (3.2.3) - capybara (3.29.0) - addressable - mini_mime (>= 0.1.3) - nokogiri (~> 1.8) - rack (>= 1.6.0) - rack-test (>= 0.6.3) - regexp_parser (~> 1.5) - xpath (~> 3.2) - childprocess (2.0.0) - rake (< 13.0) - concurrent-ruby (1.1.5) - crass (1.0.4) - erubi (1.8.0) - ffi (1.11.1) - globalid (0.4.2) - activesupport (>= 4.2.0) - i18n (1.6.0) - concurrent-ruby (~> 1.0) - jaro_winkler (1.5.3) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) - loofah (2.2.3) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - marcel (0.3.3) - mimemagic (~> 0.3.2) - metaclass (0.0.4) - method_source (0.9.2) - mimemagic (0.3.3) - mini_mime (1.0.2) - mini_portile2 (2.4.0) - minitest (5.11.3) - mocha (1.9.0) - metaclass (~> 0.0.1) - nio4r (2.5.1) - nokogiri (1.10.4) - mini_portile2 (~> 2.4.0) - parallel (1.17.0) - parser (2.6.4.0) - ast (~> 2.4.0) - public_suffix (4.0.1) - rack (2.0.7) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (5.2.3) - actioncable (= 5.2.3) - actionmailer (= 5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) - activemodel (= 5.2.3) - activerecord (= 5.2.3) - activestorage (= 5.2.3) - activesupport (= 5.2.3) - bundler (>= 1.3.0) - railties (= 5.2.3) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.2.0) - loofah (~> 2.2, >= 2.2.2) - railties (5.2.3) - actionpack (= 5.2.3) - activesupport (= 5.2.3) - method_source - rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) - rainbow (3.0.0) - rake (12.3.3) - rb-fsevent (0.10.3) - rb-inotify (0.10.0) - ffi (~> 1.0) - regexp_parser (1.6.0) - rubocop (0.74.0) - jaro_winkler (~> 1.5.1) - parallel (~> 1.10) - parser (>= 2.6) - rainbow (>= 2.2.2, < 4.0) - ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) - ruby-progressbar (1.10.1) - ruby_dep (1.5.0) - rubyzip (1.2.3) - sassc (2.2.0) - ffi (~> 1.9) - sassc-rails (2.1.2) - railties (>= 4.0.0) - sassc (>= 2.0) - sprockets (> 3.0) - sprockets-rails - tilt - selenium-webdriver (3.142.4) - childprocess (>= 0.5, < 3.0) - rubyzip (~> 1.2, >= 1.2.2) - sprockets (3.7.2) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.1) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - sqlite3 (1.4.1) - thor (0.20.3) - thread_safe (0.3.6) - tilt (2.0.9) - tzinfo (1.2.5) - thread_safe (~> 0.1) - unicode-display_width (1.6.0) - webdrivers (4.1.2) - nokogiri (~> 1.6) - rubyzip (~> 1.0) - selenium-webdriver (>= 3.0, < 4.0) - websocket-driver (0.7.1) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.4) - xpath (3.2.0) - nokogiri (~> 1.8) - -PLATFORMS - ruby - -DEPENDENCIES - abraham! - capybara (>= 2.15) - listen - mocha - rubocop - sassc-rails - selenium-webdriver - sqlite3 - webdrivers - -BUNDLED WITH - 1.17.3 diff --git a/README.md b/README.md index 3c3139d..4ad7a47 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Abraham +[![Build Status](https://travis-ci.com/actmd/abraham.svg?branch=master)](https://travis-ci.com/actmd/abraham) + _Guide your users in the one true path._ ![Watercolor Sheep](https://upload.wikimedia.org/wikipedia/commons/e/e4/Watercolor_Sheep_Drawing.jpg) @@ -95,7 +97,7 @@ NB: You must specify a locale in the filename, even if you're only supporting on ### Tour content -A tour is composed of a series of steps. A step may have a title and must have a description. You may attach a step to a particular element on the page, and place the callout to the left, right, top, or bottom. +A tour is composed of a series of steps. A step may have a title and must have a description. You may attach a step to a particular element on the page, and place the callout to the left, right, top, or bottom. ```yaml intro: @@ -144,6 +146,8 @@ Everyone interacting in Abraham's codebase, issue tracker, etc. is expected to f ### Testing +#### Testing locally + This Rails engine contains a test app called `dummy` with controller and system tests. They'll all get run with `rails t`. Final testing should be done in a standalone Rails app, following the README instructions. @@ -154,6 +158,10 @@ To install the `abraham` gem with a local path: gem 'abraham', path: '~/Workspace/abraham' ``` +#### Automated testing + +We use TravisCI automatically testing this rails engine. For test history, venture over to [TravisCI](https://travis-ci.com/actmd/abraham). + ### Releasing Create a git-flow release: @@ -168,7 +176,7 @@ Build the gem and push to Rubygems: ``` $ rake build -$ gem push pkg/abraham-VERSION_NUMBER.gem +$ gem push pkg/abraham-VERSION_NUMBER.gem ``` Finish the git-flow release and push to GitHub: @@ -178,4 +186,4 @@ $ git flow release finish $ git push origin develop $ git push origin master $ git push --tags -``` \ No newline at end of file +``` diff --git a/abraham.gemspec b/abraham.gemspec index 5e66037..0d0da07 100644 --- a/abraham.gemspec +++ b/abraham.gemspec @@ -18,8 +18,6 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] - s.add_dependency 'rails', '~> 5.1' - s.add_development_dependency 'sassc-rails' s.add_development_dependency 'sqlite3' s.add_development_dependency 'rubocop' diff --git a/lib/abraham/version.rb b/lib/abraham/version.rb index 3cf233a..c75bdb8 100644 --- a/lib/abraham/version.rb +++ b/lib/abraham/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Abraham - VERSION = "1.5.2" + VERSION = "1.5.3" end diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index b5c4659..e3ae7b5 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -16,5 +16,5 @@ Capybara.register_driver(:headless_chrome) do |app| end class ApplicationSystemTestCase < ActionDispatch::SystemTestCase - driven_by :selenium, using: :chrome, screen_size: [1400, 1400] + driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400] end