Skip to content

Commit

Permalink
set up github actions (#27)
Browse files Browse the repository at this point in the history
* install just the dev package of libxslt

* removes trailing spaces

* migrates some of our travis configs

* database config

* retire travis task to avoid double started solr/fedora

* remove 2.5 add updated shoulda-matchers

* stick to bundler 2.1.4

rubyjs/libv8#310

* only build against 2.6 for now

* add optional 2.7 job

* reconfigure coveralls

* adds simplecov

* require simplecov
  • Loading branch information
mkorcy committed Sep 8, 2021
1 parent 7833091 commit eae878e
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 63 deletions.
84 changes: 47 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:

continue-on-error: ${{ matrix.experimental }}
runs-on: ubuntu-latest

env:
Expand All @@ -22,7 +22,10 @@ jobs:
DATA_STORAGE: ./public
TEMP_STORAGE: ./public
ALLOW_NOTIFICATIONS: true

DB_DATABASE: epigaea_test
DB_USER: root
DB_PASSWORD: root

services:
redis:
image: redis
Expand All @@ -32,36 +35,29 @@ jobs:
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
postgres:
image: postgres
env:
POSTGRES_USER: hyrax
POSTGRES_PASSWORD: password
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
ports: ["5432:5432"]

- 6379:6379
strategy:
fail-fast: false
matrix:
ruby-version: ['2.5','2.6','2.7']
ruby-version: ['2.6']
experimental: [false]
include:
- ruby-version: 2.7
experimental: true

steps:
- name: Install OS packages
run: |
sudo apt-get update
sudo apt-get install unzip imagemagick ghostscript libpq-dev libxslt libxslt-dev
sudo apt-get install unzip imagemagick ghostscript libpq-dev libxslt-dev
- uses: actions/checkout@v2
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler: "2.1.4"
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Update rubygems
run: |
Expand All @@ -78,29 +74,43 @@ jobs:
curl -o $HOME/fits-1.0.5.zip https://projects.iq.harvard.edu/files/fits/files/fits-1.0.5.zip | cat
unzip $HOME/fits-1.0.5.zip -d $HOME
chmod u=u+x $HOME/fits-1.0.5/fits.sh
- name: Setup test database
env:
RAILS_ENV: test
PGHOST: localhost
PGUSER: hyrax
# Variable needs to be PGPASSWORD so postgres cli can read it.
# Variable is supposedly deprecated in postgres, but can't find the notice in postgres docs
PGPASSWORD: password
- name: Set up MySQL
run: |
psql -c 'create database hyrax_test with owner hyrax;'
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }}
- name: Configure test environment
run: |
cp config/fedora.yml.sample config/fedora.yml
cp config/solr.yml.sample config/solr.yml
cp config/devise.yml.sample config/devise.yml
cp config/redis.yml.sample config/redis.yml
cp config/database.yml.sample config/database.yml
cp config/blacklight.yml.sample config/blacklight.yml
cp config/handle.yml.sample config/handle.yml
cp config/secrets.yml.sample config/secrets.yml
- name: Create database
run: |
RAILS_ENV=test bundle exec rake db:create
RAILS_ENV=test bundle exec rake db:migrate --trace
- name: Set up sipity
run: |
RAILS_ENV=test bundle exec rake hyrax:workflow:load
- name: Setup hyrax test environment
run: |
bundle exec rake hydra:test_server &
sleep 150
bundle exec rake test_setup RAILS_ENV=test
sleep 150
- name: Rubbocop
run: |
bundle exec rubocop
- name: Compile assets
run: |
bundle exec rails assets:precompile &> /dev/null
- name: Run tests
run: bundle exec rspec
run: xvfb-run -a bundle exec rake spec
env:
RAILS_ENV: test
REDIS_URL: redis://redis
POSTGRES_USER: hyrax
POSTGRES_PASSWORD: password
TMPDIR: /tmp
RAILS_ENV: test
TMPDIR: /tmp
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ group :development, :test do
gem 'capybara'
gem 'capybara-maleficent', require: false
gem 'capybara-screenshot'
gem 'coveralls', require: false
gem 'database_cleaner'
gem 'factory_girl_rails'
gem 'fcrepo_wrapper'
Expand All @@ -111,7 +110,9 @@ group :development, :test do
gem 'rails-controller-testing'
gem 'rspec-rails'
gem 'selenium-webdriver'
gem 'shoulda-matchers', git: 'https://github.com/thoughtbot/shoulda-matchers.git', branch: 'rails-5'
gem 'shoulda-matchers', '~> 4.5.1'
gem 'simplecov'
gem 'simplecov-lcov', '~> 0.8.0'
gem 'solr_wrapper', '>= 0.3'
end

