summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 84db51f1546ce4fe11614f23d0cba3b9d3515e85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.3-git-2.7-phantomjs-2.1"

cache:
  key: "ruby-231"
  paths:
  - vendor/ruby

variables:
  MYSQL_ALLOW_EMPTY_PASSWORD: "1"
  # retry tests only in CI environment
  RSPEC_RETRY_RETRY_COUNT: "3"
  RAILS_ENV: "test"
  SIMPLECOV: "true"
  SETUP_DB: "true"
  USE_BUNDLE_INSTALL: "true"
  GIT_DEPTH: "20"
  PHANTOMJS_VERSION: "2.1.1"

before_script:
  - source ./scripts/prepare_build.sh
  - cp config/gitlab.yml.example config/gitlab.yml
  - bundle --version
  - '[ "$USE_BUNDLE_INSTALL" != "true" ] || retry bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}"'
  - retry gem install knapsack
  - '[ "$SETUP_DB" != "true" ] || bundle exec rake db:drop db:create db:schema:load db:migrate add_limits_mysql'

stages:
- prepare
- test
- post-test
- pages

.use-db: &use-db
  services:
    - mysql:latest
    - redis:alpine

migration paths:
  stage: test
  <<: *use-db
  variables:
    SETUP_DB: "false"
  script:
    - git fetch origin v8.5.9
    - git checkout -f FETCH_HEAD
    - cp config/resque.yml.example config/resque.yml
    - sed -i 's/localhost/redis/g' config/resque.yml
    - bundle install --without postgres production --jobs $(nproc) ${FLAGS[@]} --retry=3
    - rake db:drop db:create db:schema:load db:seed_fu
    - git checkout $CI_BUILD_REF
    - source scripts/prepare_build.sh
    - rake db:migrate