.gitlab-ci.yml 1.17 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
  DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/$POSTGRES_DB"
19
  POSTGRES_HOST_AUTH_METHOD: trust
Andi Staub's avatar
Andi Staub committed
20 21

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

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

36
system:
Kaspar Vollenweider's avatar
Kaspar Vollenweider committed
37 38
  stage: test
  script:
39 40 41
    - 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
Markus Koller's avatar
Markus Koller committed
42
    - bundle exec rails test:system
Markus Koller's avatar
Markus Koller committed
43 44 45 46 47
  artifacts:
    paths:
      - tmp/screenshots
    when: on_failure
    expire_in: 1 week
48 49
  cache:
    policy: pull