Skip to content
Snippets Groups Projects
Forked from PortalMEC / portalmec
261 commits behind the upstream repository.
.gitlab-ci.yml 1.49 KiB
image: ruby:2.3.1

services:
  - postgres:9.5
  - elasticsearch:6.5.1
  - redis:latest

variables:
  POSTGRES_DB: portalmec_test
  POSTGRES_USER: portalmec
  POSTGRES_PASSWORD: 123mudar
  ELASTICSEARCH_URL: http://elasticsearch:9200
  REDIS_HOST: redis:6379
  REDIS_RATE_LIMIT_URL: redis://redis:6379/0
  DSPACE_LOGIN: '$mecdb1_login'
  DSPACE_PASS: '$mecdb1_password'

stages:
  - test
  - apidoc
  - deploy

before_script:
  - apt-get update -y
  - apt-get install default-jre postgresql-client -y
  - apt-get remove --purge --auto-remove redis-server -y
  - apt-get install redis-server -y
  - apt-get install nodejs -y
  # official way to provide password to psql: http://www.postgresql.org/docs/9.3/static/libpq-envars.html
  - export PGPASSWORD=$POSTGRES_PASSWORD
  - psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT 'OK' AS status;"
  # gems
  - gem install bundler
  - bundle install --jobs $(nproc) --path=/cache/bundler

test:
  stage: test
  script:
    - bundle exec rake db:migrate:reset RAILS_ENV=test
    - bundle exec rake spec:acceptance
  tags:
    - ruby
    - postgres
    - elasticsearch
    - redis

doc:
  stage: apidoc
  script:
    - bundle exec rake db:migrate:reset RAILS_ENV=test
    - bundle exec rake docs:generate
    - ./docploy.sh
  only:
    - stable
  tags:
    - ruby
    - postgres
    - elasticsearch
    - redis
# deploy:
#   stage: deploy
#   script:
#   #   - mina deploy
#   only:
#     - master
#   tags:
#    - ruby
#    - postgres
#    - elasticsearch
#    - redis