-
Notifications
You must be signed in to change notification settings - Fork 53
/
.gitlab-ci.yml
122 lines (112 loc) · 3.65 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
image: "complat/complat-ubuntu-runner:development-5.0b920674f8"
services:
- postgres:12-alpine
variables:
POSTGRES_DB: chemotion_test
POSTGRES_USER: chemotion_test
POSTGRES_PASSWORD: "123456"
.cachingbuild:
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- public/
# - .bundle/
# - node_modules/
- .env
.caching:
extends: .cachingbuild
cache:
policy: pull
.before_scripting:
before_script:
# - mv ~/shared/bundle/ ~/shared/bundle.bak/
# - mv vendor/bundle/ ~/shared/
- cp config/database.yml.gitlab config/database.yml
- cp -f config/storage.yml.example config/storage.yml
- cp -f config/profile_default.yml.example config/profile_default.yml
- touch config/datacollectors.yml
- touch config/klasses.json
stages:
- build
- unit
- acceptance
building:
extends: .cachingbuild
stage: build
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
# - mkdir -p ~/.ssh
# - chmod 700 ~/.ssh
# - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
# - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
# - chmod 600 ~/.ssh/id_rsa
# - ssh-add ~/.ssh/id_rsa
# - ssh-keyscan git.scc.kit.edu >> ~/.ssh/known_hosts
# - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- |
if [ ${#SSH_PRIVATE_KEY} -ge 1000 ]; then
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-add ~/.ssh/id_rsa
#echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
ssh-keyscan git.scc.kit.edu >> ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
echo "$SSH_CONFIG" > ~/.ssh/config
chmod 600 ~/.ssh/config
fi
- if test ! -d "node_modules"; then ln -s /home/gitlab-runner/shared/node_modules node_modules; fi
- cp config/database.yml.gitlab config/database.yml
- cp -f config/storage.yml.example config/storage.yml
- cp -f config/profile_default.yml.example config/profile_default.yml
- echo "$DOTENV" > .env
- touch config/datacollectors.yml
- touch config/klasses.json
script:
- /bin/bash -l -c "bundle install"
- /bin/bash -l -c "bundle list"
- /bin/bash -l -c "yarn install"
- /bin/bash -l -c "RAILS_ENV=test bundle exec bin/rails db:migrate db:test:prepare"
testrb:
extends:
- .caching
- .before_scripting
stage: unit
script:
- /bin/bash -l -c "bundle install"
- /bin/bash -l -c "bundle list"
- /bin/bash -l -c "yarn install"
- /bin/bash -l -c "RAILS_ENV=test bundle exec bin/rails db:migrate db:test:prepare"
- /bin/bash -l -c "RAILS_ENV=test bundle exec bin/rails db:seed"
- /bin/bash -l -c "RAILS_ENV=test bundle exec rspec --exclude-pattern spec/{features}/**/*_spec.rb"
except:
variables:
- $CI_COMMIT_MESSAGE =~ /skip[ _-]unitrb/i
- $CI_COMMIT_MESSAGE =~ /skip[ _-]allunits?/i
testjs:
extends:
- .caching
- .before_scripting
stage: unit
script:
- /bin/bash -l -c "bundle install"
- /bin/bash -l -c "yarn install"
- /bin/bash -l -c "RAILS_ENV=test bundle exec rake db:test:prepare && yarn test"
except:
variables:
- $CI_COMMIT_MESSAGE =~ /skip[ _-]unitjs/i
- $CI_COMMIT_MESSAGE =~ /skip[ _-]allunits?/i
testacceptance:
extends:
- .caching
- .before_scripting
stage: acceptance
script:
- /bin/bash -l -c "bundle install"
- /bin/bash -l -c "yarn install"
- /bin/bash -l -c "RAILS_ENV=test bundle exec bin/rails db:migrate db:test:prepare && bundle exec rake assets:precompile && bundle exec rspec spec/features"
except:
variables:
- $CI_COMMIT_MESSAGE =~ /skip[ _-]acceptance/i