回答編集履歴
2
修正
test
CHANGED
@@ -75,6 +75,8 @@
|
|
75
75
|
sudo rm /usr/local/bin/bundler
|
76
76
|
|
77
77
|
sudo gem install bundler
|
78
|
+
|
79
|
+
|
78
80
|
|
79
81
|
# Download and cache dependencies
|
80
82
|
|
1
サンプル追加
test
CHANGED
@@ -1,3 +1,167 @@
|
|
1
1
|
`gem install bundler`をしないと...
|
2
2
|
|
3
3
|
`bundler`は元々インストールされてません。
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
必要なとこだけ参考にしてください。
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
```yml
|
12
|
+
|
13
|
+
version: 2
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
|
17
|
+
build:
|
18
|
+
|
19
|
+
docker:
|
20
|
+
|
21
|
+
# specify the version you desire here
|
22
|
+
|
23
|
+
- image: circleci/ruby:2.6.3-stretch-node-browsers
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
# bundler 2+ 対応
|
28
|
+
|
29
|
+
environment:
|
30
|
+
|
31
|
+
RAILS_ENV: test
|
32
|
+
|
33
|
+
BUNDLER_VERSION: 2.0.2
|
34
|
+
|
35
|
+
POSTGRES_USER: postgres
|
36
|
+
|
37
|
+
POSTGRES_DB: app_test
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
# Specify service dependencies here if necessary
|
42
|
+
|
43
|
+
# CircleCI maintains a library of pre-built images
|
44
|
+
|
45
|
+
# documented at https://circleci.com/docs/2.0/circleci-images/
|
46
|
+
|
47
|
+
- image: circleci/postgres:11.3-alpine
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
working_directory: ~/app_name
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
steps:
|
56
|
+
|
57
|
+
- checkout
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
# bundler 2+ 対応
|
62
|
+
|
63
|
+
- run:
|
64
|
+
|
65
|
+
name: setup bundler
|
66
|
+
|
67
|
+
command: |
|
68
|
+
|
69
|
+
sudo gem update --system
|
70
|
+
|
71
|
+
sudo gem uninstall bundler
|
72
|
+
|
73
|
+
sudo rm /usr/local/bin/bundle
|
74
|
+
|
75
|
+
sudo rm /usr/local/bin/bundler
|
76
|
+
|
77
|
+
sudo gem install bundler
|
78
|
+
|
79
|
+
# Download and cache dependencies
|
80
|
+
|
81
|
+
- restore_cache:
|
82
|
+
|
83
|
+
keys:
|
84
|
+
|
85
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
86
|
+
|
87
|
+
# fallback to using the latest cache if no exact match is found
|
88
|
+
|
89
|
+
- v1-dependencies-
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
- run:
|
94
|
+
|
95
|
+
name: install dependencies
|
96
|
+
|
97
|
+
command: |
|
98
|
+
|
99
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
100
|
+
|
101
|
+
- save_cache:
|
102
|
+
|
103
|
+
paths:
|
104
|
+
|
105
|
+
- ./vendor/bundle
|
106
|
+
|
107
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
# Database setup
|
112
|
+
|
113
|
+
- run: bundle exec rake db:create
|
114
|
+
|
115
|
+
- run: bundle exec rake db:schema:load
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
# run tests!
|
120
|
+
|
121
|
+
- run:
|
122
|
+
|
123
|
+
name: run tests
|
124
|
+
|
125
|
+
command: |
|
126
|
+
|
127
|
+
mkdir /tmp/test-results
|
128
|
+
|
129
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
|
130
|
+
|
131
|
+
circleci tests split --split-by=timings)"
|
132
|
+
|
133
|
+
bundle exec rspec \
|
134
|
+
|
135
|
+
--format progress \
|
136
|
+
|
137
|
+
--format RspecJunitFormatter \
|
138
|
+
|
139
|
+
--out /tmp/test-results/rspec.xml \
|
140
|
+
|
141
|
+
--format progress \
|
142
|
+
|
143
|
+
$TEST_FILES
|
144
|
+
|
145
|
+
# collect reports
|
146
|
+
|
147
|
+
- store_test_results:
|
148
|
+
|
149
|
+
path: /tmp/test-results
|
150
|
+
|
151
|
+
- store_artifacts:
|
152
|
+
|
153
|
+
path: /tmp/test-results
|
154
|
+
|
155
|
+
destination: test-results
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
# run rubocop
|
160
|
+
|
161
|
+
- run:
|
162
|
+
|
163
|
+
name: run rubocop
|
164
|
+
|
165
|
+
command: bundle exec rubocop
|
166
|
+
|
167
|
+
```
|