sleet 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c74ecb0b18d854d65663b9afc1ee7c9d9c1778596a37ad4759830f287f871166
4
- data.tar.gz: 686ca59258b5308b7ca0442f602d73ca5cec4d2d21020a0e0bc59bd69f481e84
3
+ metadata.gz: e75141d27425d21f50ad88c1d003b95be8c764ddcd9fe0ae7f8338f6974b49b9
4
+ data.tar.gz: 1ad638ca66c29aa410fd93ff536fa4e1c0c0675c1ca9d37b813359a78a5f73d6
5
5
  SHA512:
6
- metadata.gz: c9f09ed96fbc87f8c9c4c95c30cfdb81abdef368d366e35c9abdbdc20d2ea6c65f7721c49a0bf987099b888c824c9c62f132c547a494cec97bcf93c1d755dd6a
7
- data.tar.gz: 5c36a2ccfae4b51f94506657371c527248a9983623506c83171054c7604f21cf76b67657207d83b5b8dab80a7750555178cd73c136de23d63a4fa91dab17393c
6
+ metadata.gz: 5ad5af55d1a6d79ca76b4179eb0322dedca20ddc4228f86cafa70d8768f8a2e29add248590a450a6ef100973f28afcbc09c854dc930c319dee7708b63c2a3f65
7
+ data.tar.gz: 06244c1173c20720f0cfd7bfce45b7c5f9749e5ed76ea83214b1aa575cac33b22b9c06a22bfdb8fea4831e1c676aebfba17571d59c574845f3f3aa9e0c9d3e2a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## [v0.3.2](https://github.com/coreyja/sleet/tree/v0.3.2) (2018-01-15)
4
+ [Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.1...v0.3.2)
5
+
6
+ **Merged pull requests:**
7
+
8
+ - Update Readme and Add Descriptions to Help Menus [\#8](https://github.com/coreyja/sleet/pull/8) ([coreyja](https://github.com/coreyja))
9
+
3
10
  ## [v0.3.1](https://github.com/coreyja/sleet/tree/v0.3.1) (2018-01-15)
4
11
  [Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.0...v0.3.1)
5
12
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # CircleCI RSpec Status Persistance File Aggregator
1
+ # Sleet
2
2
 
3
3
  ## Background and Problem
4
4
 
@@ -6,7 +6,7 @@ RSpec has a [feature](https://relishapp.com/rspec/rspec-core/v/3-7/docs/command-
6
6
 
7
7
  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.
8
8
  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.
9
- This is where this tool comes in!
9
+ This is where `Sleet` comes in!
10
10
 
11
11
  ## Purpose
12
12
 
@@ -18,11 +18,9 @@ This tool does two things:
18
18
 
19
19
  ### 1. Configure RSpec to Create and Use an example persistance file
20
20
 
21
- A current limitation is that the RSpec Persistance file must be named `.rspec_example_statuses`.
22
-
23
21
  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).
24
22
 
25
- 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.
23
+ 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.)
26
24
 
27
25
  ```
28
26
  RSpec.configure do |c|
@@ -30,23 +28,31 @@ RSpec.configure do |c|
30
28
  end
31
29
  ```
32
30
 
33
- 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
31
+ 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.
34
32
 
35
33
  ```
36
34
  --require spec_helper
37
35
  ```
38
36
 
37
+ Again there are other ways to load your `spec_helper.rb` file, including requiring it from each spec. Pick one that works for you.
38
+
39
39
  ### 2. Collect the example persistance files in CircleCI
40
40
 
41
41
  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.
42
42
 
43
43
  ```
44
44
  - store_artifacts:
45
- path: ~/PROJECT_NAME/.rspec_example_statuses
45
+ path: .rspec_example_statuses
46
46
 
47
47
  ```
48
48
 
