回答編集履歴
2
修正
answer
CHANGED
@@ -37,6 +37,7 @@
|
|
37
37
|
sudo rm /usr/local/bin/bundle
|
38
38
|
sudo rm /usr/local/bin/bundler
|
39
39
|
sudo gem install bundler
|
40
|
+
|
40
41
|
# Download and cache dependencies
|
41
42
|
- restore_cache:
|
42
43
|
keys:
|
1
サンプル追加
answer
CHANGED
@@ -1,2 +1,84 @@
|
|
1
1
|
`gem install bundler`をしないと...
|
2
|
-
`bundler`は元々インストールされてません。
|
2
|
+
`bundler`は元々インストールされてません。
|
3
|
+
|
4
|
+
必要なとこだけ参考にしてください。
|
5
|
+
|
6
|
+
```yml
|
7
|
+
version: 2
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
docker:
|
11
|
+
# specify the version you desire here
|
12
|
+
- image: circleci/ruby:2.6.3-stretch-node-browsers
|
13
|
+
|
14
|
+
# bundler 2+ 対応
|
15
|
+
environment:
|
16
|
+
RAILS_ENV: test
|
17
|
+
BUNDLER_VERSION: 2.0.2
|
18
|
+
POSTGRES_USER: postgres
|
19
|
+
POSTGRES_DB: app_test
|
20
|
+
|
21
|
+
# Specify service dependencies here if necessary
|
22
|
+
# CircleCI maintains a library of pre-built images
|
23
|
+
# documented at https://circleci.com/docs/2.0/circleci-images/
|
24
|
+
- image: circleci/postgres:11.3-alpine
|
25
|
+
|
26
|
+
working_directory: ~/app_name
|
27
|
+
|
28
|
+
steps:
|
29
|
+
- checkout
|
30
|
+
|
31
|
+
# bundler 2+ 対応
|
32
|
+
- run:
|
33
|
+
name: setup bundler
|
34
|
+
command: |
|
35
|
+
sudo gem update --system
|
36
|
+
sudo gem uninstall bundler
|
37
|
+
sudo rm /usr/local/bin/bundle
|
38
|
+
sudo rm /usr/local/bin/bundler
|
39
|
+
sudo gem install bundler
|
40
|
+
# Download and cache dependencies
|
41
|
+
- restore_cache:
|
42
|
+
keys:
|
43
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
44
|
+
# fallback to using the latest cache if no exact match is found
|
45
|
+
- v1-dependencies-
|
46
|
+
|
47
|
+
- run:
|
48
|
+
name: install dependencies
|
49
|
+
command: |
|
50
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
51
|
+
- save_cache:
|
52
|
+
paths:
|
53
|
+
- ./vendor/bundle
|
54
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
55
|
+
|
56
|
+
# Database setup
|
57
|
+
- run: bundle exec rake db:create
|
58
|
+
- run: bundle exec rake db:schema:load
|
59
|
+
|
60
|
+
# run tests!
|
61
|
+
- run:
|
62
|
+
name: run tests
|
63
|
+
command: |
|
64
|
+
mkdir /tmp/test-results
|
65
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
|
66
|
+
circleci tests split --split-by=timings)"
|
67
|
+
bundle exec rspec \
|
68
|
+
--format progress \
|
69
|
+
--format RspecJunitFormatter \
|
70
|
+
--out /tmp/test-results/rspec.xml \
|
71
|
+
--format progress \
|
72
|
+
$TEST_FILES
|
73
|
+
# collect reports
|
74
|
+
- store_test_results:
|
75
|
+
path: /tmp/test-results
|
76
|
+
- store_artifacts:
|
77
|
+
path: /tmp/test-results
|
78
|
+
destination: test-results
|
79
|
+
|
80
|
+
# run rubocop
|
81
|
+
- run:
|
82
|
+
name: run rubocop
|
83
|
+
command: bundle exec rubocop
|
84
|
+
```
|