blinka-reporter 0.5.2 → 0.6.0

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: 7e989cf76be03d9a1010a66f3f76a0b00926a5b294bc07ce532266fed4bd1b0c
4
- data.tar.gz: fa30a9180feada7dd619e2e0040bce323114c06655f6c99ed20764fc5fe89538
3
+ metadata.gz: 46f79e8aba9b05128ca43d27e20f0897d9c7eb574403dadf4b6b9777bdc32af8
4
+ data.tar.gz: '069f1f72d6dcd55a9bdad1a18504a98365a20308a10fe9c890e64cfdf47ffb52'
5
5
  SHA512:
6
- metadata.gz: 31256af730acd4d5521dc3f978df9b379698d0b254eb0cb1df12bdcc885bddb01a98694b9c454b78e9e51d9bca32574e53b07a7563444a08ec5494e1e633a770
7
- data.tar.gz: aa9408c278883df6c8958f1a3332d44f666fd5fc0cbcd9c1b246b64f1a6134886947e4b1da68e27c5873b99e5627c0f561c0c6bb2e591aff96652b7d1a4a9bfe
6
+ metadata.gz: 76efdffd9a799088d948e28f4153ab3e764caa2e5c12e099735a007b54a4b403f77636627526f6e5f0c725515d402db8f0611efad73fa963cc0310a29f086fed
7
+ data.tar.gz: 8ace0335d407cd0efae861c79b3c48c14b9d414129a5cc04daec94565a0d4ffeb041be3b3237302a3780cdb9b5a65580f02cbac1db6041f1ad872fb1158a4815
@@ -0,0 +1,18 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "bundler"
9
+ directory: "/"
10
+ schedule:
11
+ interval: "daily"
12
+ target-branch: "main"
13
+
14
+ - package-ecosystem: "npm"
15
+ directory: "/"
16
+ schedule:
17
+ interval: "daily"
18
+ target-branch: "main"
@@ -0,0 +1,9 @@
1
+ changelog:
2
+ categories:
3
+ - title: Dependencies 🤖
4
+ labels:
5
+ - dependencies
6
+
7
+ - title: Changes
8
+ labels:
9
+ - "*"
@@ -0,0 +1,46 @@
1
+ name: Main
2
+ on:
3
+ push:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ tests:
8
+ name: Tests
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ ruby: ["2.6", "2.7", "3.0", "3.1"]
13
+
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v2
17
+
18
+ - name: Setup Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ bundler-cache: true
23
+
24
+ - name: Generate lockfile
25
+ run: bundle lock
26
+
27
+ - name: Run Setup
28
+ run: ./bin/setup
29
+
30
+ - name: Run tests
31
+ env:
32
+ BLINKA_JSON: true
33
+ run: bundle exec rake test
34
+
35
+ - name: Build and install gem
36
+ if: always()
37
+ run: gem build blinka_reporter.gemspec && gem install blinka-reporter-*.gem
38
+
39
+ - name: Report to Blinka
40
+ if: always()
41
+ env:
42
+ BLINKA_REPOSITORY: davidwessman/blinka_reporter
43
+ BLINKA_TEAM_ID: ${{ secrets.BLINKA_TEAM_ID }}
44
+ BLINKA_TEAM_SECRET: ${{ secrets.BLINKA_TEAM_SECRET }}
45
+ BLINKA_TAG: ${{ matrix.ruby }}
46
+ run: blinka_reporter --blinka --tap --path ./blinka_results.json
data/.gitignore ADDED
@@ -0,0 +1,28 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor # or operating system, you probably want to add a global ignore instead:
4
+ # git config --global core.excludesfile '~/.gitignore_global'
5
+
6
+ # Ignore bundler config.
7
+ /.bundle
8
+
9
+ # Environment
10
+ /.env
11
+
12
+ # Ignore all logfiles and tempfiles.
13
+ /log/*
14
+ /tmp/*
15
+ !/log/.keep
16
+ !/tmp/.keep
17
+
18
+ # Ignore all gems
19
+ /*.gem
20
+ Gemfile.lock
21
+
22
+ .byebug_history
23
+ /node_modules
24
+ yarn-debug.log*
25
+ yarn-error.log*
26
+ .yarn-integrity
27
+
28
+ /blinka_results.json
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.1
data/CHANGELOG.md ADDED
@@ -0,0 +1,152 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.6.0] - 2022-02-20
11
+
12
+ - Adds support for Rspec.
13
+ - Remove support for `BLINKA_REPORT`, instead use `bundle exec blinka-reporter --blinka` for reporting.
14
+ - Remove `BLINKA_TAP` and replace with `bundle exec blinka-reporter --tap`.
15
+ - Restructure gem internals.
16
+ - Support Rspec screenshots.
17
+
18
+ ## [0.5.2] - 2022-02-01
19
+
20
+ - Require MFA for pushing to [Rubygems](https://guides.rubygems.org/mfa-requirement-opt-in/)
21
+
22
+ ## [0.5.1] - 2022-02-01
23
+
24
+ - Look for screenshots in `Capybara.save_path` to allow different output folders for screenshots.
25
+ - For example a Rails application can be configured with `Capybara.save_path = ENV.fetch('CAPYBARA_ARTIFACTS', './tmp/capybara')` which can then be overriden in CI.
26
+
27
+ ## [0.5.0] - 2022-01-21
28
+
29
+ ### Added
30
+
31
+ - `BLINKA_APPEND` allows multiple test-runs to be appended to the same JSON-file.
32
+
33
+ ## [0.4.0] - 2021-03-27
34
+
35
+ ### Changed
36
+
37
+ - Change tempus of failing results from `failed` to `fail`.
38
+
39
+ ## [0.3.6] - 2021-03-25
40
+
41
+ ### Changed
42
+
43
+ - Removes dependency on mimemagic.
44
+ - Only allow images of `jpeg` or `png` format, handles their mime-types by extension.
45
+
46
+ ## [0.3.5] - 2021-03-11
47
+
48
+ ### Changed
49
+
50
+ - Move commit and tag to JSON-report instead of setting in the reporting client.
51
+ This allows the report to be made by a general script instead of in the test environment. In preparation of supporting Github Actions without access to secrets.
52
+
53
+ ## [0.3.4] - 2021-02-24
54
+
55
+ ### Changed
56
+
57
+ - Reported test cases now include the line in the file where they are defined, previously the line number was connected to the backtrace.
58
+
59
+ ## [0.3.3] - 2021-02-13
60
+
61
+ ### Added
62
+
63
+ - Use `HEROKU_TEST_RUN_COMMIT_VERSION` defined on Heroku CI when reporting test results to Blinka.
64
+
65
+ ## [0.3.2] - 2021-02-12
66
+
67
+ ### Fixed
68
+
69
+ - Allow to report with `BLINKA_REPORT` while using in tests `WebMock`.
70
+
71
+ ## [0.3.1] - 2021-02-12
72
+
73
+ ### Added
74
+
75
+ - Setting `BLINKA_REPORT` with credentials allow report to be sent to Blinka directly at the end of the test run.
76
+
77
+ ## [0.3.0] - 2021-02-08
78
+
79
+ ### Changed
80
+
81
+ - BREAKING 🚨 - Require setting environment variable `BLINKA_JSON` to any value to generate `blinka_results.json` used for reporting to Blinka.
82
+
83
+ ## [0.2.1] - 2021-02-08
84
+
85
+ ### Changed
86
+
87
+ - Raise error if configuration to report to Blinka is missing when reporting.
88
+
89
+ ## [0.2.0] - 2021-02-07
90
+
91
+ ### Added
92
+
93
+ - Adds support for reporting test results in TAP-format.
94
+
95
+ ## [0.1.1] - 2021-02-04
96
+
97
+ ### Changed
98
+
99
+ - Correct the homepage on rubygems.
100
+
101
+ ## [0.1.0] - 2021-02-03
102
+
103
+ ### Added
104
+
105
+ - Support for adding tag to report using `BLINKA_TAG` environment variable.
106
+
107
+ ### Removed
108
+
109
+ - No longer support `BLINKA_BRANCH`, use `BLINKA_TAG` instead.
110
+
111
+ ## [0.0.3] - 2021-02-02
112
+
113
+ ### Added
114
+
115
+ - Allow supplying which git commit sha to report.
116
+
117
+ ## [0.0.2] - 2021-02-01
118
+
119
+ ### Added
120
+
121
+ - Debug print for which commit hash was reported.
122
+
123
+ ## [0.0.1] - 2021-01-31
124
+
125
+ ### Added
126
+
127
+ - Setup LICENSE and CHANGELOG.
128
+
129
+ ### Fixed
130
+
131
+ - Handle inconsistency in source_location of test result in Minitest for different versions.
132
+
133
+ [unreleased]: https://github.com/davidwessman/blinka_reporter/compare/v0.6.0...HEAD
134
+ [0.5.2]: https://github.com/davidwessman/blinka_reporter/compare/v0.5.2...v0.6.0
135
+ [0.5.2]: https://github.com/davidwessman/blinka_reporter/compare/v0.5.1...v0.5.2
136
+ [0.5.1]: https://github.com/davidwessman/blinka_reporter/compare/v0.5.0...v0.5.1
137
+ [0.5.0]: https://github.com/davidwessman/blinka_reporter/compare/v0.4.0...v0.5.0
138
+ [0.4.0]: https://github.com/davidwessman/blinka_reporter/compare/v0.3.6...v0.4.0
139
+ [0.3.6]: https://github.com/davidwessman/blinka_reporter/compare/v0.3.5...v0.3.6
140
+ [0.3.5]: https://github.com/davidwessman/blinka_reporter/compare/v0.3.4...v0.3.5
141
+ [0.3.4]: https://github.com/davidwessman/blinka_reporter/compare/v0.3.3...v0.3.4
142
+ [0.3.3]: https://github.com/davidwessman/blinka_reporter/compare/v0.3.2...v0.3.3
143
+ [0.3.2]: https://github.com/davidwessman/blinka_reporter/compare/v0.3.1...v0.3.2
144
+ [0.3.1]: https://github.com/davidwessman/blinka_reporter/compare/v0.3.0...v0.3.1
145
+ [0.3.0]: https://github.com/davidwessman/blinka_reporter/compare/v0.2.1...v0.3.0
146
+ [0.2.1]: https://github.com/davidwessman/blinka_reporter/compare/v0.2.0...v0.2.1
147
+ [0.2.0]: https://github.com/davidwessman/blinka_reporter/compare/v0.1.1...v0.2.0
148
+ [0.1.1]: https://github.com/davidwessman/blinka_reporter/compare/v0.1.0...v0.1.1
149
+ [0.1.0]: https://github.com/davidwessman/blinka_reporter/compare/v0.0.3...v0.1.0
150
+ [0.0.3]: https://github.com/davidwessman/blinka_reporter/compare/v0.0.2...v0.0.3
151
+ [0.0.2]: https://github.com/davidwessman/blinka_reporter/compare/v0.0.1...v0.0.2
152
+ [0.0.1]: https://github.com/davidwessman/blinka_reporter/releases/tag/v0.0.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in blinka_reporter.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 David Wessman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,162 @@
1
+ # Blinka reporter
2
+
3
+ ## What does this gem do?
4
+
5
+ It connects to [supported ruby testing frameworks](#which-ruby-testing-frameworks-are-supported) and outputs a report of all passing, failing and skipped tests into a json-format. This format can be used to report test results using the [ruby client](#how-to-send-report-to-blinka) to [Blinka](#what-is-blinka).
6
+
7
+ ## How do I install the gem?
8
+
9
+ Run
10
+
11
+ ```sh
12
+ gem install blinka-reporter
13
+ ```
14
+
15
+ or add to your Gemfile
16
+
17
+ ```ruby
18
+ gem 'blinka-repoter', '~> 0.5.0'
19
+ ```
20
+
21
+ ## Which ruby testing frameworks are supported?
22
+
23
+ - Minitest
24
+ - Rspec
25
+
26
+ > Please reach out for other frameworks or create a reporter yourself.
27
+
28
+ ## What is Blinka?
29
+
30
+ Blinka is a web service developed by [@davidwessman](https://github.com/davidwessman) to store test results from CI and report interesting results back to Github, right in the pull request.
31
+
32
+ ## How to generate test report in the right format?
33
+
34
+ ### Minitest
35
+
36
+ ```sh
37
+ BLINKA_JSON=true bundle exec rails test
38
+ ```
39
+
40
+ Output as `./blinka_results.json`
41
+
42
+ ### Rspec
43
+
44
+ Make sure [rspec_junit_formatter](https://github.com/sj26/rspec_junit_formatter) is installed.
45
+
46
+ ```sh
47
+ bundle exec rspec --formatter RspecJunitFormatter --out ./rspec.xml
48
+ ```
49
+
50
+ ## How to send report to Blinka?
51
+
52
+ 1. Output your test results as described [above](#how-to-generate-test-report-in-the-right-format).
53
+ 1. Configure `BLINKA_TEAM_ID`, `BLINKA_TEAM_SECRET`, `BLINKA_REPOSITORY`.
54
+ 1. `bundle exec blinka-reporter --path {./blinka_results.json,./rspec.xml} --blinka`
55
+
56
+ ## How can I send report in Github Action?
57
+
58
+ Add a step to your Github Action Workflow after running tests:
59
+
60
+ ````yaml
61
+ - name: Minitest
62
+ env:
63
+ BLINKA_JSON: true
64
+ run: bundle exec rake test
65
+
66
+ - name: Report minitest to Blinka
67
+ env:
68
+ BLINKA_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
69
+ BLINKA_REPOSITORY: davidwessman/blinka_reporter
70
+ BLINKA_TAG: ""
71
+ BLINKA_TEAM_ID: ${{ secrets.BLINKA_TEAM_ID }}
72
+ BLINKA_TEAM_SECRET: ${{ secrets.BLINKA_TEAM_SECRET }}
73
+ run: bundle exec blinka-reporter --path ./blinka_results.json --blinka
74
+
75
+
76
+ ```yaml
77
+ - name: Rspec
78
+ run: bundle exec rspec --formatter RspecJunitFormatter --out ./rspec.xml
79
+ - name: Report minitest to Blinka
80
+ env:
81
+ BLINKA_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
82
+ BLINKA_REPOSITORY: davidwessman/blinka_reporter
83
+ BLINKA_TAG: ""
84
+ BLINKA_TEAM_ID: ${{ secrets.BLINKA_TEAM_ID }}
85
+ BLINKA_TEAM_SECRET: ${{ secrets.BLINKA_TEAM_SECRET }}
86
+ run: bundle exec blinka-reporter --path ./rspec.xml --blinka
87
+ ````
88
+
89
+ `BLINKA_TAG` is optional and can be used to separate different reports, for example when using a build matrix.
90
+
91
+ ## How to make multiple test runs into one report?
92
+
93
+ **Only supported for Minitest, open an issue for Rspec-support**
94
+
95
+ For example when running tests in parallel you might need to run system tests separately.
96
+ By first using `BLINKA_JSON` it will create a clean file, `BLINKA_APPEND` will append the results.
97
+
98
+ ```yaml
99
+ - name: System tests
100
+ env:
101
+ BLINKA_JSON: true
102
+ PARALLEL_WORKERS: 1
103
+ run: bundle exec rails test:system
104
+
105
+ - name: Tests
106
+ env:
107
+ BLINKA_JSON: true
108
+ BLINKA_APPEND: true
109
+ run: bundle exec rails test
110
+
111
+ - name: Report to Blinka
112
+ env:
113
+ BLINKA_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
114
+ BLINKA_REPOSITORY: davidwessman/blinka_reporter
115
+ BLINKA_TAG: ""
116
+ BLINKA_TEAM_ID: ${{ secrets.BLINKA_TEAM_ID }}
117
+ BLINKA_TEAM_SECRET: ${{ secrets.BLINKA_TEAM_SECRET }}
118
+ run: bundle exec blinka-reporter --path ./blinka_results.json --blinka
119
+ ```
120
+
121
+ ## How can I report tests in TAP-format?
122
+
123
+ TAP-format ([Test anything protocol](https://testanything.org)) is used to parse tests results on for example Heroku CI.
124
+
125
+ Generate your test results like [above](#how-to-generate-test-report-in-the-right-format),
126
+ replace `<path>` with your json or xml file.
127
+
128
+ ```sh
129
+ bundle exec blinka-reporter --tap --path <path>
130
+
131
+ TAP version 13
132
+ 1..14
133
+ ok 1 - test/test_blinka_minitest.rb - test_message
134
+ ok 2 - test/test_blinka_minitest.rb - test_image
135
+ ok 3 - test/test_blinka_minitest.rb - test_image_no_file
136
+ ok 4 - test/test_blinka_minitest.rb - test_report_with_image
137
+ ok 5 - test/test_blinka_minitest.rb - test_line
138
+ ok 6 - test/test_blinka_minitest.rb - test_backtrace
139
+ ok 7 - test/test_blinka_minitest.rb - test_line_no_failure
140
+ ok 8 - test/test_blinka_minitest.rb - test_report
141
+ ok 9 - test/test_blinka_minitest.rb - test_backtrace_no_failure
142
+ ok 10 - test/test_blinka_minitest.rb - test_kind_no_folder
143
+ ok 11 - test/test_blinka_minitest.rb - test_result
144
+ ok 12 - test/test_blinka_minitest.rb - test_kind
145
+ ok 13 - test/test_blinka_minitest.rb - test_message_no_failure
146
+ ok 14 - test/test_blinka_minitest.rb - test_source_location
147
+ ```
148
+
149
+ # Development
150
+
151
+ ## Release new version
152
+
153
+ 1. Update version in [`CHANGELOG.md`](./CHANGELOG.md) and include changes.
154
+ 1. Update version in [`lib/blinka_reporter/version.rb`](./lib/blinka_reporter/version.rb).
155
+ 1. Create pull request and merge to default branch.
156
+ 1. `gem build blinka_reporter.gemspec` (make sure it matches the bumped version).
157
+ 1. `gem push blinka-reporter-{version}.gem` (had to use `--otp` because I could not enter it when prompted).
158
+ 1. Create a release and tag on Github for history.
159
+
160
+ # License
161
+
162
+ `blinka-reporter` is licensed under the MIT license, see [LICENSE](LICENSE) for details.
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require 'rake/testtask'
2
+ require 'dotenv/load'
3
+
4
+ Rake::TestTask.new { |t| t.libs << 'test' }
5
+
6
+ desc('Run tests')
7
+ task(default: :test)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift("#{__dir__}/../lib")
4
+
5
+ require "blinka_reporter/cli"
6
+
7
+ exit BlinkaReporter::Cli.run(ARGV)
data/bin/setup ADDED
@@ -0,0 +1,15 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ # CI-specific setup
6
+ if [ -n "$GITHUB_ACTIONS" ]; then
7
+ bundle config path vendor/bundle
8
+ bundle config jobs 4
9
+ bundle config retry 3
10
+ git config --global user.name 'GitHub Actions'
11
+ git config --global user.email 'github-actions@blinka'
12
+ fi
13
+
14
+ gem install bundler --conservative
15
+ bundle check || bundle install
@@ -0,0 +1,41 @@
1
+ require_relative 'lib/blinka_reporter/version'
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ['David Wessman']
5
+ gem.description =
6
+ 'Use to format test results from Minitest to use with Blinka.'
7
+ gem.email = 'david@wessman.co'
8
+ gem.homepage = 'https://github.com/davidwessman/blinka_reporter'
9
+ gem.license = 'MIT'
10
+ gem.summary = 'Format tests for Blinka'
11
+
12
+ gem.metadata = {
13
+ 'homepage_uri' => 'https://github.com/davidwessman/blinka_reporter',
14
+ 'bug_tracker_uri' =>
15
+ 'https://github.com/davidwessman/blinka_reporter/issues',
16
+ 'documentation_uri' => 'https://github.com/davidwessman/blinka_reporter',
17
+ 'changelog_uri' =>
18
+ 'https://github.com/davidwessman/blinka_reporter/main/CHANGELOG.md',
19
+ 'source_code_uri' => 'https://github.com/davidwessman/blinka_reporter',
20
+ 'rubygems_mfa_required' => 'true'
21
+ }
22
+
23
+ gem.files =
24
+ Dir.chdir(File.expand_path('..', __FILE__)) do
25
+ `git ls-files -z`
26
+ .split("\x0")
27
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
28
+ end
29
+ gem.name = 'blinka-reporter'
30
+ gem.version = BlinkaReporter::VERSION
31
+ gem.executables = ['blinka_reporter']
32
+ gem.require_path = ['lib']
33
+
34
+ gem.add_dependency('httparty', '~> 0.18')
35
+ gem.add_dependency('ox', '~> 2')
36
+ gem.add_development_dependency('dotenv', '~> 2.7.6')
37
+ gem.add_development_dependency('minitest', '~> 5.0')
38
+ gem.add_development_dependency('mocha', '~> 1.12')
39
+ gem.add_development_dependency('rake', '~> 13')
40
+ gem.add_development_dependency('webmock', '~> 3.11')
41
+ end