This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
89 lines (83 loc) · 1.81 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
86
87
88
89
stages:
- build
- test
- deploy
variables:
RAKE_COMMAND: sudo -u $RAILS_USER -n -i $RAILS_ROOT/bin/rake -f $RAILS_ROOT/Rakefile
build_job:
stage: build
before_script:
- ruby -v
- gem install bundler -v '2.0.1' -N
- sudo -u $RAILS_USER -n -i gem install bundler -v '2.0.1' -N
- bundle version
script:
- cp $RAILS_DEPLOY_PATH/etc/*.yml config/
- bundle install --path=vendor/bundle --binstubs=bin --no-cache --clean
- bundle binstubs bundler --force
- bundle exec rake assets:precompile
artifacts:
paths:
- .bundle/
- bin/
- config/*.yml
- public/assets/
- vendor/bundle/
cache:
key: gems
paths:
- vendor/bundle/ruby
tags:
- antsy
test_job:
stage: test
before_script:
- source $RAILS_DEPLOY_PATH/etc/export-test.env
- bin/rake db:reset
script:
- bin/rake spec
tags:
- development
- antsy
deploy_dev:
environment:
name: development
url: https://find-dev.library.duke.edu
stage: deploy
script: &deployscript
- rsync -rl --delete --exclude-from=EXCLUDE ./ $RAILS_ROOT/
- '$RAKE_COMMAND db:setup 2>/dev/null || true'
- $RAKE_COMMAND db:migrate tmp:cache:clear
after_script: &afterdeployscript
- sudo /usr/bin/systemctl restart $RAILS_SERVICE_UNIT
only:
- develop
- antsy
tags:
- development
- antsy
deploy_pre:
environment:
name: pre-production
url: https://find-test.library.duke.edu
stage: deploy
script: *deployscript
after_script: *afterdeployscript
only:
- master
- /^release.*/
- /^hotfix.*/
tags:
- staging
deploy_prod:
environment:
name: production
url: https://find.library.duke.edu
stage: deploy
script: *deployscript
after_script: *afterdeployscript
only:
- master
when: manual
tags:
- production