Skip to content

Commit 0e87599

Browse files
authored
Merge pull request #48 from diogot/xcresult
Add support for xcresult
2 parents c1ee639 + cfe5762 commit 0e87599

File tree

149 files changed

+297
-477
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+297
-477
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.xcresult binary

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
AllCops:
2+
NewCops: enable
3+
SuggestExtensions: false
4+
15
# kind_of? is a good way to check a type
26
Style/ClassCheck:
37
EnforcedStyle: kind_of?

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ cache:
33
directories:
44
- bundle
55

6+
os: osx
7+
osx_image: xcode11
8+
69
rvm:
710
- 2.6.0
811
- 2.5.3
912

13+
# install bundler 2.x
14+
before_install:
15+
- gem update --system
16+
- gem install bundler
17+
1018
script:
1119
- bundle exec rake spec

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24

35
# Specify your gem's dependencies in danger-xcode_summary.gemspec

Gemfile.lock

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
PATH
22
remote: .
33
specs:
4-
danger-xcode_summary (0.5.3)
4+
danger-xcode_summary (1.0.0)
55
danger-plugin-api (~> 1.0)
6+
xcresult (~> 0.2)
67

78
GEM
89
remote: https://rubygems.org/
@@ -137,6 +138,7 @@ GEM
137138
unicode-display_width (>= 1.1.1, < 3)
138139
thor (1.1.0)
139140
unicode-display_width (2.0.0)
141+
xcresult (0.2.1)
140142
yard (0.9.26)
141143

142144
PLATFORMS
@@ -156,4 +158,4 @@ DEPENDENCIES
156158
yard
157159

158160
BUNDLED WITH
159-
2.2.17
161+
2.2.26

Guardfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# A guardfile for making Danger Plugins
24
# For more info see https://github.com/guard/guard#readme
35

README.md

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66

77
A [Danger](http://danger.systems) plugin that shows all build errors, warnings and unit tests results generated from `xcodebuild`.
88

9-
You need to use [xcpretty](https://github.com/supermarin/xcpretty) with
10-
[xcpretty-json-formatter](https://github.com/marcelofabri/xcpretty-json-formatter)
11-
to generate a JSON file that this plugin can read.
12-
13-
**Using [danger-swift](https://github.com/danger/swift)**? You may want to take a look at [danger-swift-xcodesummary](https://github.com/f-meloni/danger-swift-xcodesummary).
14-
159
## How does it look?
1610

1711
<table>
@@ -62,24 +56,6 @@ to generate a JSON file that this plugin can read.
6256
</tbody>
6357
</table>
6458

65-
<table>
66-
<thead>
67-
<tr>
68-
<th width="50"></th>
69-
<th width="100%">
70-
1 Message
71-
</th>
72-
</tr>
73-
</thead>
74-
<tbody>
75-
<tr>
76-
<td><g-emoji alias="book" fallback-src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f4d6.png">📖</g-emoji></td>
77-
<td>Executed 5 tests, with 1 failure (0 unexpected) in 0.032 (0.065) seconds</td>
78-
</tr>
79-
</tr>
80-
</tbody>
81-
</table>
82-
8359
## Installation
8460

8561
Add this line to your Gemfile:
@@ -93,9 +69,13 @@ gem 'danger-xcode_summary'
9369
Just add this line to your `Dangerfile`:
9470

9571
```ruby
96-
xcode_summary.report 'xcodebuild.json'
72+
xcode_summary.report 'MyApp.xcresult'
9773
```
9874

75+
You need to pass the path of the `xcresult` generated after compiling your app.
76+
By default, this is inside the `DerivedData` for your project, but you can use the `-resultBundlePath`
77+
flag when calling `xcodebuild` to customize its path. You can read more about it in this [blog post from the folks at PSPDFKit](https://pspdfkit.com/blog/2021/deflaking-ci-tests-with-xcresults/#using-xcresult-bundles).
78+
9979
You can also ignore warnings from certain files by setting `ignored_files`:
10080
Warning: `ignored_files` patterns applied on relative paths.
10181

@@ -105,10 +85,10 @@ xcode_summary.ignored_files = 'Pods/**'
10585

10686
# Ignoring specific warnings
10787
xcode_summary.ignored_results { |result|
108-
result.message.start_with? 'ld' # Ignore ld_warnings
88+
result.message.include? 'ld' # Ignore ld_warnings
10989
}
11090

111-
xcode_summary.report 'xcodebuild.json'
91+
xcode_summary.report 'MyApp.xcresult'
11292
```
11393

11494
You can use `ignores_warnings` to supress warnings and shows only errors.
@@ -123,13 +103,13 @@ When this value is enabled, each warnings and errors are commented on each lines
123103
```ruby
124104
# Comment on each lines
125105
xcode_summary.inline_mode = true
126-
xcode_summary.report 'xcodebuild.json'
106+
xcode_summary.report 'MyApp.xcresult'
127107
```
128108

129-
You can get warning and error number by calling `warning_error_count`. The return will be a JSON string contains warning and error count, e.g {"warnings":1,"errors":3}:
109+
You can get warning and error number by calling `warning_error_count`. The return will be a JSON string contains warning and error count, e.g `{"warnings":1,"errors":3}`:
130110

131111
```ruby
132-
result = xcode_summary.warning_error_count 'xcodebuild.json'
112+
result = xcode_summary.warning_error_count 'MyApp.xcresult'
133113
```
134114

135115
## License

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'bundler/gem_tasks'
24
require 'rspec/core/rake_task'
35
require 'rubocop/rake_task'

danger-xcode_summary.gemspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# coding: utf-8
1+
# frozen_string_literal: true
22

3-
lib = File.expand_path('../lib', __FILE__)
3+
lib = File.expand_path('lib', __dir__)
44

55
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
66
require 'xcode_summary/gem_version.rb'
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
2323

2424
spec.required_ruby_version = ">= 2.4.0"
2525

26+
spec.add_dependency 'xcresult', '~> 0.2'
2627
spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
2728

2829
# General ruby development

lib/xcode_summary/gem_version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module XcodeSummary
4-
VERSION = '0.5.3'
4+
VERSION = '1.0.0'
55
end

0 commit comments

Comments
 (0)