This repository has been archived by the owner on Jan 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 143
/
Copy pathDangerfile
51 lines (43 loc) · 2.12 KB
/
Dangerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Mainly to encourage writing up some reasoning about the PR, rather than just leaving a title
if github.pr_body.length < 5
fail "Please provide a summary in the Pull Request description"
end
# Just to let people know
warn("PR is classed as Work in Progress") if github.pr_title.include? "WIP"
# Make a note about contributors not in the organization
unless github.api.organization_member?('spotify', github.pr_author)
# Pay extra attention if external contributors modify certain files
if git.modified_files.include?("Gemfile") or git.modified_files.include?("Gemfile.lock")
warn "External contributor has edited the Gemfile and/or Gemfile.lock"
end
if git.modified_files.include?("HubFramework.podspec")
warn "External contributor has edited the HubFramework.podspec"
end
end
# Fail if the project.xcconfig file is modified since that's not supported.
if git.modified_files.include?("project.xcconfig")
fail "The project.xcconfig must not be modified, please change spotify_os.xcconfig instead"
end
# Fail if the LICENSE file was modified
if git.modified_files.include?("LICENSE")
fail "The license file was modified."
end
# Give inline build results (compile and link time warnings and errors)
xcode_summary.report 'build/tests-static/summary.json' if File.file?('build/tests-static/summary.json')
xcode_summary.report 'build/tests-dynamic/summary.json' if File.file?('build/tests-dynamic/summary.json')
xcode_summary.report 'build/ui-tests/summary.json' if File.file?('build/ui-tests/summary.json')
xcode_summary.report 'build/demo/summary.json' if File.file?('build/demo/summary.json')
def report_junit_results(path)
junit_report_path = Dir.glob(path + "/*TestSummaries.junit").first
if !junit_report_path.nil? and File.readable_real?(junit_report_path)
junit.parse junit_report_path
junit.show_skipped_tests = true
junit.report
else
fail "Couldn't find the (junit) unit test report file in '#{path}'. Make sure the tests were actually run."
end
end
# Give inline test fail reports
report_junit_results("build/tests-static")
report_junit_results("build/tests-dynamic")
report_junit_results("build/ui-tests")