sleet 0.4.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.sleet.yml +3 -0
- data/CHANGELOG.md +81 -7
- data/docs/README.md +28 -11
- data/lib/sleet.rb +2 -0
- data/lib/sleet/branch.rb +4 -3
- data/lib/sleet/build_selector.rb +2 -2
- data/lib/sleet/circle_ci.rb +8 -1
- data/lib/sleet/cli.rb +13 -0
- data/lib/sleet/config.rb +13 -1
- data/lib/sleet/fetch_command.rb +0 -1
- data/lib/sleet/job_fetcher.rb +0 -4
- data/lib/sleet/local_repo.rb +75 -0
- data/lib/sleet/repo.rb +17 -60
- data/lib/sleet/version.rb +1 -1
- data/sleet.gemspec +8 -7
- metadata +38 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fac7493ce36c1bd93ce7b8adb7026bb7717472df669a91cc86b2c38aedd16aa
|
4
|
+
data.tar.gz: '0180aa81852054f6ae694198bf668dec598df6d5304f526977158ecafc50ddc7'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96219d22089a50d8a9899291c86f3e756611f1981f37837d751ffee58f395efdd50694104a6465db64637110e5de326069fc6cc6270457d8db820f609f14c81f
|
7
|
+
data.tar.gz: 022bdbfbe371c6768109ca30132806adaef7519d6d87577a7ff7b5111d5c74b23f432cd93aea66317eaacfe37a940e282eb8174a61be8e8ade33cd9a46763a7e
|
data/.sleet.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,67 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [v0.5.3](https://github.com/coreyja/sleet/tree/v0.5.3) (2020-08-09)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.5.2...v0.5.3)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- bug: Add support for redirects. [\#80](https://github.com/coreyja/sleet/pull/80) ([temochka](https://github.com/temochka))
|
10
|
+
|
11
|
+
## [v0.5.2](https://github.com/coreyja/sleet/tree/v0.5.2) (2020-06-14)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.5.1...v0.5.2)
|
14
|
+
|
15
|
+
**Merged pull requests:**
|
16
|
+
|
17
|
+
- bug: Fix bug in error message when no upstream exists [\#79](https://github.com/coreyja/sleet/pull/79) ([coreyja](https://github.com/coreyja))
|
18
|
+
|
19
|
+
## [v0.5.1](https://github.com/coreyja/sleet/tree/v0.5.1) (2020-06-14)
|
20
|
+
|
21
|
+
- This was an accidental release that contains no changes from `0.5.0`
|
22
|
+
|
23
|
+
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.5.0...v0.5.1)
|
24
|
+
|
25
|
+
## [v0.5.0](https://github.com/coreyja/sleet/tree/v0.5.0) (2020-06-14)
|
26
|
+
|
27
|
+
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.4.3...v0.5.0)
|
28
|
+
|
29
|
+
**Closed issues:**
|
30
|
+
|
31
|
+
- Add Support for Forked Repos in Github [\#41](https://github.com/coreyja/sleet/issues/41)
|
32
|
+
|
33
|
+
**Merged pull requests:**
|
34
|
+
|
35
|
+
- Support PR builds from forked repos!!! ✨ [\#77](https://github.com/coreyja/sleet/pull/77) ([smudge](https://github.com/smudge))
|
36
|
+
- Update rugged requirement from \>= 0.26, \< 0.100 to \>= 0.26, \< 1.1 [\#76](https://github.com/coreyja/sleet/pull/76) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
37
|
+
- Update rugged requirement from \>= 0.26, \< 0.29 to \>= 0.26, \< 0.100 [\#75](https://github.com/coreyja/sleet/pull/75) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
38
|
+
- Update thor requirement from ~\> 0.20.0 to \>= 0.20, \< 1.1 [\#70](https://github.com/coreyja/sleet/pull/70) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
39
|
+
|
40
|
+
## [v0.4.3](https://github.com/coreyja/sleet/tree/v0.4.3) (2020-03-07)
|
41
|
+
|
42
|
+
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.4.2...v0.4.3)
|
43
|
+
|
44
|
+
**Closed issues:**
|
45
|
+
|
46
|
+
- s/Artifcats/Artifacts/ [\#44](https://github.com/coreyja/sleet/issues/44)
|
47
|
+
|
48
|
+
**Merged pull requests:**
|
49
|
+
|
50
|
+
- fix: Replace "artifi🐱s" with "artifacts". [\#74](https://github.com/coreyja/sleet/pull/74) ([temochka](https://github.com/temochka))
|
51
|
+
- feat: Look at 100 recent builds instead of just 30. [\#73](https://github.com/coreyja/sleet/pull/73) ([temochka](https://github.com/temochka))
|
52
|
+
- Update webmock requirement from ~\> 3.7.0 to ~\> 3.8.0 [\#72](https://github.com/coreyja/sleet/pull/72) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
53
|
+
- Update faraday requirement from \>= 0.13.1, \< 0.16.0 to \>= 0.13.1, \< 1.1.0 [\#71](https://github.com/coreyja/sleet/pull/71) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
54
|
+
- Update gem-release requirement from = 2.1.0 to = 2.1.1 [\#69](https://github.com/coreyja/sleet/pull/69) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
55
|
+
- Update gem-release requirement from = 2.0.4 to = 2.1.0 [\#68](https://github.com/coreyja/sleet/pull/68) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
56
|
+
- Update gem-release requirement from = 2.0.3 to = 2.0.4 [\#67](https://github.com/coreyja/sleet/pull/67) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
57
|
+
- Update rake requirement from ~\> 12.3 to ~\> 13.0 [\#64](https://github.com/coreyja/sleet/pull/64) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
58
|
+
- Update webmock requirement from ~\> 3.6.0 to ~\> 3.7.0 [\#63](https://github.com/coreyja/sleet/pull/63) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
59
|
+
- Update gem-release requirement from = 2.0.2 to = 2.0.3 [\#62](https://github.com/coreyja/sleet/pull/62) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
60
|
+
- Update gem-release requirement from = 2.0.1 to = 2.0.2 [\#61](https://github.com/coreyja/sleet/pull/61) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
61
|
+
- Update webmock requirement from ~\> 3.5.1 to ~\> 3.6.0 [\#60](https://github.com/coreyja/sleet/pull/60) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
62
|
+
|
63
|
+
## [v0.4.2](https://github.com/coreyja/sleet/tree/v0.4.2) (2019-05-27)
|
2
64
|
|
3
|
-
## [v0.4.2](https://github.com/coreyja/sleet/tree/v0.4.2) (2019-05-26)
|
4
65
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.4.1...v0.4.2)
|
5
66
|
|
6
67
|
**Closed issues:**
|
@@ -22,6 +83,7 @@
|
|
22
83
|
- Update webmock requirement from ~\> 3.4.0 to ~\> 3.5.1 [\#47](https://github.com/coreyja/sleet/pull/47) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
23
84
|
|
24
85
|
## [v0.4.1](https://github.com/coreyja/sleet/tree/v0.4.1) (2018-11-24)
|
86
|
+
|
25
87
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.4.0...v0.4.1)
|
26
88
|
|
27
89
|
**Merged pull requests:**
|
@@ -36,6 +98,7 @@
|
|
36
98
|
- Update rugged requirement to \>= 0.26, \< 0.28 [\#24](https://github.com/coreyja/sleet/pull/24) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
37
99
|
|
38
100
|
## [v0.4.0](https://github.com/coreyja/sleet/tree/v0.4.0) (2018-03-08)
|
101
|
+
|
39
102
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.10...v0.4.0)
|
40
103
|
|
41
104
|
**Closed issues:**
|
@@ -47,6 +110,7 @@
|
|
47
110
|
- Get Token From Config File [\#21](https://github.com/coreyja/sleet/pull/21) ([coreyja](https://github.com/coreyja))
|
48
111
|
|
49
112
|
## [v0.3.10](https://github.com/coreyja/sleet/tree/v0.3.10) (2018-03-08)
|
113
|
+
|
50
114
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.9...v0.3.10)
|
51
115
|
|
52
116
|
**Merged pull requests:**
|
@@ -55,6 +119,7 @@
|
|
55
119
|
- Update rubocop requirement to ~\> 0.53.0 [\#19](https://github.com/coreyja/sleet/pull/19) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
56
120
|
|
57
121
|
## [v0.3.9](https://github.com/coreyja/sleet/tree/v0.3.9) (2018-03-04)
|
122
|
+
|
58
123
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.8...v0.3.9)
|
59
124
|
|
60
125
|
**Closed issues:**
|
@@ -66,15 +131,14 @@
|
|
66
131
|
- Refactor [\#18](https://github.com/coreyja/sleet/pull/18) ([coreyja](https://github.com/coreyja))
|
67
132
|
- Update rake requirement to ~\> 12.3 [\#17](https://github.com/coreyja/sleet/pull/17) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
68
133
|
- Update faraday requirement to \>= 0.13.1, \< 0.15.0 [\#16](https://github.com/coreyja/sleet/pull/16) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
134
|
+
- More Specs [\#15](https://github.com/coreyja/sleet/pull/15) ([coreyja](https://github.com/coreyja))
|
69
135
|
|
70
136
|
## [v0.3.8](https://github.com/coreyja/sleet/tree/v0.3.8) (2018-02-25)
|
71
|
-
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.7...v0.3.8)
|
72
|
-
|
73
|
-
**Merged pull requests:**
|
74
137
|
|
75
|
-
|
138
|
+
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.7...v0.3.8)
|
76
139
|
|
77
140
|
## [v0.3.7](https://github.com/coreyja/sleet/tree/v0.3.7) (2018-01-19)
|
141
|
+
|
78
142
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.6...v0.3.7)
|
79
143
|
|
80
144
|
**Merged pull requests:**
|
@@ -82,6 +146,7 @@
|
|
82
146
|
- Fix token auth and finally add a spec for it so I don't break it again [\#14](https://github.com/coreyja/sleet/pull/14) ([coreyja](https://github.com/coreyja))
|
83
147
|
|
84
148
|
## [v0.3.6](https://github.com/coreyja/sleet/tree/v0.3.6) (2018-01-18)
|
149
|
+
|
85
150
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.5...v0.3.6)
|
86
151
|
|
87
152
|
**Merged pull requests:**
|
@@ -89,9 +154,11 @@
|
|
89
154
|
- Fix Auth By Going Back to Query Params [\#13](https://github.com/coreyja/sleet/pull/13) ([coreyja](https://github.com/coreyja))
|
90
155
|
|
91
156
|
## [v0.3.5](https://github.com/coreyja/sleet/tree/v0.3.5) (2018-01-17)
|
157
|
+
|
92
158
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.4...v0.3.5)
|
93
159
|
|
94
160
|
## [v0.3.4](https://github.com/coreyja/sleet/tree/v0.3.4) (2018-01-17)
|
161
|
+
|
95
162
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.3...v0.3.4)
|
96
163
|
|
97
164
|
**Merged pull requests:**
|
@@ -100,6 +167,7 @@
|
|
100
167
|
- Fix Auth [\#11](https://github.com/coreyja/sleet/pull/11) ([coreyja](https://github.com/coreyja))
|
101
168
|
|
102
169
|
## [v0.3.3](https://github.com/coreyja/sleet/tree/v0.3.3) (2018-01-16)
|
170
|
+
|
103
171
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.2...v0.3.3)
|
104
172
|
|
105
173
|
**Merged pull requests:**
|
@@ -107,6 +175,7 @@
|
|
107
175
|
- Add `version` cmd [\#10](https://github.com/coreyja/sleet/pull/10) ([coreyja](https://github.com/coreyja))
|
108
176
|
|
109
177
|
## [v0.3.2](https://github.com/coreyja/sleet/tree/v0.3.2) (2018-01-16)
|
178
|
+
|
110
179
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.1...v0.3.2)
|
111
180
|
|
112
181
|
**Merged pull requests:**
|
@@ -114,6 +183,7 @@
|
|
114
183
|
- Update Readme and Add Descriptions to Help Menus [\#8](https://github.com/coreyja/sleet/pull/8) ([coreyja](https://github.com/coreyja))
|
115
184
|
|
116
185
|
## [v0.3.1](https://github.com/coreyja/sleet/tree/v0.3.1) (2018-01-15)
|
186
|
+
|
117
187
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.0...v0.3.1)
|
118
188
|
|
119
189
|
**Merged pull requests:**
|
@@ -121,6 +191,7 @@
|
|
121
191
|
- Add Dependency Versions [\#5](https://github.com/coreyja/sleet/pull/5) ([coreyja](https://github.com/coreyja))
|
122
192
|
|
123
193
|
## [v0.3.0](https://github.com/coreyja/sleet/tree/v0.3.0) (2018-01-15)
|
194
|
+
|
124
195
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.2.0...v0.3.0)
|
125
196
|
|
126
197
|
**Closed issues:**
|
@@ -133,10 +204,13 @@
|
|
133
204
|
- Error Messages [\#3](https://github.com/coreyja/sleet/pull/3) ([coreyja](https://github.com/coreyja))
|
134
205
|
|
135
206
|
## [v0.2.0](https://github.com/coreyja/sleet/tree/v0.2.0) (2018-01-14)
|
207
|
+
|
208
|
+
[Full Changelog](https://github.com/coreyja/sleet/compare/aa005fdae00ae843909f3a2d1753db3727a27c2c...v0.2.0)
|
209
|
+
|
136
210
|
**Merged pull requests:**
|
137
211
|
|
138
212
|
- Gemify [\#2](https://github.com/coreyja/sleet/pull/2) ([coreyja](https://github.com/coreyja))
|
139
213
|
|
140
214
|
|
141
215
|
|
142
|
-
\* *This
|
216
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/docs/README.md
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
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.
|
11
11
|
|
12
|
-
CircleCI has support for [uploading
|
12
|
+
CircleCI has support for [uploading artifacts](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.
|
13
13
|
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.
|
14
14
|
This is where `Sleet` comes in!
|
15
15
|
|
@@ -95,31 +95,31 @@ To view your current configuration use the `sleet config` command which will giv
|
|
95
95
|
|
96
96
|
These are the options that are currently supported
|
97
97
|
|
98
|
-
####
|
98
|
+
#### `--source_dir`
|
99
99
|
|
100
|
-
Alias: s
|
100
|
+
Alias: `s`
|
101
101
|
|
102
102
|
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.
|
103
103
|
|
104
|
-
####
|
104
|
+
#### `--input_file`
|
105
105
|
|
106
|
-
Alias: i
|
106
|
+
Alias: `i`
|
107
107
|
|
108
108
|
This is the name of the Rspec Circle Persistance File in CircleCI. The default is `.rspec_example_statuses`
|
109
109
|
|
110
110
|
This will match if the full path on CircleCI ends in the given name.
|
111
111
|
|
112
|
-
####
|
112
|
+
#### `--output_file`
|
113
113
|
|
114
|
-
Alias: o
|
114
|
+
Alias: `o`
|
115
115
|
|
116
116
|
This is the name for the output file, on your local system. It is relative to the `source_dir`.
|
117
117
|
|
118
118
|
Will be IGNORED if `workflows` is provided.
|
119
119
|
|
120
|
-
####
|
120
|
+
#### `--workflows`
|
121
121
|
|
122
|
-
Alias: w
|
122
|
+
Alias: `w`
|
123
123
|
|
124
124
|
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.
|
125
125
|
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.
|
@@ -128,12 +128,11 @@ Build-Test-Deploy Demo:
|
|
128
128
|
|
129
129
|
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
|
130
130
|
|
131
|
-
This command will pick the `test` build and save
|
131
|
+
This command will pick the `test` build and save its artifacts to the `.rspec_example_statuses` file
|
132
132
|
|
133
133
|
```
|
134
134
|
sleet fetch --workflows test:.rspec_example_statuses
|
135
135
|
```
|
136
|
-
|
137
136
|
MonoRepo Demo:
|
138
137
|
|
139
138
|
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.
|
@@ -141,3 +140,21 @@ If you have a mono-repo that contains 3 sub-dirs. `foo`, `bar` and `baz`. And ea
|
|
141
140
|
```
|
142
141
|
sleet fetch --workflows foo-test:foo/.rpsec_example_statuses bar-test:bar/.rspec_example_statuses baz-specs:baz/spec/examples.txt
|
143
142
|
```
|
143
|
+
|
144
|
+
#### `--username`
|
145
|
+
|
146
|
+
Alias: `u`
|
147
|
+
|
148
|
+
This is the GitHub username that is referenced by the CircleCI build. By default, Sleet will base this on your upstream git remote.
|
149
|
+
|
150
|
+
#### `--project`
|
151
|
+
|
152
|
+
Alias: `p`
|
153
|
+
|
154
|
+
This is the GitHub project that is referenced by the CircleCI build. By default, Sleet will base this on your upstream git remote.
|
155
|
+
|
156
|
+
#### `--branch`
|
157
|
+
|
158
|
+
Alias: `b`
|
159
|
+
|
160
|
+
This is the remote branch that is referenced by the CircleCI build. Sleet will attempt to guess this by default, but if you are pushing to a forked repo, you may need to specify a different branch name (e.g. "pull/1234").
|
data/lib/sleet.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'colorize'
|
4
4
|
require 'faraday'
|
5
|
+
require 'faraday_middleware'
|
5
6
|
require 'forwardable'
|
6
7
|
require 'json'
|
7
8
|
require 'rspec'
|
@@ -25,6 +26,7 @@ require 'sleet/config'
|
|
25
26
|
require 'sleet/error'
|
26
27
|
require 'sleet/fetch_command'
|
27
28
|
require 'sleet/job_fetcher'
|
29
|
+
require 'sleet/local_repo'
|
28
30
|
require 'sleet/repo'
|
29
31
|
require 'sleet/rspec_file_merger'
|
30
32
|
require 'sleet/version'
|
data/lib/sleet/branch.rb
CHANGED
@@ -6,14 +6,14 @@ module Sleet
|
|
6
6
|
@circle_ci_token = circle_ci_token
|
7
7
|
@github_user = github_user
|
8
8
|
@github_repo = github_repo
|
9
|
-
@branch = branch
|
9
|
+
@branch = CGI.escape(branch)
|
10
10
|
end
|
11
11
|
|
12
12
|
def builds
|
13
13
|
@builds ||= JSON.parse(Sleet::CircleCi.get(url, circle_ci_token).body)
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def builds_with_artifacts
|
17
17
|
builds.select { |b| b['has_artifacts'] }
|
18
18
|
end
|
19
19
|
|
@@ -22,7 +22,8 @@ module Sleet
|
|
22
22
|
attr_reader :github_user, :github_repo, :branch, :circle_ci_token
|
23
23
|
|
24
24
|
def url
|
25
|
-
"https://circleci.com/api/v1.1/project/github/#{github_user}/#{github_repo}/tree/#{branch}
|
25
|
+
"https://circleci.com/api/v1.1/project/github/#{github_user}/#{github_repo}/tree/#{branch}" \
|
26
|
+
'?filter=completed&limit=100'
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
data/lib/sleet/build_selector.rb
CHANGED
@@ -29,14 +29,14 @@ module Sleet
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def chosen_build_json
|
32
|
-
branch.
|
32
|
+
branch.builds_with_artifacts.find do |b|
|
33
33
|
b.fetch('workflows', nil)&.fetch('job_name', nil) == job_name
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
def must_find_a_build_with_artifacts!
|
38
38
|
!chosen_build_json.nil? ||
|
39
|
-
raise(Error, "No builds with
|
39
|
+
raise(Error, "No builds with artifacts found#{" for job name [#{job_name}]" if job_name}")
|
40
40
|
end
|
41
41
|
|
42
42
|
def chosen_build_must_have_input_file!
|
data/lib/sleet/circle_ci.rb
CHANGED
@@ -5,7 +5,14 @@ require 'singleton'
|
|
5
5
|
module Sleet
|
6
6
|
class CircleCi
|
7
7
|
def self.get(url, token)
|
8
|
-
|
8
|
+
connection.get(url, 'circle-token' => token)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.connection
|
12
|
+
Faraday.new do |b|
|
13
|
+
b.use FaradayMiddleware::FollowRedirects
|
14
|
+
b.adapter :net_http
|
15
|
+
end
|
9
16
|
end
|
10
17
|
end
|
11
18
|
end
|
data/lib/sleet/cli.rb
CHANGED
@@ -4,6 +4,10 @@ module Sleet
|
|
4
4
|
class Cli < Thor
|
5
5
|
default_task :fetch
|
6
6
|
|
7
|
+
def self.exit_on_failure?
|
8
|
+
true
|
9
|
+
end
|
10
|
+
|
7
11
|
desc 'fetch', 'Fetch and Aggregate RSpec Persistance Files from CircleCI'
|
8
12
|
long_desc <<~LONGDESC
|
9
13
|
`sleet fetch` will find build(s) in CircleCI for the current branch, and
|
@@ -20,6 +24,15 @@ module Sleet
|
|
20
24
|
option :output_file, type: :string, aliases: [:o], desc: <<~DESC
|
21
25
|
This is the name for the output file, on your local system. It is relative to the source_dir. Will be IGNORED if workflows is provided.
|
22
26
|
DESC
|
27
|
+
option :username, type: :string, aliases: [:u], desc: <<~DESC
|
28
|
+
This is the GitHub username that is referenced by the CircleCI build. By default, Sleet will base this on your upstream git remote.
|
29
|
+
DESC
|
30
|
+
option :project, type: :string, aliases: [:p], desc: <<~DESC
|
31
|
+
This is the GitHub project that is referenced by the CircleCI build. By default, Sleet will base this on your upstream git remote.
|
32
|
+
DESC
|
33
|
+
option :branch, type: :string, aliases: [:b], desc: <<~DESC
|
34
|
+
This is the remote branch that is referenced by the CircleCI build. Sleet will attempt to guess this by default, but if you are pushing to a forked repo, you may need to specify a different branch name (e.g. "pull/1234").
|
35
|
+
DESC
|
23
36
|
option :workflows, type: :hash, aliases: [:w], desc: <<~DESC
|
24
37
|
To use Sleet with CircleCI Workflows you need to tell Sleet which build(s) to look in, and where each output should be saved. 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.
|
25
38
|
DESC
|
data/lib/sleet/config.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Sleet
|
4
|
-
class Config
|
4
|
+
class Config # rubocop:disable Metrics/ClassLength
|
5
5
|
OPTION_FILENAME = '.sleet.yml'
|
6
6
|
HIDDEN_UNLESS_IN_CLI_OPTIONS = %w[show_sensitive print_config].freeze
|
7
7
|
ConfigOption = Struct.new(:value, :source)
|
@@ -23,6 +23,18 @@ module Sleet
|
|
23
23
|
options_hash[:output_file]
|
24
24
|
end
|
25
25
|
|
26
|
+
def username
|
27
|
+
options_hash[:username]
|
28
|
+
end
|
29
|
+
|
30
|
+
def project
|
31
|
+
options_hash[:project]
|
32
|
+
end
|
33
|
+
|
34
|
+
def branch
|
35
|
+
options_hash[:branch]
|
36
|
+
end
|
37
|
+
|
26
38
|
def workflows
|
27
39
|
options_hash[:workflows]
|
28
40
|
end
|
data/lib/sleet/fetch_command.rb
CHANGED
data/lib/sleet/job_fetcher.rb
CHANGED
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sleet
|
4
|
+
class LocalRepo
|
5
|
+
REMOTE_BRANCH_REGEX = %r{^([^\/.]+)\/(.+)}.freeze
|
6
|
+
CURRENT_BRANCH_REGEX = %r{^refs\/heads\/}.freeze
|
7
|
+
GITHUB_MATCH_REGEX = %r{github.com[:\/](.+)\/(.+)\.git}.freeze
|
8
|
+
|
9
|
+
def initialize(source_dir:)
|
10
|
+
@source_dir = source_dir
|
11
|
+
end
|
12
|
+
|
13
|
+
def username
|
14
|
+
validate!
|
15
|
+
|
16
|
+
github_match[1]
|
17
|
+
end
|
18
|
+
|
19
|
+
def project
|
20
|
+
validate!
|
21
|
+
|
22
|
+
github_match[2]
|
23
|
+
end
|
24
|
+
|
25
|
+
def branch_name
|
26
|
+
validate!
|
27
|
+
|
28
|
+
current_branch.upstream.name.match(REMOTE_BRANCH_REGEX)[2]
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
attr_reader :source_dir
|
34
|
+
|
35
|
+
def current_branch_name
|
36
|
+
@current_branch_name ||= repo.head.name.sub(CURRENT_BRANCH_REGEX, '')
|
37
|
+
end
|
38
|
+
|
39
|
+
def current_branch
|
40
|
+
@current_branch ||= repo.branches[current_branch_name]
|
41
|
+
end
|
42
|
+
|
43
|
+
def github_match
|
44
|
+
@github_match ||= GITHUB_MATCH_REGEX.match(current_branch.remote.url)
|
45
|
+
end
|
46
|
+
|
47
|
+
def repo
|
48
|
+
@repo ||= Rugged::Repository.new(source_dir)
|
49
|
+
end
|
50
|
+
|
51
|
+
def validate!
|
52
|
+
return if @validated
|
53
|
+
|
54
|
+
must_be_on_branch!
|
55
|
+
must_have_an_upstream_branch!
|
56
|
+
upstream_remote_must_be_github!
|
57
|
+
@validated = true
|
58
|
+
end
|
59
|
+
|
60
|
+
def must_be_on_branch!
|
61
|
+
!current_branch.nil? ||
|
62
|
+
raise(Error, 'Not on a branch')
|
63
|
+
end
|
64
|
+
|
65
|
+
def must_have_an_upstream_branch!
|
66
|
+
!current_branch.remote.nil? ||
|
67
|
+
raise(Error, "No upstream branch set for the current branch of #{current_branch_name}")
|
68
|
+
end
|
69
|
+
|
70
|
+
def upstream_remote_must_be_github!
|
71
|
+
!github_match.nil? ||
|
72
|
+
raise(Error, 'Upstream remote is not GitHub')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/lib/sleet/repo.rb
CHANGED
@@ -2,87 +2,44 @@
|
|
2
2
|
|
3
3
|
module Sleet
|
4
4
|
class Repo
|
5
|
-
REMOTE_BRANCH_REGEX = %r{^([^\/.]+)\/(.+)}.freeze
|
6
|
-
CURRENT_BRANCH_REGEX = %r{^refs\/heads\/}.freeze
|
7
|
-
GITHUB_MATCH_REGEX = %r{github.com[:\/](.+)\/(.+)\.git}.freeze
|
8
|
-
|
9
5
|
def self.from_config(config)
|
6
|
+
local_repo = Sleet::LocalRepo.new(source_dir: config.source_dir)
|
7
|
+
|
10
8
|
new(
|
11
|
-
|
12
|
-
|
9
|
+
circle_ci_token: config.circle_ci_token,
|
10
|
+
username: config.username || local_repo.username,
|
11
|
+
project: config.project || local_repo.project,
|
12
|
+
branch_name: config.branch || local_repo.branch_name
|
13
13
|
)
|
14
14
|
end
|
15
15
|
|
16
|
-
def initialize(
|
17
|
-
@repo = repo
|
16
|
+
def initialize(circle_ci_token:, username:, project:, branch_name:)
|
18
17
|
@circle_ci_token = circle_ci_token
|
18
|
+
@github_user = username
|
19
|
+
@github_repo = project
|
20
|
+
@branch_name = branch_name
|
19
21
|
end
|
20
22
|
|
21
|
-
def
|
22
|
-
|
23
|
-
must_have_an_upstream_branch!
|
24
|
-
upstream_remote_must_be_github!
|
25
|
-
end
|
26
|
-
|
27
|
-
def branch
|
28
|
-
@branch ||= Sleet::Branch.new(
|
23
|
+
def build_for(build_num)
|
24
|
+
Sleet::Build.new(
|
29
25
|
circle_ci_token: circle_ci_token,
|
30
26
|
github_user: github_user,
|
31
27
|
github_repo: github_repo,
|
32
|
-
|
28
|
+
build_num: build_num
|
33
29
|
)
|
34
30
|
end
|
35
31
|
|
36
|
-
def
|
37
|
-
Sleet::
|
32
|
+
def branch
|
33
|
+
@branch ||= Sleet::Branch.new(
|
38
34
|
circle_ci_token: circle_ci_token,
|
39
35
|
github_user: github_user,
|
40
36
|
github_repo: github_repo,
|
41
|
-
|
37
|
+
branch: branch_name
|
42
38
|
)
|
43
39
|
end
|
44
40
|
|
45
41
|
private
|
46
42
|
|
47
|
-
attr_reader :
|
48
|
-
|
49
|
-
def remote_branch
|
50
|
-
current_branch.upstream.name.match(REMOTE_BRANCH_REGEX)[2]
|
51
|
-
end
|
52
|
-
|
53
|
-
def github_user
|
54
|
-
github_match[1]
|
55
|
-
end
|
56
|
-
|
57
|
-
def github_repo
|
58
|
-
github_match[2]
|
59
|
-
end
|
60
|
-
|
61
|
-
def current_branch_name
|
62
|
-
repo.head.name.sub(CURRENT_BRANCH_REGEX, '')
|
63
|
-
end
|
64
|
-
|
65
|
-
def current_branch
|
66
|
-
repo.branches[current_branch_name]
|
67
|
-
end
|
68
|
-
|
69
|
-
def github_match
|
70
|
-
@github_match ||= GITHUB_MATCH_REGEX.match(current_branch.remote.url)
|
71
|
-
end
|
72
|
-
|
73
|
-
def must_be_on_branch!
|
74
|
-
!current_branch.nil? ||
|
75
|
-
raise(Error, 'Not on a branch')
|
76
|
-
end
|
77
|
-
|
78
|
-
def must_have_an_upstream_branch!
|
79
|
-
!current_branch.remote.nil? ||
|
80
|
-
raise(Error, "No upstream branch set for the current branch of #{repo.current_branch_name}")
|
81
|
-
end
|
82
|
-
|
83
|
-
def upstream_remote_must_be_github!
|
84
|
-
!github_match.nil? ||
|
85
|
-
raise(Error, 'Upstream remote is not GitHub')
|
86
|
-
end
|
43
|
+
attr_reader :circle_ci_token, :github_user, :github_repo, :branch_name
|
87
44
|
end
|
88
45
|
end
|
data/lib/sleet/version.rb
CHANGED
data/sleet.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.summary = 'CircleCI RSpec Status Persistance File Aggregator'
|
14
14
|
spec.description = <<~DOC
|
15
15
|
Sleet provides an easy way to grab the most recent Rspec persistance files from CircleCI.
|
16
|
-
It also aggregates the
|
16
|
+
It also aggregates the artifacts from CircleCI, since you will have 1 per build container.
|
17
17
|
DOC
|
18
18
|
spec.homepage = 'https://github.com/coreyja/sleet'
|
19
19
|
spec.license = 'MIT'
|
@@ -26,16 +26,17 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.require_paths = ['lib']
|
27
27
|
|
28
28
|
spec.add_dependency 'colorize', '~> 0.8.1'
|
29
|
-
spec.add_dependency 'faraday', '>= 0.13.1', '<
|
29
|
+
spec.add_dependency 'faraday', '>= 0.13.1', '< 1.1.0'
|
30
|
+
spec.add_dependency 'faraday_middleware'
|
30
31
|
spec.add_dependency 'rspec', '~> 3.0'
|
31
|
-
spec.add_dependency 'rugged', '>= 0.26', '<
|
32
|
+
spec.add_dependency 'rugged', '>= 0.26', '< 1.1'
|
32
33
|
spec.add_dependency 'terminal-table', '~> 1.8'
|
33
|
-
spec.add_dependency 'thor', '
|
34
|
+
spec.add_dependency 'thor', '>= 0.20', '< 1.1'
|
34
35
|
|
35
|
-
spec.add_development_dependency 'gem-release', '= 2.
|
36
|
+
spec.add_development_dependency 'gem-release', '= 2.1.1'
|
36
37
|
spec.add_development_dependency 'github_changelog_generator', '~> 1.14'
|
37
38
|
spec.add_development_dependency 'pry', '~> 0.10'
|
38
|
-
spec.add_development_dependency 'rake', '~>
|
39
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
39
40
|
spec.add_development_dependency 'rubocop-coreyja', '0.4.0'
|
40
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
41
|
+
spec.add_development_dependency 'webmock', '~> 3.8.0'
|
41
42
|
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.3
|
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-08-10 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,21 @@ dependencies:
|
|
43
43
|
version: 0.13.1
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 1.1.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: faraday_middleware
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
47
61
|
- !ruby/object:Gem::Dependency
|
48
62
|
name: rspec
|
49
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +81,7 @@ dependencies:
|
|
67
81
|
version: '0.26'
|
68
82
|
- - "<"
|
69
83
|
- !ruby/object:Gem::Version
|
70
|
-
version: '
|
84
|
+
version: '1.1'
|
71
85
|
type: :runtime
|
72
86
|
prerelease: false
|
73
87
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -77,7 +91,7 @@ dependencies:
|
|
77
91
|
version: '0.26'
|
78
92
|
- - "<"
|
79
93
|
- !ruby/object:Gem::Version
|
80
|
-
version: '
|
94
|
+
version: '1.1'
|
81
95
|
- !ruby/object:Gem::Dependency
|
82
96
|
name: terminal-table
|
83
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,30 +110,36 @@ dependencies:
|
|
96
110
|
name: thor
|
97
111
|
requirement: !ruby/object:Gem::Requirement
|
98
112
|
requirements:
|
99
|
-
- - "
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0.20'
|
116
|
+
- - "<"
|
100
117
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
118
|
+
version: '1.1'
|
102
119
|
type: :runtime
|
103
120
|
prerelease: false
|
104
121
|
version_requirements: !ruby/object:Gem::Requirement
|
105
122
|
requirements:
|
106
|
-
- - "
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0.20'
|
126
|
+
- - "<"
|
107
127
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
128
|
+
version: '1.1'
|
109
129
|
- !ruby/object:Gem::Dependency
|
110
130
|
name: gem-release
|
111
131
|
requirement: !ruby/object:Gem::Requirement
|
112
132
|
requirements:
|
113
133
|
- - '='
|
114
134
|
- !ruby/object:Gem::Version
|
115
|
-
version: 2.
|
135
|
+
version: 2.1.1
|
116
136
|
type: :development
|
117
137
|
prerelease: false
|
118
138
|
version_requirements: !ruby/object:Gem::Requirement
|
119
139
|
requirements:
|
120
140
|
- - '='
|
121
141
|
- !ruby/object:Gem::Version
|
122
|
-
version: 2.
|
142
|
+
version: 2.1.1
|
123
143
|
- !ruby/object:Gem::Dependency
|
124
144
|
name: github_changelog_generator
|
125
145
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,14 +174,14 @@ dependencies:
|
|
154
174
|
requirements:
|
155
175
|
- - "~>"
|
156
176
|
- !ruby/object:Gem::Version
|
157
|
-
version: '
|
177
|
+
version: '13.0'
|
158
178
|
type: :development
|
159
179
|
prerelease: false
|
160
180
|
version_requirements: !ruby/object:Gem::Requirement
|
161
181
|
requirements:
|
162
182
|
- - "~>"
|
163
183
|
- !ruby/object:Gem::Version
|
164
|
-
version: '
|
184
|
+
version: '13.0'
|
165
185
|
- !ruby/object:Gem::Dependency
|
166
186
|
name: rubocop-coreyja
|
167
187
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,17 +202,17 @@ dependencies:
|
|
182
202
|
requirements:
|
183
203
|
- - "~>"
|
184
204
|
- !ruby/object:Gem::Version
|
185
|
-
version: 3.
|
205
|
+
version: 3.8.0
|
186
206
|
type: :development
|
187
207
|
prerelease: false
|
188
208
|
version_requirements: !ruby/object:Gem::Requirement
|
189
209
|
requirements:
|
190
210
|
- - "~>"
|
191
211
|
- !ruby/object:Gem::Version
|
192
|
-
version: 3.
|
212
|
+
version: 3.8.0
|
193
213
|
description: |
|
194
214
|
Sleet provides an easy way to grab the most recent Rspec persistance files from CircleCI.
|
195
|
-
It also aggregates the
|
215
|
+
It also aggregates the artifacts from CircleCI, since you will have 1 per build container.
|
196
216
|
email:
|
197
217
|
- coreyja@gmail.com
|
198
218
|
executables:
|
@@ -231,6 +251,7 @@ files:
|
|
231
251
|
- lib/sleet/error.rb
|
232
252
|
- lib/sleet/fetch_command.rb
|
233
253
|
- lib/sleet/job_fetcher.rb
|
254
|
+
- lib/sleet/local_repo.rb
|
234
255
|
- lib/sleet/repo.rb
|
235
256
|
- lib/sleet/rspec_file_merger.rb
|
236
257
|
- lib/sleet/version.rb
|