Skip to content

Commit

Permalink
Merge pull request #4231 from benwbrum/4179-github-workflows
Browse files Browse the repository at this point in the history
4179 - Github workflows
  • Loading branch information
benwbrum authored Jul 16, 2024
2 parents 17257df + 772173a commit 2f20955
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
service_name: travis-ci
service_name: github
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "CI"
on:
pull_request: {}
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: diary_test
MYSQL_ROOT_PASSWORD: password
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
env:
RAILS_ENV: test
MYSQL_ROOT_PASSWORD: password
MYSQL_SOCKET: /tmp/mysql.sock
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.3
bundler-cache: true
- name: Install dependencies
run: |
sudo apt-get -qq update
sudo apt-get install -y ghostscript poppler-utils graphviz
bundle install --jobs 4 --retry 3
- name: Create db
run: bundle exec rake db:create
- name: Migrate
run: bundle exec rake db:migrate
- name: Load fixtures
run: bundle exec rake db:fixtures:load FIXTURES_PATH=spec/fixtures
- name: Run RuboCop
run: bundle exec rubocop
continue-on-error: true
- name: Run tests
uses: coactions/setup-xvfb@v1
with:
run: bundle exec rspec spec
- name: Run Coveralls
run: bundle exec coveralls push
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ end

group :test do
gem 'capybara'
gem 'capybara-webkit'
gem 'coveralls', require: false
gem 'coveralls_reborn', require: false
gem 'database_cleaner'
gem 'selenium-webdriver'
gem 'shoulda'
Expand All @@ -96,6 +95,7 @@ group :development, :test do
gem 'better_errors'
gem 'binding_of_caller'
gem 'bullet'
gem 'dotenv-rails'
gem 'easy_translate'
gem 'factory_bot_rails'
gem 'i18n-tasks'
Expand All @@ -106,6 +106,8 @@ group :development, :test do
gem 'rspec-rails'
end

gem 'dotenv', group: [:development, :test], require: 'dotenv/load'

# Use SassC for stylesheets
gem 'sassc-rails'

Expand Down
36 changes: 20 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
capybara-webkit (1.15.1)
capybara (>= 2.3, < 4.0)
json
carrierwave (3.0.7)
activemodel (>= 6.0.0)
activesupport (>= 6.0.0)
Expand All @@ -184,12 +181,11 @@ GEM
clipboard-rails (1.7.1)
coderay (1.1.3)
concurrent-ruby (1.2.3)
coveralls (0.8.23)
json (>= 1.8, < 3)
simplecov (~> 0.16.1)
term-ansicolor (~> 1.3)
thor (>= 0.19.4, < 2.0)
tins (~> 1.6)
coveralls_reborn (0.28.0)
simplecov (~> 0.22.0)
term-ansicolor (~> 1.7)
thor (~> 1.2)
tins (~> 1.32)
crack (1.0.0)
bigdecimal
rexml
Expand Down Expand Up @@ -221,6 +217,10 @@ GEM
diff-lcs (1.5.1)
diffy (3.4.2)
docile (1.4.0)
dotenv (2.8.1)
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
railties (>= 3.2)
easy_translate (0.5.1)
thread
thread_safe
Expand Down Expand Up @@ -351,6 +351,7 @@ GEM
mini_mime (1.1.5)
mini_portile2 (2.8.6)
minitest (5.22.3)
mize (0.5.0)
msgpack (1.7.2)
multi_json (1.15.0)
multi_xml (0.6.0)
Expand Down Expand Up @@ -564,11 +565,12 @@ GEM
shoulda-context (2.0.0)
shoulda-matchers (4.5.1)
activesupport (>= 4.2.0)
simplecov (0.16.1)
simplecov (0.22.0)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
slim (5.2.1)
temple (~> 0.10.0)
tilt (>= 2.1.0)
Expand All @@ -595,7 +597,8 @@ GEM
stackprof (0.2.26)
sync (0.5.0)
temple (0.10.3)
term-ansicolor (1.8.0)
term-ansicolor (1.10.4)
mize (~> 0.5)
tins (~> 1.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
Expand Down Expand Up @@ -681,16 +684,17 @@ DEPENDENCIES
capistrano-bundler (~> 1.6)
capistrano-rails (~> 1.4)
capybara
capybara-webkit
carrierwave
charlock_holmes
clipboard-rails
coveralls
coveralls_reborn
database_cleaner
devise
devise-encryptable
devise_masquerade (~> 1.2.0)
diffy
dotenv
dotenv-rails
easy_translate
edtf
edtf-humanize
Expand Down
7 changes: 4 additions & 3 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ default: &default
collation: utf8mb4_unicode_ci
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
password: <%= ENV['MYSQL_ROOT_PASSWORD'] %>
socket: <%= ENV['MYSQL_SOCKET'] %>
strict: false
variables:
sql_mode: TRADITIONAL
Expand All @@ -25,7 +25,7 @@ default: &default
development:
<<: *default
username: rails
password: rails
password: <%= ENV['MYSQL_DEV_PASSWORD'] %>
database: diary_development

# Warning: The database defined as "test" will be erased and
Expand All @@ -34,6 +34,7 @@ development:
test:
<<: *default
database: diary_test
host: 127.0.0.1

# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
Expand Down
6 changes: 4 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
require 'factory_bot'
require 'webmock/rspec'
require 'database_cleaner'

require 'coveralls'
Coveralls.wear!
Coveralls.wear!('rails')

DatabaseCleaner.strategy = :transaction

Expand Down Expand Up @@ -85,10 +86,11 @@
end

Capybara.configure do |config|
config.asset_host = "http://localhost:3000"
config.asset_host = 'http://localhost:3000'
config.raise_server_errors = false
end


Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
Expand Down

0 comments on commit 2f20955

Please sign in to comment.