Skip to content

Commit

Permalink
Add GitLab CI runner
Browse files Browse the repository at this point in the history
- Add 'headless' gem for xvfb manipulation
- Add GitLab CI build file
- Update `selenium-webdriver`gem to prevent random Chrome failure
  • Loading branch information
camannguyenthanh committed Jan 24, 2017
1 parent f36ff8a commit a9f85a6
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 5 deletions.
32 changes: 32 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
image: "complat/ubuntu-runner"

services:
- postgres:9.3-alpine

variables:
POSTGRES_DB: chemotion_test
POSTGRES_USER: chemotion_test
POSTGRES_PASSWORD: "123456"

cache:
untracked: true
key: "$CI_BUILD_REF_NAME"
paths:
- node_modules/
- public/
- .bundle/

# stages:
# - rspec
# - npm

test:
# stage: rspec
script:
- cp config/database.yml.gitlab config/database.yml
- /bin/bash -l -c "gem install bundle && bundle install && source ~/.nvm/nvm.sh &&
npm install && bundle exec rake db:test:prepare && bundle exec rake && npm test"
# npm:
# stage: npm
# script:
# - /bin/bash -l -c "source ~/.nvm/nvm.sh && npm install && npm test"
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ group :test do
gem "faker", "~> 1.6.6"
gem "capybara", "~> 2.7.1"
gem "launchy", "~> 2.4.3"
gem "selenium-webdriver", "~> 2.53.4"
gem "selenium-webdriver", "~> 3.0.5"
gem "chromedriver-helper", "1.0.0"
gem "headless", "2.0.0"
end

# Chemotion plugins: lsit your chemotion specific plugin gems here
Expand Down
6 changes: 4 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ GEM
hashie (3.4.4)
hashie-forbidden_attributes (0.1.1)
hashie (>= 3.0)
headless (2.0.0)
hitimes (1.2.4)
html2haml (2.0.0)
erubis (~> 2.7.0)
Expand Down Expand Up @@ -392,7 +393,7 @@ GEM
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
selenium-webdriver (2.53.4)
selenium-webdriver (3.0.5)
childprocess (~> 0.5)
rubyzip (~> 1.0)
websocket (~> 1.0)
Expand Down Expand Up @@ -500,6 +501,7 @@ DEPENDENCIES
grape-kaminari
haml-rails (~> 0.9)
hashie-forbidden_attributes
headless (= 2.0.0)
httparty
jbuilder (~> 2.0)
jquery-rails
Expand All @@ -524,7 +526,7 @@ DEPENDENCIES
sablon!
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
selenium-webdriver (~> 2.53.4)
selenium-webdriver (~> 3.0.5)
spring
stackprof
thin
Expand Down
15 changes: 15 additions & 0 deletions config/database.yml.gitlab
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
development:
adapter: postgresql
encoding: unicode
database: chemotion_dev
pool: 5
username: chemotion_dev
password: 123456
test:
adapter: postgresql
encoding: unicode
database: chemotion_test
username: chemotion_test
pool: 5
password: 123456
host: postgres
10 changes: 8 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
WebMock.disable_net_connect!(allow_localhost: true)

require 'factory_girl_rails'

require 'headless'
require 'capybara'

@headless = Headless.new
@headless.start

Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
http_client = Selenium::WebDriver::Remote::Http::Default.new
http_client.read_timeout = 100
Capybara::Selenium::Driver.new(app, browser: :chrome, :http_client => http_client)
end

RSpec.configure do |config|
Expand Down

0 comments on commit a9f85a6

Please sign in to comment.