Expand Down
33 changes: 12 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ GIT
chronic
hyrax (>= 2.1.0, <= 2.9.9)

GIT
remote: https://github.com/thoughtbot/shoulda-matchers.git
revision: 4b160bd19ecca7f97d7ac22dccd5fde9b0da5a9f
branch: rails-5
specs:
shoulda-matchers (3.1.2)
activesupport (>= 4.2.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -225,12 +217,6 @@ GEM
coffee-script-source (1.12.2)
concurrent-ruby (1.1.5)
connection_pool (2.2.2)
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)
crass (1.0.5)
database_cleaner (1.7.0)
declarative (0.0.10)
Expand All @@ -249,7 +235,7 @@ GEM
devise (>= 3.4.1)
net-ldap (>= 0.16.0)
diff-lcs (1.3)
docile (1.3.2)
docile (1.4.0)
dotenv (2.7.2)
dotenv-rails (2.7.2)
dotenv (= 2.7.2)
Expand Down Expand Up @@ -847,6 +833,8 @@ GEM
rdf-xsd (>= 2.2, < 4.0)
sparql (>= 2.2, < 4.0)
sxp (~> 1.0)
shoulda-matchers (4.5.1)
activesupport (>= 4.2.0)
sidekiq (5.2.7)
connection_pool (~> 2.2, >= 2.2.2)
rack (>= 1.5.0)
Expand All @@ -864,11 +852,13 @@ GEM
simple_form (3.5.0)
actionpack (> 4, < 5.2)
activemodel (> 4, < 5.2)
simplecov (0.16.1)
simplecov (0.21.2)
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-lcov (0.8.0)
simplecov_json_formatter (0.1.3)
slop (4.6.2)
solr_wrapper (2.1.0)
faraday
Expand Down Expand Up @@ -969,7 +959,6 @@ DEPENDENCIES
capybara-screenshot
chunky_png
coffee-rails (~> 4.2)
coveralls
database_cleaner
devise (>= 4.6.0)
devise-guests (~> 0.6)
Expand Down Expand Up @@ -1011,10 +1000,12 @@ DEPENDENCIES
sanitize (~> 4.6, >= 4.6.3)
sass-rails (~> 5.0)
selenium-webdriver
shoulda-matchers!
shoulda-matchers (~> 4.5.1)
sidekiq
sidekiq-failures
sidekiq-limit_fetch
simplecov
simplecov-lcov (~> 0.8.0)
solr_wrapper (>= 0.3)
sqlite3
term-ansicolor
Expand Down
2 changes: 2 additions & 0 deletions config/database.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ development:
test:
adapter: mysql2
database: epigaea_test
user: root
password: root
pool: 5
timeout: 5000

Expand Down
18 changes: 15 additions & 3 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
unless ENV['NO_COVERAGE'] == 'true'
require 'coveralls'
Coveralls.wear!('rails')
require 'simplecov'

SimpleCov.start 'rails' do
if ENV['CI']
require 'simplecov-lcov'

SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.single_report_path = 'coverage/lcov.info'
end

formatter SimpleCov::Formatter::LcovFormatter
end

add_filter %w[version.rb initializer.rb]
end

# This file is copied to spec/ when you run 'rails generate rspec:install'
Expand Down

0 comments on commit eae878e

Please sign in to comment.