diff --git a/DangerFile b/DangerFile index 39fda0c..bebe45d 100644 --- a/DangerFile +++ b/DangerFile @@ -22,14 +22,25 @@ end #FILE HELPERS gitfiles = (git.modified_files + git.added_files).uniq +output_dir = "./output" build_reports = [] test_reports = [] -Find.find("./output") do |path| - build_reports << path if path =~ /.*\.build-report.json$/ - test_reports << path if path =~ /.*report.junit$/ +if File.directory?(output_dir) + Find.find(output_dir) do |path| + build_reports << path if path =~ /.*\.build-report.json$/ + test_reports << path if path =~ /.*report.junit$/ + end +else + fail "The #{output_dir} dir is empty, usually this means that no flavor has been compiled" end +# CHECK REPORTS: +if build_reports.length != test_reports.length + fail "Not all targets successfully completed the tests. (#{build_reports.length} builds vs #{test_reports.length} tests reports)" +end +fail "Not all targets could be compiled. Check if any flavor dont build. (We have #{build_reports.length} builds)" unless build_reports.length == 8 + #BASIC CHECKS: warn 'Big PR, try to keep changes smaller if you can 😜' if git.lines_of_code > 500 fail 'This PR does not have any assignees yet.' unless github.pr_json["assignee"] @@ -44,12 +55,7 @@ end #JUNIT PARSE: test_reports.each do |path| path = Pathname(path) - junit.parse path.to_s - junit.report - all_test = junit.tests.map(&:attributes) - slowest_test = all_test.sort_by { |attributes| attributes[:time].to_f }.last - message "⌛️ **[#{read_platform_from_testreport_file(path: path)}]** Slowest test: #{slowest_test[:name]} took #{'%.3f' % slowest_test[:time]} seconds" end #SWIFTLINT diff --git a/Gemfile b/Gemfile index a231dbe..7696995 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,6 @@ gem "danger" gem "danger-xcodebuild" gem "danger-swiftlint" gem "danger-xcov" -gem "danger-junit" gem "danger-xcode_summary" plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') diff --git a/Gemfile.lock b/Gemfile.lock index b7199dd..6f25899 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -94,9 +94,6 @@ GEM no_proxy_fix octokit (~> 4.7) terminal-table (>= 1, < 4) - danger-junit (1.0.2) - danger (> 2.0) - ox (~> 2.0) danger-plugin-api (1.0.0) danger (> 2.0) danger-swiftlint (0.26.0) @@ -267,7 +264,6 @@ GEM childprocess (>= 0.6.3, < 5) iniparse (~> 1.4) rexml (~> 3.2) - ox (2.14.5) plist (3.6.0) public_suffix (4.0.6) rake (13.0.6) @@ -347,7 +343,6 @@ PLATFORMS DEPENDENCIES cocoapods danger - danger-junit danger-swiftlint danger-xcode_summary danger-xcodebuild diff --git a/README.md b/README.md index 03e8bd4..01c2fac 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ With Mini, you can create a thread-safe application with a predictable unidirect [![Platform](https://img.shields.io/cocoapods/p/MasMini-Swift.svg?style=flat)](https://cocoapods.org/pods/MasMini-Swift) [![GitHub](https://img.shields.io/github/license/masmovil/masmini-swift.svg)](https://github.com/masmovil/masmini-swift/blob/master/LICENSE) -[![Build Status](https://travis-ci.com/masmovil/masmini-swift.svg?branch=master)](https://travis-ci.com/masmovil/masmini-swift) +[![Build Status](https://github.com/masmovil/masmini-swift/actions/workflows/build-and-tests.yml/badge.svg)](https://github.com/masmovil/masmini-swift/actions/workflows/build-and-tests.yml) [![codecov](https://codecov.io/gh/masmovil/masmini-swift/branch/master/graph/badge.svg)](https://codecov.io/gh/masmovil/masmini-swift) ## Requirements