diff --git a/.travis.yml b/.travis.yml index d08e39000..da58ee7ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,6 @@ notifications: slack: rxswift:3ykt2Z61f8GkdvhCZTYPduOL email: false -script: ./scripts/pre-release-tests.sh +script: + - "bundle exec danger --verbose" + - ./scripts/pre-release-tests.sh diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 000000000..e59cb0202 --- /dev/null +++ b/Dangerfile @@ -0,0 +1,32 @@ +# Sometimes it's a README fix, or something like that - which isn't relevant for +# including in a project's CHANGELOG for example +declared_trivial = pr_title.include? "#trivial" + +# Make it more obvious that a PR is a work in progress and shouldn't be merged yet +warn("PR is classed as Work in Progress") if pr_title.include? "[WIP]" + +# Warn no CHANGELOG +warn("No CHANGELOG changes made") if lines_of_code > 50 && !modified_files.include?("CHANGELOG.yml") && !declared_trivial + +# Warn pod spec changes +warn("RxCocoa.podspec changed") if modified_files.include?("RxCocoa.podspec") +warn("RxSwift.podspec changed") if modified_files.include?("RxSwift.podspec") +warn("RxTests.podspec changed") if modified_files.include?("RxTests.podspec") +warn("RxBlocking.podspec changed") if modified_files.include?("RxBlocking.podspec") + +# Warn summary on pull request +if pr_body.length < 5 + warn "Please provide a summary in the Pull Request description" +end + +# If these are all empty something has gone wrong, better to raise it in a comment +if modified_files.empty? && added_files.empty? && deleted_files.empty? + fail "This PR has no changes at all, this is likely a developer issue." +end + +# Warn when there is a big PR +warn("Big PR") if lines_of_code > 500 + +# Don't let testing shortcuts get into master by accident +fail("fdescribe left in tests") if `grep -r fdescribe specs/`.length > 1 +fail("fit left in tests") if `grep -r "fit specs/ `.length > 1 diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..c9c92bd23 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'danger' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..062a28323 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,34 @@ +GEM + remote: https://rubygems.org/ + specs: + addressable (2.3.8) + claide (1.0.0) + colored (1.2) + danger (0.7.4) + claide + colored (~> 1.2) + faraday + git + octokit (~> 4.2) + redcarpet (~> 3.3) + terminal-table (~> 1) + faraday (0.9.1) + multipart-post (>= 1.2, < 3) + git (1.3.0) + multipart-post (2.0.0) + octokit (4.3.0) + sawyer (~> 0.7.0, >= 0.5.3) + redcarpet (3.3.4) + sawyer (0.7.0) + addressable (>= 2.3.5, < 2.5) + faraday (~> 0.8, < 0.10) + terminal-table (1.4.5) + +PLATFORMS + ruby + +DEPENDENCIES + danger + +BUNDLED WITH + 1.12.5