Skip to content

Commit

Permalink
OD-617 Run tests on Github Actions (#78)
Browse files Browse the repository at this point in the history
* OD-617 Run tests on Github Actions

* OD-617 Update Rails because of Mimemagic yank

* OD-617 Update Rails because of Mimemagic yank

* OD-617 Fix story spec

* OD-617 Specify new Ruby version in Ansible and Readme

* Fix Puma dependency

* Fix broken test
  • Loading branch information
ariana-paris authored Sep 28, 2021
1 parent bc0286e commit 1bfbbfa
Show file tree
Hide file tree
Showing 15 changed files with 158 additions and 91 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/automated-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Automated Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

jobs:
automated-tests:
name: ${{ matrix.tests.command }}
runs-on: ubuntu-latest

env:
CI: true
RAILS_ENV: test
SPEC_OPTS: --force-color

services:
database:
image: mariadb:10.5.4-focal
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: opendoorstempsite
ports:
- 3306:3306

redis:
image: redis:3.2.1
ports:
- 6379:6379


steps:
- name: Check out code
uses: actions/checkout@v2

- name: Run apt-get update
run: sudo apt-get update

- name: Install dependencies for Node and MariaDB
run: sudo apt-get install -y libnode-dev libmariadbclient-dev

# - name: Install LibXML
# run: sudo apt-get install libxml2-dev

- name: Set up Ruby and run bundle install
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Copy config files
run: |
cp config/github-actions/cable.yml config/cable.yml
cp config/github-actions/database.yml config/database.yml
cp config/github-actions/secrets.yml config/secrets.yml
- name: Make database
run: bundle exec rake db:create db:schema:load db:migrate

- name: Install NPM modules
run: npm install

- name: Compile front-end application
run: bundle exec rake webpacker:compile

- name: Run tests
run: bundle exec rspec spec --format doc

8 changes: 4 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# options available at https://github.com/bbatsov/rubocop/blob/master/config/default.yml

AllCops:
TargetRubyVersion: 2.4
TargetRubyVersion: 2.7

# stop checking quotation marks
Style/StringLiterals:
Enabled: false

# stop checking line length
Metrics/LineLength:
Layout/LineLength:
Enabled: false

# stop checking for trailing whitespace
Style/TrailingWhitespace:
Layout/TrailingWhitespace:
Enabled: false

# stop checking for ambiguous regexp literal
Expand All @@ -24,7 +24,7 @@ Style/AndOr:
Enabled: false

# Set desired method length
Style/MethodLength:
Metrics/MethodLength:
Max: 30

# Leave arrays alone
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.7
2.7.3
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ git_source(:github) do |repo_name|
"https://github.com/#{repo_name}.git"
end

ruby "2.3.7"
ruby "2.7.3"

# Use SCSS for stylesheets (sassc-rails needs be before rails https://github.com/sass/sassc-rails/issues/114)
gem 'sassc-rails', '~> 2.0.0'

gem 'rails', '~> 5.2.2.1'
gem 'rails', '~> 5.2.5'

gem 'mysql2', '>= 0.3.18', '< 0.5'
gem 'mysql2', '0.5.2'

gem 'faraday'
gem 'faraday_middleware'
Expand Down
105 changes: 56 additions & 49 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.2.1)
actionpack (= 5.2.2.1)
actioncable (5.2.6)
actionpack (= 5.2.6)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.2.1)
actionpack (= 5.2.2.1)
actionview (= 5.2.2.1)
activejob (= 5.2.2.1)
actionmailer (5.2.6)
actionpack (= 5.2.6)
actionview (= 5.2.6)
activejob (= 5.2.6)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.2.1)
actionview (= 5.2.2.1)
activesupport (= 5.2.2.1)
rack (~> 2.0)
actionpack (5.2.6)
actionview (= 5.2.6)
activesupport (= 5.2.6)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.2.1)
activesupport (= 5.2.2.1)
actionview (5.2.6)
activesupport (= 5.2.6)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.2.1)
activesupport (= 5.2.2.1)
activejob (5.2.6)
activesupport (= 5.2.6)
globalid (>= 0.3.6)
activemodel (5.2.2.1)
activesupport (= 5.2.2.1)
activerecord (5.2.2.1)
activemodel (= 5.2.2.1)
activesupport (= 5.2.2.1)
activemodel (5.2.6)
activesupport (= 5.2.6)
activerecord (5.2.6)
activemodel (= 5.2.6)
activesupport (= 5.2.6)
arel (>= 9.0)
activestorage (5.2.2.1)
actionpack (= 5.2.2.1)
activerecord (= 5.2.2.1)
marcel (~> 0.3.1)
activesupport (5.2.2.1)
activestorage (5.2.6)
actionpack (= 5.2.6)
activerecord (= 5.2.6)
marcel (~> 1.0.0)
activesupport (5.2.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
Expand Down Expand Up @@ -123,27 +123,26 @@ GEM
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
marcel (1.0.1)
memory_profiler (0.9.14)
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0901)
mimemagic (0.3.10)
nokogiri (~> 1)
rake
mime-types-data (3.2021.0225)
mini_histogram (0.3.1)
mini_mime (1.1.1)
mini_mime (1.1.0)
mini_portile2 (2.4.0)
minitest (5.14.4)
multi_json (1.15.0)
multipart-post (2.1.1)
mysql2 (0.4.10)
mysql2 (0.5.2)
mysql2 (0.5.2-x64-mingw32)
netrc (0.11.0)
nio4r (2.5.2)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
nokogiri (1.10.10-x64-mingw32)
mini_portile2 (~> 2.4.0)
public_suffix (4.0.6)
puma (4.3.8)
nio4r (~> 2.0)
Expand All @@ -152,18 +151,18 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.2.1)
actioncable (= 5.2.2.1)
actionmailer (= 5.2.2.1)
actionpack (= 5.2.2.1)
actionview (= 5.2.2.1)
activejob (= 5.2.2.1)
activemodel (= 5.2.2.1)
activerecord (= 5.2.2.1)
activestorage (= 5.2.2.1)
activesupport (= 5.2.2.1)
rails (5.2.6)
actioncable (= 5.2.6)
actionmailer (= 5.2.6)
actionpack (= 5.2.6)
actionview (= 5.2.6)
activejob (= 5.2.6)
activemodel (= 5.2.6)
activerecord (= 5.2.6)
activestorage (= 5.2.6)
activesupport (= 5.2.6)
bundler (>= 1.3.0)
railties (= 5.2.2.1)
railties (= 5.2.6)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
Expand All @@ -174,9 +173,9 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
railties (5.2.2.1)
actionpack (= 5.2.2.1)
activesupport (= 5.2.2.1)
railties (5.2.6)
actionpack (= 5.2.6)
activesupport (= 5.2.6)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
Expand All @@ -198,6 +197,12 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rest-client (2.1.0-x64-mingw32)
ffi (~> 1.9)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.5)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
Expand All @@ -220,6 +225,8 @@ GEM
rubyzip (1.3.0)
sassc (2.4.0)
ffi (~> 1.9)
sassc (2.4.0-x64-mingw32)
ffi (~> 1.9)
sassc-rails (2.0.0)
railties (>= 4.0.0)
sassc (>= 2.0)
Expand Down Expand Up @@ -293,9 +300,9 @@ DEPENDENCIES
factory_bot_rails
faraday
faraday_middleware
mysql2 (>= 0.3.18, < 0.5)
mysql2 (= 0.5.2)
puma (~> 4.3)
rails (~> 5.2.2.1)
rails (~> 5.2.5)
rails-controller-testing
react-rails
redis (~> 3.0)
Expand All @@ -311,7 +318,7 @@ DEPENDENCIES
webpacker

RUBY VERSION
ruby 2.3.7p456
ruby 2.7.3p183

BUNDLED WITH
1.17.3
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This repository houses the Rails + React application used to create those sites.
This is Ruby on Rails site with a React front-end mounted by the `react-rails` gem.

Requirements:
- Ruby 2.3
- Ruby 2.7.3
- MySQL 5.7
- Bundler
- Node 8.11 https://nodejs.org/en/blog/release/v8.11.1/
Expand Down
7 changes: 7 additions & 0 deletions config/github-actions/cable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
local: &local
adapter: redis
url: redis://localhost:6379

production: *local
development: *local
test: *local
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
default: &default
test:
host: 127.0.0.1
port: 3306
adapter: mysql2
database: opendoorstempsite_test
username: root
encoding: utf8
password: password
encoding: utf8mb4
variables:
sql_mode: STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

test:
<<: *default
database: opendoorstempsite_test
File renamed without changes.
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
t.string "action"
t.text "audited_changes"
t.integer "version", default: 0
t.string "comment"
t.string "comment", limit: 2048
t.string "remote_address"
t.string "request_uuid"
t.datetime "created_at"
Expand Down Expand Up @@ -92,6 +92,7 @@
t.string "ao3_url"
t.string "import_notes", limit: 1024, default: ""
t.integer "coauthor_id", default: 0
t.string "language_code", limit: 5
t.index ["author_id"], name: "authorId"
t.index ["id"], name: "id_UNIQUE", unique: true
end
Expand Down
Loading

0 comments on commit 1bfbbfa

Please sign in to comment.