.gitlab-ci.yml 1.14 KB
Newer Older
1
image: git.panter.ch:5001/panter/gitlab-ci-docker-images/ruby-and-rails:ruby-2.4.5-node8-chrome-imagemagick-chromedriver
2

Andi Staub's avatar
Andi Staub committed
3 4 5 6
stages:
  - test

services:
Markus Koller's avatar
Markus Koller committed
7
  - postgres:9.6
Andi Staub's avatar
Andi Staub committed
8

9 10 11 12 13 14
cache:
  key: "$CI_PROJECT_ID"
  paths:
    - tmp/cache/ruby
    - tmp/cache/yarn

Andi Staub's avatar
Andi Staub committed
15 16
variables:
  RAILS_ENV: test
Andi Staub's avatar
Andi Staub committed
17
  POSTGRES_DB: aoz_test
Andi Staub's avatar
Andi Staub committed
18 19 20
  DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/$POSTGRES_DB"

before_script:
21
  - google-chrome --version
22 23 24
  - node --version
  - ruby --version
  - yarn --version
25
  - gem install bundler
26 27
  - bundle install --without development --path tmp/cache
  - yarn install --cache-folder tmp/cache/yarn
Andi Staub's avatar
Andi Staub committed
28
  - bundle exec rails db:schema:load
Andi Staub's avatar
Andi Staub committed
29 30

test:
Andi Staub's avatar
Andi Staub committed
31 32
  stage: test
  script:
Kaspar Vollenweider's avatar
Kaspar Vollenweider committed
33
    - bundle exec rails test
Kaspar Vollenweider's avatar
Kaspar Vollenweider committed
34

35
system:
Kaspar Vollenweider's avatar
Kaspar Vollenweider committed
36 37
  stage: test
  script:
38 39 40
    - CHROME_VERSION=$(google-chrome --version | sed -r 's/[^0-9]+([0-9]+\.[0-9]+\.[0-9]+).*/\1/g')
    - CHROMEDRIVER_VERSION=$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION)
    - bundle exec chromedriver-update $CHROMEDRIVER_VERSION
41
    - bundle exec rails test:system
Markus Koller's avatar
Markus Koller committed
42 43 44 45 46
  artifacts:
    paths:
      - tmp/screenshots
    when: on_failure
    expire_in: 1 week
47 48
  cache:
    policy: pull