blinka-reporter 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d5dac4b2e59cda85f61acde510a71b5f735d5584ab3aba859a6a01b1af73664
4
- data.tar.gz: 3d2ad1ee927ef0d09d8585c067ece1975799705f0ce964ed094f3f19cd7cfe7e
3
+ metadata.gz: 1d91f6af985c1f6006c8764e5b9a33c6b44a7f29a4ce101704cc924c1671ef53
4
+ data.tar.gz: caee878d2c6208ac19d39ffe936470c1e010117fec558e243edfab66db9a1d5a
5
5
  SHA512:
6
- metadata.gz: 9f6ed24e9caaf3c740064eaaa229717a24a52d41d2bcdf02650e5f3b151dd04beedc72950411a4a813aebc445e7a6316f991d9c9a42d5283b5378009752f8c13
7
- data.tar.gz: 6364c8edf5577d79ae45ac4bf1afaff97faa68d39aa41e2bf3d888c122b90d38cd9108e4a615bfe8fc2ca67332255fb3da63efea34da8b247978d931861e2b65
6
+ metadata.gz: '040953ad949228b1a23f60323a084d7854cd09c802b498db43fa52e7d81317c136caee762580fec3d07142c59d973a005ad9c80d040f4fbe1501f6fb36dfd2ab'
7
+ data.tar.gz: 9b01fc45223ce2a111ba85b3260d8965cb633e4f4317cf0bfb965b8e5c8582a7a394d501c417141c3377bd6ba6830da6829eeb4eaf2bb48ea68d606f6727de94
data/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.7.2] - 2023-02-19
11
+
12
+ - Adds support for `BLINKA_APPEND=true` to append to existing JSON-files.
13
+
10
14
  ## [0.7.1] - 2023-02-19
11
15
 
12
16
  - Handles empty test results.
data/README.md CHANGED
@@ -60,36 +60,47 @@ Add a step to your Github Action Workflow after running tests:
60
60
  ```yaml
61
61
  - name: Minitest
62
62
  env:
63
- BLINKA_JSON: true
63
+ BLINKA_PATH: ./results.json
64
64
  run: bundle exec rake test
65
65
 
66
- - name: Report minitest to Blinka
66
+ // Add a tag to be able to separate multiple jobs, e.g. "ruby-${{ matrix.ruby }}".
67
+ // This is optional.
68
+ - name: Export Blinka-metadata
69
+ if: always()
67
70
  run: |
68
- bundle exec blinka_reporter \
69
- --path ./blinka_results.json \
70
- --blinka \
71
- --commit ${{ github.event.pull_request.head.sha || github.sha }} \
72
- --repository davidwessman/blinka_reporter \
73
- --team-id ${{ secrets.BLINKA_TEAM_ID }} \
74
- --team-secret ${{ secrets.BLINKA_TEAM_SECRET }}
71
+ echo "ruby gem" > ./blinka_tag
72
+
73
+ // Archive all files required by Blinka, json, the tag and any images.
74
+ // Blinka will automatically fetch the results when the Github Action Workflow is finished.
75
+ - name: Archive results for Blinka
76
+ if: always()
77
+ uses: actions/upload-artifact@v3
78
+ with:
79
+ name: blinka-${{ strategy.job-index }}
80
+ path: |
81
+ ./results.json
82
+ ./blinka_tag
75
83
  ```
76
84
 
77
85
  ```yaml
78
86
  - name: Rspec
79
87
  run: bundle exec rspec --formatter RspecJunitFormatter --out ./rspec.xml
80
- - name: Report minitest to Blinka
88
+
89
+ - name: Export Blinka-metadata
90
+ if: always()
81
91
  run: |
82
- bundle exec blinka_reporter \
83
- --path ./rspec.xml \
84
- --blinka \
85
- --commit ${{ github.event.pull_request.head.sha || github.sha }} \
86
- --repository davidwessman/blinka_reporter \
87
- --team-id ${{ secrets.BLINKA_TEAM_ID }} \
88
- --team-secret ${{ secrets.BLINKA_TEAM_SECRET }}
92
+ echo "ruby gem" > ./blinka_tag
93
+
94
+ - name: Archive results for Blinka
95
+ if: always()
96
+ uses: actions/upload-artifact@v3
97
+ with:
98
+ name: blinka-${{ strategy.job-index }}
99
+ path: |
100
+ ./rspec.xml
101
+ ./blinka_tag
89
102
  ```
90
103
 
91
- `--tag` is optional and can be used to separate different reports, for example when using a build matrix.
92
-
93
104
  ## How to make multiple test runs into one report?
94
105
 
95
106
  For example when running tests in parallel you might need to run system tests separately.
@@ -107,16 +118,33 @@ Output the test results to different paths with `BLINKA_PATH`.
107
118
  BLINKA_JSON: ./tests.json
108
119
  run: bundle exec rails test
109
120
 
110
- - name: Report to Blinka
111
- run: |
112
- bundle exec blinka_reporter \
113
- --path ./system_tests.json \
114
- --path ./tests.json \
115
- --blinka \
116
- --commit ${{ github.event.pull_request.head.sha || github.sha }} \
117
- --repository davidwessman/blinka_reporter \
118
- --team-id ${{ secrets.BLINKA_TEAM_ID }} \
119
- --team-secret ${{ secrets.BLINKA_TEAM_SECRET }}
121
+ - name: Archive results for Blinka
122
+ if: always()
123
+ uses: actions/upload-artifact@v3
124
+ with:
125
+ name: blinka-${{ strategy.job-index }}
126
+ path: |
127
+ ./tests.json
128
+ ./system_tests.json
129
+ ./blinka_tag
130
+ ```
131
+
132
+ ## How can I run multiple test runs to one file?
133
+
134
+ For Minitest this can be done by setting `BLINKA_APPEND=true`, make sure to clean the `BLINKA_PATH` file before running the tests.
135
+
136
+ ```yaml
137
+ - name: Tests 1
138
+ env:
139
+ BLINKA_PATH: ./tests.json
140
+ BLINKA_APPEND: true
141
+ run: bundle exec rails test:system
142
+
143
+ - name: Tests 2
144
+ env:
145
+ BLINKA_PATH: ./tests.json
146
+ BLINKA_APPEND: true
147
+ run: bundle exec rails test
120
148
  ```
121
149
 
122
150
  ## How can I report tests in TAP-format?
@@ -1,3 +1,3 @@
1
1
  module BlinkaReporter
2
- VERSION = '0.7.1'.freeze
2
+ VERSION = '0.7.2'.freeze
3
3
  end
@@ -42,9 +42,19 @@ module Minitest
42
42
  results:
43
43
  tests&.map do |test_result|
44
44
  BlinkaReporter::MinitestAdapter.new(test_result).report
45
- end
45
+ end || []
46
46
  }
47
47
 
48
+ if ENV['BLINKA_APPEND'] == 'true' && File.exist?(report_path)
49
+ existing =
50
+ JSON.parse(File.open(report_path).read, symbolize_names: true)
51
+ result[:results] = existing[:results] + result[:results]
52
+ result[:nbr_tests] = existing[:nbr_tests] + result[:nbr_tests]
53
+ result[:nbr_assertions] =
54
+ existing[:nbr_assertions] + result[:nbr_assertions]
55
+ result[:total_time] = existing[:total_time] + result[:total_time]
56
+ end
57
+
48
58
  File.open(report_path, 'w+') do |file|
49
59
  file.write(JSON.pretty_generate(result))
50
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blinka-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Wessman