This repository has been archived by the owner on Jul 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
/
.gitlab-ci.yml
85 lines (71 loc) · 2.43 KB
/
.gitlab-ci.yml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
stages:
- test
- build
.rails_template: &rails_template
image: ruby:2.6.5
stage: test
services:
- mysql:5.7
variables:
MYSQL_DATABASE: gitlab_ci_test
MYSQL_ROOT_PASSWORD: reservations
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- vendor/ruby
before_script:
- gem install bundler --no-document
- bundle install -j $(nproc) --path vendor/ruby
- cp config/database.gitlab.yml config/database.yml
rails_test:
<<: *rails_template
script:
- curl -sL https://deb.nodesource.com/setup_12.x | bash -
- curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
- echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
- apt-get update && apt-get install -y --no-install-recommends nodejs unzip openjdk-11-jre-headless xvfb libxi6 libgconf-2-4 google-chrome-stable
- CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
- wget -N http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -P ~/
- unzip ~/chromedriver_linux64.zip -d ~/
- rm ~/chromedriver_linux64.zip
- mv -f ~/chromedriver /usr/local/bin/chromedriver
- chown root:root /usr/local/bin/chromedriver
- chmod 0755 /usr/local/bin/chromedriver
- bundle exec rake
rails_style:
<<: *rails_template
script:
- bundle exec rake check_style
rails_audit:
<<: *rails_template
script:
- bundle exec bundle audit update
- bundle exec bundle audit --ignore CVE-2016-7103
build:rails:
image: "docker:latest"
variables:
DOCKER_TLS_CERTDIR: ""
services:
- docker:dind
stage: build
script:
- export IMAGE_TAG=$(echo -en $CI_BUILD_REF_NAME | tr -c '[:alnum:]_.-' '-')
- docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $CI_REGISTRY
- docker build -f Dockerfile.prod --pull -t "$CI_REGISTRY_IMAGE:$IMAGE_TAG" .
- docker push "$CI_REGISTRY_IMAGE:$IMAGE_TAG"
only:
- tags
build:cron:
image: "docker:latest"
variables:
DOCKER_TLS_CERTDIR: ""
services:
- docker:dind
stage: build
script:
- export IMAGE_TAG=$(echo -en $CI_BUILD_REF_NAME | tr -c '[:alnum:]_.-' '-')
- docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $CI_REGISTRY
- docker build -f Dockerfile.cron --pull -t "${CI_REGISTRY_IMAGE}:${IMAGE_TAG}-cron" .
- docker push "${CI_REGISTRY_IMAGE}:${IMAGE_TAG}-cron"
only:
- tags