Advertisement
Guest User

Untitled

a guest
Dec 9th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. .gitlab-ci.yml
  2.  
  3. image: "ruby:2.5.1"
  4.  
  5. Add Postgres and Selenium Docker services. A Firefox container is also available.
  6. services:
  7. - postgres:latest
  8. - selenium/standalone-chrome:latest
  9.  
  10. Set our environment variables. Note it's supplying where Gitlab's
  11. Docker service will make Selenium available at. The Postgres
  12. config matches a database.yml.gitlab we'll add later.
  13. variables:
  14. POSTGRES_DB: "test_db"
  15. POSTGRES_USER: "runner"
  16. POSTGRES_PASSWORD: ""
  17. RAILS_ENV: "test"
  18. SELENIUM_URL: "http://selenium__standalone-chrome:4444/wd/hub"
  19.  
  20. # Cache gems in between builds. We use the project path slug
  21. # as the key because one cache per project works well enough
  22. # for us
  23. cache:
  24. key: ${CI_PROJECT_PATH_SLUG}
  25. paths:
  26. - vendor/ruby
  27.  
  28. Setup shell commands. We need nodejs for asset compilation,
  29. And libgmp for the bcrypt gem. Then we override the database
  30. configuration with our Gitlab configuration. Now, we can
  31. install our gem dependences, bundle to the vendor folder so we # can cache them, and finally prep the database.
  32. before_script:
  33. - apt-get update -q && apt-get install nodejs libgmp-dev -yqq
  34. - cp config/database.yml.gitlab config/database.yml
  35. - gem install bundler rubocop --no-ri --no-rdoc
  36. - bundle install -j $(nproc) --path vendor
  37. - rails db:schema:load
  38.  
  39. We have two jobs, first, we lint the project with Rubocop to
  40. keep us honest and clean
  41. rubocop:
  42. script:
  43. - rubocop
  44.  
  45. Then we run our RSpec suite. When we run tests against
  46. Selenium, Rails will save screenshots of failures. We capture
  47. Them as artifacts so we can grab them through Gitlab's UI
  48. later.
  49. rspec:
  50. script:
  51. - rspec spec
  52. artifacts:
  53. when: on_failure
  54. expire_in: 1 week
  55. paths:
  56. - tmp/screenshots/
  57. - log/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement