This repository has been archived by the owner on May 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
94 lines (80 loc) · 1.97 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
default:
image: epigenesys/rails:ruby2.6.5
services:
- postgres:latest
before_script:
- yarn install --production --pure-lockfile --cache-folder .yarn-cache
# - 'bundle config gems.shefcompsci.org.uk gitlab:${GEM_SERVER_KEY}'
- bundle check --path vendor/bundle || bundle --deployment --without development -j $(nproc)
.db-setup: &db-setup |
cat > config/database.yml << EOF
test:
adapter: postgresql
host: postgres
database: $POSTGRES_DB
username: $POSTGRES_USER
password: $POSTGRES_PASSWORD
EOF
.default-cache: &default-cache
key:
files:
- Gemfile.lock
- package.json
paths:
- vendor/bundle
- node_modules
- .yarn-cache/
.pull-cache: &pull-cache
cache:
<<: *default-cache
policy: pull
stages:
- prepare
- test
- post-test
variables:
POSTGRES_DB: ci_test
POSTGRES_USER: runner
POSTGRES_PASSWORD: password
setup-test-env:
stage: prepare
cache:
<<: *default-cache
script:
- *db-setup
- bundle exec rails db:drop db:create db:schema:load RAILS_ENV=test
artifacts:
expire_in: 1h
paths:
- config/database.yml
.rspec:
stage: test
<<: *pull-cache
dependencies: ['setup-test-env']
needs: ['setup-test-env']
script:
- bundle exec rspec ${CI_JOB_NAME//[:]/\/}
artifacts:
paths:
- 'coverage/$CI_JOB_NAME'
when: always
expire_in: 1h
spec:helpers spec:mailers spec:policies spec:serializers spec:validators spec:services:
extends: .rspec
spec:models:
extends: .rspec
spec:requests:
extends: .rspec
spec:system:
extends: .rspec
script:
- bundle exec rails runner -e test 'Webdrivers.install_dir = Rails.root.join("vendor", "webdrivers"); Webdrivers::Chromedriver.update'
- bundle exec rspec spec/system
coverage:
stage: post-test
when: always
<<: *pull-cache
script:
- bundle exec ruby lib/scripts/merge-simplecov.rb
- source lib/scripts/push-coverage-report.sh
coverage: '/LOC \((\d+\.\d+%)\) covered.$/'