sleet 0.3.10 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +7 -17
- data/.gitignore +2 -0
- data/.rubocop.yml +3 -27
- data/.rubocop_todo.yml +5 -1
- data/CHANGELOG.md +108 -10
- data/README.md +1 -0
- data/docs/CNAME +1 -0
- data/docs/README.md +160 -0
- data/docs/_config.yml +1 -0
- data/lib/sleet.rb +1 -0
- data/lib/sleet/artifact_downloader.rb +4 -3
- data/lib/sleet/branch.rb +8 -6
- data/lib/sleet/build.rb +4 -3
- data/lib/sleet/build_selector.rb +2 -2
- data/lib/sleet/circle_ci.rb +1 -15
- data/lib/sleet/cli.rb +17 -1
- data/lib/sleet/config.rb +30 -3
- data/lib/sleet/fetch_command.rb +2 -4
- data/lib/sleet/job_fetcher.rb +7 -9
- data/lib/sleet/local_repo.rb +75 -0
- data/lib/sleet/repo.rb +23 -60
- data/lib/sleet/version.rb +1 -1
- data/sleet.gemspec +9 -12
- metadata +40 -53
- data/README.md +0 -135
data/lib/sleet/version.rb
CHANGED
data/sleet.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
lib = File.expand_path('lib', __dir__)
|
@@ -14,8 +13,8 @@ Gem::Specification.new do |spec|
|
|
14
13
|
spec.summary = 'CircleCI RSpec Status Persistance File Aggregator'
|
15
14
|
spec.description = <<~DOC
|
16
15
|
Sleet provides an easy way to grab the most recent Rspec persistance files from CircleCI.
|
17
|
-
It also aggregates the
|
18
|
-
|
16
|
+
It also aggregates the artifacts from CircleCI, since you will have 1 per build container.
|
17
|
+
DOC
|
19
18
|
spec.homepage = 'https://github.com/coreyja/sleet'
|
20
19
|
spec.license = 'MIT'
|
21
20
|
|
@@ -27,18 +26,16 @@ Gem::Specification.new do |spec|
|
|
27
26
|
spec.require_paths = ['lib']
|
28
27
|
|
29
28
|
spec.add_dependency 'colorize', '~> 0.8.1'
|
30
|
-
spec.add_dependency 'faraday', '>= 0.13.1', '<
|
29
|
+
spec.add_dependency 'faraday', '>= 0.13.1', '< 1.1.0'
|
31
30
|
spec.add_dependency 'rspec', '~> 3.0'
|
32
|
-
spec.add_dependency 'rugged', '
|
31
|
+
spec.add_dependency 'rugged', '>= 0.26', '< 1.1'
|
33
32
|
spec.add_dependency 'terminal-table', '~> 1.8'
|
34
|
-
spec.add_dependency 'thor', '
|
33
|
+
spec.add_dependency 'thor', '>= 0.20', '< 1.1'
|
35
34
|
|
36
|
-
spec.add_development_dependency '
|
37
|
-
spec.add_development_dependency 'gem-release', '2.0.0.dev.5'
|
35
|
+
spec.add_development_dependency 'gem-release', '= 2.1.1'
|
38
36
|
spec.add_development_dependency 'github_changelog_generator', '~> 1.14'
|
39
37
|
spec.add_development_dependency 'pry', '~> 0.10'
|
40
|
-
spec.add_development_dependency 'rake', '~>
|
41
|
-
spec.add_development_dependency 'rubocop', '
|
42
|
-
spec.add_development_dependency '
|
43
|
-
spec.add_development_dependency 'webmock', '~> 3.3.0'
|
38
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
39
|
+
spec.add_development_dependency 'rubocop-coreyja', '0.4.0'
|
40
|
+
spec.add_development_dependency 'webmock', '~> 3.8.0'
|
44
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sleet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Alexander
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: 0.13.1
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
36
|
+
version: 1.1.0
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 0.13.1
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 1.1.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,16 +62,22 @@ dependencies:
|
|
62
62
|
name: rugged
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.26
|
67
|
+
version: '0.26'
|
68
|
+
- - "<"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '1.1'
|
68
71
|
type: :runtime
|
69
72
|
prerelease: false
|
70
73
|
version_requirements: !ruby/object:Gem::Requirement
|
71
74
|
requirements:
|
72
|
-
- - "
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0.26'
|
78
|
+
- - "<"
|
73
79
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
80
|
+
version: '1.1'
|
75
81
|
- !ruby/object:Gem::Dependency
|
76
82
|
name: terminal-table
|
77
83
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,44 +96,36 @@ dependencies:
|
|
90
96
|
name: thor
|
91
97
|
requirement: !ruby/object:Gem::Requirement
|
92
98
|
requirements:
|
93
|
-
- - "
|
99
|
+
- - ">="
|
94
100
|
- !ruby/object:Gem::Version
|
95
|
-
version: 0.20
|
101
|
+
version: '0.20'
|
102
|
+
- - "<"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '1.1'
|
96
105
|
type: :runtime
|
97
106
|
prerelease: false
|
98
107
|
version_requirements: !ruby/object:Gem::Requirement
|
99
108
|
requirements:
|
100
|
-
- - "
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: 0.20.0
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: bundler
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - "~>"
|
109
|
+
- - ">="
|
108
110
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
110
|
-
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - "~>"
|
111
|
+
version: '0.20'
|
112
|
+
- - "<"
|
115
113
|
- !ruby/object:Gem::Version
|
116
|
-
version: '1.
|
114
|
+
version: '1.1'
|
117
115
|
- !ruby/object:Gem::Dependency
|
118
116
|
name: gem-release
|
119
117
|
requirement: !ruby/object:Gem::Requirement
|
120
118
|
requirements:
|
121
119
|
- - '='
|
122
120
|
- !ruby/object:Gem::Version
|
123
|
-
version: 2.
|
121
|
+
version: 2.1.1
|
124
122
|
type: :development
|
125
123
|
prerelease: false
|
126
124
|
version_requirements: !ruby/object:Gem::Requirement
|
127
125
|
requirements:
|
128
126
|
- - '='
|
129
127
|
- !ruby/object:Gem::Version
|
130
|
-
version: 2.
|
128
|
+
version: 2.1.1
|
131
129
|
- !ruby/object:Gem::Dependency
|
132
130
|
name: github_changelog_generator
|
133
131
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,59 +160,45 @@ dependencies:
|
|
162
160
|
requirements:
|
163
161
|
- - "~>"
|
164
162
|
- !ruby/object:Gem::Version
|
165
|
-
version: '
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
requirements:
|
170
|
-
- - "~>"
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: '12.3'
|
173
|
-
- !ruby/object:Gem::Dependency
|
174
|
-
name: rubocop
|
175
|
-
requirement: !ruby/object:Gem::Requirement
|
176
|
-
requirements:
|
177
|
-
- - "~>"
|
178
|
-
- !ruby/object:Gem::Version
|
179
|
-
version: 0.53.0
|
163
|
+
version: '13.0'
|
180
164
|
type: :development
|
181
165
|
prerelease: false
|
182
166
|
version_requirements: !ruby/object:Gem::Requirement
|
183
167
|
requirements:
|
184
168
|
- - "~>"
|
185
169
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
170
|
+
version: '13.0'
|
187
171
|
- !ruby/object:Gem::Dependency
|
188
|
-
name: rubocop-
|
172
|
+
name: rubocop-coreyja
|
189
173
|
requirement: !ruby/object:Gem::Requirement
|
190
174
|
requirements:
|
191
|
-
- -
|
175
|
+
- - '='
|
192
176
|
- !ruby/object:Gem::Version
|
193
|
-
version:
|
177
|
+
version: 0.4.0
|
194
178
|
type: :development
|
195
179
|
prerelease: false
|
196
180
|
version_requirements: !ruby/object:Gem::Requirement
|
197
181
|
requirements:
|
198
|
-
- -
|
182
|
+
- - '='
|
199
183
|
- !ruby/object:Gem::Version
|
200
|
-
version:
|
184
|
+
version: 0.4.0
|
201
185
|
- !ruby/object:Gem::Dependency
|
202
186
|
name: webmock
|
203
187
|
requirement: !ruby/object:Gem::Requirement
|
204
188
|
requirements:
|
205
189
|
- - "~>"
|
206
190
|
- !ruby/object:Gem::Version
|
207
|
-
version: 3.
|
191
|
+
version: 3.8.0
|
208
192
|
type: :development
|
209
193
|
prerelease: false
|
210
194
|
version_requirements: !ruby/object:Gem::Requirement
|
211
195
|
requirements:
|
212
196
|
- - "~>"
|
213
197
|
- !ruby/object:Gem::Version
|
214
|
-
version: 3.
|
198
|
+
version: 3.8.0
|
215
199
|
description: |
|
216
200
|
Sleet provides an easy way to grab the most recent Rspec persistance files from CircleCI.
|
217
|
-
It also aggregates the
|
201
|
+
It also aggregates the artifacts from CircleCI, since you will have 1 per build container.
|
218
202
|
email:
|
219
203
|
- coreyja@gmail.com
|
220
204
|
executables:
|
@@ -238,6 +222,9 @@ files:
|
|
238
222
|
- bin/console
|
239
223
|
- bin/release
|
240
224
|
- bin/setup
|
225
|
+
- docs/CNAME
|
226
|
+
- docs/README.md
|
227
|
+
- docs/_config.yml
|
241
228
|
- exe/sleet
|
242
229
|
- lib/sleet.rb
|
243
230
|
- lib/sleet/artifact_downloader.rb
|
@@ -250,6 +237,7 @@ files:
|
|
250
237
|
- lib/sleet/error.rb
|
251
238
|
- lib/sleet/fetch_command.rb
|
252
239
|
- lib/sleet/job_fetcher.rb
|
240
|
+
- lib/sleet/local_repo.rb
|
253
241
|
- lib/sleet/repo.rb
|
254
242
|
- lib/sleet/rspec_file_merger.rb
|
255
243
|
- lib/sleet/version.rb
|
@@ -273,8 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
273
261
|
- !ruby/object:Gem::Version
|
274
262
|
version: '0'
|
275
263
|
requirements: []
|
276
|
-
|
277
|
-
rubygems_version: 2.7.3
|
264
|
+
rubygems_version: 3.0.1
|
278
265
|
signing_key:
|
279
266
|
specification_version: 4
|
280
267
|
summary: CircleCI RSpec Status Persistance File Aggregator
|
data/README.md
DELETED
@@ -1,135 +0,0 @@
|
|
1
|
-
# Sleet ☁️ ❄️
|
2
|
-
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/sleet.svg)](https://badge.fury.io/rb/sleet)
|
4
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges/7f346b368d72b53ef630/maintainability)](https://codeclimate.com/github/coreyja/sleet/maintainability)
|
5
|
-
[![CircleCI](https://circleci.com/gh/coreyja/sleet.svg?style=svg)](https://circleci.com/gh/coreyja/sleet)
|
6
|
-
|
7
|
-
## Background and Problem
|
8
|
-
|
9
|
-
RSpec has a [feature](https://relishapp.com/rspec/rspec-core/v/3-7/docs/command-line/only-failures) that I find very useful which is the `--only-failures` option. This will re-run only that examples that failed the previous run.
|
10
|
-
|
11
|
-
CircleCI has support for [uploading artifcats](https://circleci.com/docs/2.0/artifacts/) with your builds, which allows us to store the persistance file that powers the RSpec only failures option.
|
12
|
-
However! CircleCI also supports and encourages parallelizing your build, which means even if you upload your rspec persistance file, you actually have a number of them each containing a subset of your test suite.
|
13
|
-
This is where `Sleet` comes in!
|
14
|
-
|
15
|
-
## Purpose
|
16
|
-
|
17
|
-
This tool does two things:
|
18
|
-
1. It downloads all of the `.rspec_failed_examples` files that were uploaded to CircleCI for the most recent build of the current branch
|
19
|
-
2. It combines the multiple files into a single sorted `.rspec_failed_examples` file, and moves it to the [current directory](https://github.com/coreyja/CRSPFA/issues/1)
|
20
|
-
|
21
|
-
## Getting Started
|
22
|
-
|
23
|
-
### 1. Configure RSpec to Create and Use an example persistance file
|
24
|
-
|
25
|
-
We need to set the `example_status_persistence_file_path` config in RSpec. Here are the relevant [RSpec docs](https://relishapp.com/rspec/rspec-core/v/3-7/docs/command-line/only-failures#background).
|
26
|
-
|
27
|
-
The first step is to create(/or add to) your `spec/spec_helper.rb` file. We want to include the following configuration, which tells RSpec where to store the status persistance file. The actual location and file name are up to you, this is just an example. (Though using this name will require less configuration later.)
|
28
|
-
|
29
|
-
```
|
30
|
-
RSpec.configure do |c|
|
31
|
-
c.example_status_persistence_file_path = ".rspec_example_statuses"
|
32
|
-
end
|
33
|
-
```
|
34
|
-
|
35
|
-
if you just created the `spec_helper.rb` file then you will need to create a `.rspec` file containing the following to load your new helper file.
|
36
|
-
|
37
|
-
```
|
38
|
-
--require spec_helper
|
39
|
-
```
|
40
|
-
|
41
|
-
Again there are other ways to load your `spec_helper.rb` file, including requiring it from each spec. Pick one that works for you.
|
42
|
-
|
43
|
-
### 2. Collect the example persistance files in CircleCI
|
44
|
-
|
45
|
-
To do this we need to create a step which [saves](https://circleci.com/docs/2.0/artifacts/) the `.rspec_example_statuses` as artifacts of the build. The following is an example of such a step in CircleCI. This must happen after rspec has run or else the persistance file will not exist.
|
46
|
-
|
47
|
-
```
|
48
|
-
- store_artifacts:
|
49
|
-
path: .rspec_example_statuses
|
50
|
-
|
51
|
-
```
|
52
|
-
|
53
|
-
### 3. Save a CircleCI Token locally (to access private builds)
|
54
|
-
|
55
|
-
In order to see private builds/repos in CircleCI you will need to get a CircleCI token and save it to the `~/.circleci.token` file.
|
56
|
-
|
57
|
-
An API token can be generated here: [https://circleci.com/account/api](https://circleci.com/account/api)
|
58
|
-
|
59
|
-
### 4. Run this tool in the root of your project
|
60
|
-
|
61
|
-
```
|
62
|
-
sleet
|
63
|
-
```
|
64
|
-
|
65
|
-
This will look up the latest completed build in CircleCI for this branch, and download all the relevant `.rspec_example_statuses` files. It then combines and sorts them and saves the result to the `.rspec_example_statuses` file locally.
|
66
|
-
|
67
|
-
### 5. Run RSpec with `--only-failures`
|
68
|
-
|
69
|
-
```
|
70
|
-
bundle exec rspec --only-failures
|
71
|
-
```
|
72
|
-
|
73
|
-
This will run only the examples that failed in CircleCI!
|
74
|
-
|
75
|
-
## Configuration
|
76
|
-
|
77
|
-
If you are using Worklfows in your CircleCI builds, or you are working with a different persistance file name, you may need to configure Sleet beyond the defaults.
|
78
|
-
|
79
|
-
Sleet currently supports two ways to input configurations:
|
80
|
-
|
81
|
-
1. Through YML files
|
82
|
-
- `Sleet` will search 'up' from where the command was run and look for `.sleet.yml` files. It will combine all the files it finds, such that 'deeper' files take presedence. This allows you to have a user-level config at `~/.sleet.yml` and have project specific files which take presendence over the user level config (ex: `~/Projects/foo/.sleet.yml`)
|
83
|
-
2. Through the CLI
|
84
|
-
- These always take presendece the options provided in the YML files
|
85
|
-
|
86
|
-
### Options
|
87
|
-
|
88
|
-
These are the options that are currently supported
|
89
|
-
|
90
|
-
#### `source_dir`
|
91
|
-
|
92
|
-
Alias: s
|
93
|
-
|
94
|
-
This is the directory of the source git repo. If a `source_dir` is NOT given we look up from the current directory for the nearest git repo.
|
95
|
-
|
96
|
-
#### `input_file`
|
97
|
-
|
98
|
-
Alias: i
|
99
|
-
|
100
|
-
This is the name of the Rspec Circle Persistance File in CircleCI. The default is `.rspec_example_statuses`
|
101
|
-
|
102
|
-
This will match if the full path on CircleCI ends in the given name.
|
103
|
-
|
104
|
-
#### `output_file`
|
105
|
-
|
106
|
-
Alias: o
|
107
|
-
|
108
|
-
This is the name for the output file, on your local system. It is relative to the `source_dir`.
|
109
|
-
|
110
|
-
Will be IGNORED if `workflows` is provided.
|
111
|
-
|
112
|
-
#### `workflows`
|
113
|
-
|
114
|
-
Alias: w
|
115
|
-
|
116
|
-
If you are using workflows in CircleCI, then this is for you! You need to tell `Sleet` which build(s) to look in, and where each output should be saved.
|
117
|
-
The input is a hash, where the key is the build name and the value is the `output_file` for that build. Sleet supports saving the artifacts to multiple builds, meaning it can support a mono-repo setup.
|
118
|
-
|
119
|
-
Build-Test-Deploy Demo:
|
120
|
-
|
121
|
-
For this example you have three jobs in your CircleCI Workflow, `build`, `test` and `deploy`, but only 1 (the `test` build) generate an Rspec persistance file
|
122
|
-
|
123
|
-
This command will pick the `test` build and saw it's artificats to the `.rspec_example_statuses` file
|
124
|
-
|
125
|
-
```
|
126
|
-
sleet fetch --workflows test:.rspec_example_statuses
|
127
|
-
```
|
128
|
-
|
129
|
-
MonoRepo Demo:
|
130
|
-
|
131
|
-
If you have a mono-repo that contains 3 sub-dirs. `foo`, `bar` and `baz`. And each one has an accompanying build. We can process all these sub-dirs at once with the following workflow command.
|
132
|
-
|
133
|
-
```
|
134
|
-
sleet fetch --workflows foo-test:foo/.rpsec_example_statuses bar-test:bar/.rspec_example_statuses baz-specs:baz/spec/examples.txt
|
135
|
-
```
|