diff --git a/.travis.yml b/.travis.yml index 6198a4bf..a2f3360c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,17 @@ language: objective-c osx_image: xcode10 + before_install: - bundle install + +before_script: +- bundle exec danger + script: - .travis/build.sh + after_success: - bash <(curl -s https://codecov.io/bash) + notifications: email: false \ No newline at end of file diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 00000000..f9b252e6 --- /dev/null +++ b/Dangerfile @@ -0,0 +1,19 @@ + +has_source_changes = !git.modified_files.grep(/Sources.*\.swift/).empty? || !git.added_files.grep(/Sources.*\.swift/).empty? +has_tests_changes = !git.modified_files.grep(/Sources\/PageboyTests.*\.swift/).empty? || !git.added_files.grep(/Sources\/PageboyTests.*\.swift/).empty? + +# 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 github.pr_title.include? "[WIP]" + +# Warn when there is a big PR +warn("This PR might be a little too big, consider breaking it up.") if git.lines_of_code > 500 + +# Require PR description +warn "Please provide a summary in the PR description, it makes it easier to understand!" if github.pr_body.length < 5 + +# Check for source changes and prompt for test updates if non added. +if (has_source_changes && ! has_tests_changes) + warn("Looks like you changed some source files, should there have been some tests added?") +end + +swiftlint.lint_files \ No newline at end of file diff --git a/Gemfile b/Gemfile index b12c0b6f..b3368d9e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,7 @@ source 'https://rubygems.org' -gem "fastlane" -gem "cocoapods" \ No newline at end of file +gem 'fastlane' +gem 'cocoapods' +gem 'danger' +gem 'danger-swiftlint' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index ade22a03..492d44cf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,6 +12,10 @@ GEM atomos (0.1.3) babosa (1.0.2) claide (1.0.2) + claide-plugins (0.9.2) + cork + nap + open4 (~> 1.3) cocoapods (1.5.3) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) @@ -36,7 +40,7 @@ GEM fuzzy_match (~> 2.0.4) nap (~> 1.0) cocoapods-deintegrate (1.0.2) - cocoapods-downloader (1.2.1) + cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) @@ -49,7 +53,25 @@ GEM colored2 (3.1.2) commander-fastlane (4.4.6) highline (~> 1.7.2) - concurrent-ruby (1.0.5) + concurrent-ruby (1.1.3) + cork (0.3.0) + colored2 (~> 3.1) + danger (5.8.0) + claide (~> 1.0) + claide-plugins (>= 0.9.2) + colored2 (~> 3.1) + cork (~> 0.1) + faraday (~> 0.9) + faraday-http-cache (~> 1.0) + git (~> 1.5) + kramdown (~> 1.5) + no_proxy_fix + octokit (~> 4.7) + terminal-table (~> 1) + danger-swiftlint (0.17.4) + danger + rake (> 10) + thor (~> 0.19) declarative (0.0.10) declarative-option (0.1.0) domain_name (0.5.20180417) @@ -63,10 +85,12 @@ GEM faraday-cookie_jar (0.0.6) faraday (>= 0.7.4) http-cookie (~> 1.0.0) + faraday-http-cache (1.3.1) + faraday (~> 0.8) faraday_middleware (0.12.2) faraday (>= 0.7.4, < 1.0) fastimage (2.1.4) - fastlane (2.105.2) + fastlane (2.108.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) babosa (>= 1.0.2, < 2.0.0) @@ -105,6 +129,7 @@ GEM fourflusher (2.0.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) + git (1.5.0) google-api-client (0.23.9) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.5, < 0.7.0) @@ -113,10 +138,10 @@ GEM representable (~> 3.0) retriable (>= 2.0, < 4.0) signet (~> 0.9) - googleauth (0.6.6) + googleauth (0.6.7) faraday (~> 0.12) jwt (>= 1.4, < 3.0) - memoist (~> 0.12) + memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (~> 0.7) @@ -128,6 +153,7 @@ GEM concurrent-ruby (~> 1.0) json (2.1.0) jwt (2.1.0) + kramdown (1.17.0) memoist (0.16.0) mime-types (3.2.2) mime-types-data (~> 3.2015) @@ -142,9 +168,14 @@ GEM nap (1.1.0) naturally (2.2.0) netrc (0.11.0) + no_proxy_fix (0.1.2) + octokit (4.13.0) + sawyer (~> 0.8.0, >= 0.5.3) + open4 (1.3.4) os (1.0.0) plist (3.4.0) public_suffix (2.0.5) + rake (12.3.1) representable (3.0.4) declarative (< 0.1.0) declarative-option (< 0.2.0) @@ -153,8 +184,11 @@ GEM rouge (2.0.7) ruby-macho (1.3.1) rubyzip (1.2.2) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) security (0.1.3) - signet (0.10.0) + signet (0.11.0) addressable (~> 2.3) faraday (~> 0.9) jwt (>= 1.5, < 3.0) @@ -166,6 +200,7 @@ GEM terminal-notifier (1.8.0) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) + thor (0.20.3) thread_safe (0.3.6) tty-cursor (0.6.0) tty-screen (0.6.5) @@ -179,7 +214,7 @@ GEM unf_ext (0.0.7.5) unicode-display_width (1.4.0) word_wrap (1.0.0) - xcodeproj (1.6.0) + xcodeproj (1.7.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -195,7 +230,9 @@ PLATFORMS DEPENDENCIES cocoapods + danger + danger-swiftlint fastlane BUNDLED WITH - 1.16.1 + 1.17.1