diff --git a/.travis.yml b/.travis.yml index 7c572ee..b573b29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ install: script: - script/build + - bundle exec danger before_deploy: - script/package diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 0000000..96c0ee0 --- /dev/null +++ b/Dangerfile @@ -0,0 +1,38 @@ +# Sometimes it's a README fix, or something like that - which isn't relevant for +# including in a project's CHANGELOG for example +has_app_changes = !git.modified_files.grep(/mas-cli/).empty? +# has_test_changes = !git.modified_files.grep(/Tests/).empty? + +is_version_bump = git.modified_files.sort == ["CHANGELOG.md", "mas-cli/mas-cli-Info.plist"].sort +message(":bookmark: Version bump!") if is_version_bump + +# if has_app_changes && !has_test_changes && !is_version_bump +# warn("Tests were not updated", sticky: false) +# end + +# Thanks other people! +message(":tada:") if is_version_bump && github.pr_author != "phatblat" + +# Mainly to encourage writing up some reasoning about the PR, rather than just leaving a title +if github.pr_body.length < 5 + fail ":memo: Please provide a summary in the Pull Request description" +end + +# Let people say that this isn't worth a CHANGELOG entry in the PR if they choose +declared_trivial = (github.pr_title + github.pr_body).include?("#trivial") || !has_app_changes +message("This PR might seem trivial, but every contribution counts. :kissing_heart:") if declared_trivial + +# Keep the CHANGELOG up-to-date +if !git.modified_files.include?("CHANGELOG.md") && !declared_trivial + fail(":book: Please include a CHANGELOG entry. \nYou can find it at [CHANGELOG.md](https://github.com/mas-cli/mas/blob/master/CHANGELOG.md).", sticky: false) +end + +# Make it more obvious that a PR is a work in progress and shouldn't be merged yet +warn(":construction: PR is classed as Work in Progress") if github.pr_title.include? "[WIP]" + +# Warn when there is a big PR +warn(":dizzy_face: Big PR") if git.lines_of_code > 500 + +# Don't let testing shortcuts get into master by accident +#fail("fdescribe left in tests") if `grep -r fdescribe Tests/ `.length > 1 +#fail("fit left in tests") if `grep -r fit Tests/ `.length > 1 diff --git a/Gemfile b/Gemfile index c40482b..e99d81d 100644 --- a/Gemfile +++ b/Gemfile @@ -2,4 +2,5 @@ source "https://rubygems.org" gem "cocoaseeds" +gem "danger" gem "xcpretty" diff --git a/Gemfile.lock b/Gemfile.lock index 688ae01..1391b4e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,13 +2,52 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (2.3.6) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) claide (1.0.2) + claide-plugins (0.9.2) + cork + nap + open4 (~> 1.3) cocoaseeds (0.8.3) colored2 (~> 3.1) xcodeproj (>= 0.28) colored2 (3.1.2) + cork (0.3.0) + colored2 (~> 3.1) + danger (5.5.8) + claide (~> 1.0) + claide-plugins (>= 0.9.2) + colored2 (~> 3.1) + cork (~> 0.1) + faraday (~> 0.9) + faraday-http-cache (~> 1.0) + git (~> 1) + kramdown (~> 1.5) + no_proxy_fix + octokit (~> 4.7) + terminal-table (~> 1) + faraday (0.14.0) + multipart-post (>= 1.2, < 3) + faraday-http-cache (1.3.1) + faraday (~> 0.8) + git (1.3.0) + kramdown (1.16.2) + multipart-post (2.0.0) nanaimo (0.2.3) + nap (1.1.0) + no_proxy_fix (0.1.2) + octokit (4.8.0) + sawyer (~> 0.8.0, >= 0.5.3) + open4 (1.3.4) + public_suffix (3.0.1) rouge (2.0.7) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + unicode-display_width (1.3.0) xcodeproj (1.5.4) CFPropertyList (~> 2.3.3) claide (>= 1.0.2, < 2.0) @@ -22,6 +61,7 @@ PLATFORMS DEPENDENCIES cocoaseeds + danger xcpretty BUNDLED WITH