49
- ### 3. Run this tool in the root of your project
49
+ ### 3. Save a CircleCI Token locally (to access private builds)
50
+
51
+ 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.
52
+
53
+ An API token can be generated here: [https://circleci.com/account/api](https://circleci.com/account/api)
54
+
55
+ ### 4. Run this tool in the root of your project
50
56
 
51
57
  ```
52
58
  sleet
@@ -54,10 +60,72 @@ sleet
54
60
 
55
61
  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.
56
62
 
57
- ### 4. Run RSpec with `--only-failures`
63
+ ### 5. Run RSpec with `--only-failures`
58
64
 
59
65
  ```
60
66
  bundle exec rspec --only-failures
61
67
  ```
62
68
 
63
69
  This will run only the examples that failed in CircleCI!
70
+
71
+ ## Configuration
72
+
73
+ 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.
74
+
75
+ Sleet currently supports two ways to input configurations:
76
+
77
+ 1. Through YML files
78
+ - `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`)
79
+ 2. Through the CLI
80
+ - These always take presendece the options provided in the YML files
81
+
82
+ ### Options
83
+
84
+ These are the options that are currently supported
85
+
86
+ #### `source_dir`
87
+
88
+ Alias: s
89
+
90
+ 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.
91
+
92
+ #### `input_file`
93
+
94
+ Alias: i
95
+
96
+ This is the name of the Rspec Circle Persistance File in CircleCI. The default is `.rspec_example_statuses`
97
+
98
+ This will match if the full path on CircleCI ends in the given name.
99
+
100
+ #### `output_file`
101
+
102
+ Alias: o
103
+
104
+ This is the name for the output file, on your local system. It is relative to the `source_dir`.
105
+
106
+ Will be IGNORED if `workflows` is provided.
107
+
108
+ #### `workflows`
109
+
110
+ Alias: w
111
+
112
+ 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.
113
+ 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.
114
+
115
+ Build-Test-Deploy Demo:
116
+
117
+ 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
118
+
119
+ This command will pick the `test` build and saw it's artificats to the `.rspec_example_statuses` file
120
+
121
+ ```
122
+ sleet fetch --workflows test:.rspec_example_statuses
123
+ ```
124
+
125
+ MonoRepo Demo:
126
+
127
+ 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.
128
+
129
+ ```
130
+ sleet fetch --workflows foo-test:foo/.rpsec_example_statuses bar-test:bar/.rspec_example_statuses baz-specs:baz/spec/examples.txt
131
+ ```
data/lib/sleet/cli.rb CHANGED
@@ -4,11 +4,25 @@ module Sleet
4
4
  class Cli < Thor
5
5
  default_task :fetch
6
6
 
7
- desc 'Fetch Rspec Status File from CircleCI', 'fetch'
8
- option :source_dir, type: :string, aliases: [:s]
9
- option :input_file, type: :string, aliases: [:i]
10
- option :output_file, type: :string, aliases: [:o]
11
- option :workflows, type: :hash, aliases: [:w]
7
+ desc 'fetch', 'Fetch and Aggregate RSpec Persistance Files from CircleCI'
8
+ long_desc <<~LONGDESC
9
+ `sleet fetch` will find build(s) in CircleCI for the current branch, and
10
+ download the chosen Rspec Persistance Files. Since there will be 1 per container,
11
+ and builds may have more than 1 container `sleet` will combine all the indivudual
12
+ persistance files.
13
+ LONGDESC
14
+ option :source_dir, type: :string, aliases: [:s], desc: <<~DESC
15
+ 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.
16
+ DESC
17
+ option :input_file, type: :string, aliases: [:i], desc: <<~DESC
18
+ This is the name of the Rspec Circle Persistance File in CircleCI. The default is .rspec_example_statuses. This will match if the full path on CircleCI ends in the given name.
19
+ DESC
20
+ option :output_file, type: :string, aliases: [:o], desc: <<~DESC
21
+ 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
+ DESC
23
+ option :workflows, type: :hash, aliases: [:w], desc: <<~DESC
24
+ 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
+ DESC
12
26
  def fetch
13
27
  if options[:workflows]
14
28
  workflow_fetch
data/lib/sleet/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sleet
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  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.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Alexander
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-15 00:00:00.000000000 Z
11
+ date: 2018-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize