-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
78 lines (67 loc) · 1.62 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
# base image
image: "circleci/ruby:2.6.2-node-browsers"
# Services
services:
- postgres:latest
# default variables
variables:
RAILS_ENV: test
POSTGRES_DB: tamashii
DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB"
# build stages
stages:
- test
- deploy
# cache gems in between builds
cache:
paths:
- vendor/ruby
- node_modules
# this is a basic example for a gem or script which doesn't use
# services such as redis or postgres
before_script:
- gem install bundler -v 1.17.3
- bundle install --without development -j $(nproc) --path vendor # install dependencies into ./vendor/ruby
- yarn install
# jobs
rspec:
stage: test
script:
- bundle exec rake db:schema:load
- bundle exec rspec
rubocop:
stage: test
services: []
before_script:
- bundle install --without development -j $(nproc) --path vendor
script:
- bundle exec rubocop
eslint:
stage: test
services: []
before_script:
- npm install
script:
- npm run eslint
scsslint:
stage: test
services: []
before_script:
- gem install scss_lint
script:
- scss-lint app/assets/stylesheets/
deploy:staging:
stage: deploy
only:
- develop
before_script:
- gem install bundler -v 1.17.3
- bundle install -j $(nproc) --path vendor
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
environment: production
script:
- bundle exec cap staging deploy