-
Notifications
You must be signed in to change notification settings - Fork 966
/
config.yml
164 lines (153 loc) · 4.2 KB
/
config.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
version: 2.1
# Share Steps: glued in using the YAML alias
# See https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/
shared_ruby_steps: &shared_ruby_steps
parameters:
run-cc-reporter:
type: boolean
default: false
steps:
- attach_workspace:
at: .
- restore_cache:
keys:
- "{{ .Environment.CACHE_KEY_PREFIX }}-v1-bundler-deps-{{ .Branch }}"
- run:
name: Bundle Install
command: bundle install --path vendor/bundle --jobs 7 --retry 15
- when:
condition: << parameters.run-cc-reporter >>
steps:
- run:
name: Setup Code Climate test-reporter
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- run: mkdir -p ~/test-results/rspec
- run:
name: Run tests
command: bundle exec rspec --require rspec_junit_formatter --format progress --format RspecJunitFormatter --out ~/test-results/rspec/results.xml
- when:
condition: << parameters.run-cc-reporter >>
steps:
- run:
name: Run Code Climate test-reporter
command: ./cc-test-reporter after-build --coverage-input-type simplecov --exit-code $?
- save_cache:
key: "{{ .Environment.CACHE_KEY_PREFIX }}-v1-bundler-deps-{{ .Branch }}"
paths:
- ./vendor/bundle
- store_test_results:
path: ~/test-results/rspec
- store_artifacts:
path: ./Gemfile.lock
- persist_to_workspace:
root: .
paths:
- ./vendor/bundle
jobs:
checkout_code:
docker:
- image: circleci/ruby:2.6
steps:
- checkout
- persist_to_workspace:
root: .
paths:
- .
linting:
docker:
- image: circleci/ruby:2.6
steps:
- attach_workspace:
at: .
- run: mkdir -p ~/test-results/linting
- run:
name: RuboCop
command: |
gem install rubocop rubocop-junit_formatter rubocop-performance --no-document
rubocop --require rubocop/formatter/junit_formatter \
--require rubocop-performance \
--format progress \
--format RuboCop::Formatter::JUnitFormatter \
--out ~/test-results/linting/rubocop.xml
when: always
- run:
name: Yard-Junk
command: |
gem install yard-junk --no-document
yard-junk --path lib
when: always
- store_test_results:
path: ~/test-results/linting
- store_artifacts:
path: ~/test-results/linting
ruby26:
docker:
- image: circleci/ruby:2.6
<<: *shared_ruby_steps
ruby25:
docker:
- image: circleci/ruby:2.5
<<: *shared_ruby_steps
ruby24:
docker:
- image: circleci/ruby:2.4
<<: *shared_ruby_steps
ruby23:
docker:
- image: circleci/ruby:2.3
<<: *shared_ruby_steps
# Currently not in use
jruby92:
docker:
- image: circleci/jruby:9.2
environment:
JRUBY_OPTS: "--debug"
<<: *shared_ruby_steps
deploy:
docker:
- image: circleci/ruby:2.6
steps:
- checkout
- run:
name: Setup Rubygems
command: bash .circleci/setup-rubygems.sh
- run:
name: Publish to Rubygems
command: |
gem build faraday.gemspec
gem push "faraday-$(git describe --tags).gem"
workflows:
version: 2
test:
jobs:
- checkout_code
- linting:
requires:
- checkout_code
- ruby26:
requires:
- linting
run-cc-reporter: true
- ruby25:
requires:
- linting
- ruby24:
requires:
- linting
- ruby23:
requires:
- linting
- deploy:
requires:
- ruby23
- ruby24
- ruby25
- ruby26
filters:
tags:
only: /.*/
branches:
ignore: /.*/