Skip to content

Commit a396d2d

Browse files
committed
Set up Dangerfile
1 parent 20b680a commit a396d2d

2 files changed

Lines changed: 34 additions & 6 deletions

File tree

.travis.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ language: objective-c
22
osx_image: xcode8
33
matrix:
44
include:
5-
- env: BUILD=9.3
6-
script: bundle exec rake ci:build[9.3]
7-
- env: BUILD=latest
8-
script: bundle exec rake ci:build[latest]
9-
- env: BUILD=carthage
10-
script: make carthage
5+
- env: VERSION=9.3
6+
- env: VERSION=latest
7+
- env: VERSION=carthage
8+
before_script:
9+
- bundle exec danger
10+
script:
11+
- make carthage
1112
after_script:
1213
- make documentation
1314
cache:
@@ -21,6 +22,8 @@ install:
2122
- make install
2223
before_script:
2324
- xcodebuild -workspace ICInputAccessory.xcworkspace -list
25+
script:
26+
- bundle exec rake ci:build[$VERSION]
2427
notifications:
2528
email: false
2629
slack:

Dangerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env ruby
2+
3+
# Sometimes it's a README fix, or something like that - which isn't relevant for
4+
# including in a project's CHANGELOG for example
5+
declared_trivial = pr_title.include? "#trivial"
6+
7+
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
8+
warn("PR is classed as Work in Progress") if pr_title.include? "[WIP]"
9+
10+
# Warn when there is a big PR
11+
warn("Big PR") if lines_of_code > 500
12+
13+
# Don't let testing shortcuts get into master by accident
14+
fail("fdescribe left in tests") if `grep -r fdescribe specs/`.length > 1
15+
fail("fit left in tests") if `grep -r "fit specs/ `.length > 1
16+
17+
# Add a CHANGELOG entry for app changes
18+
if git.lines_of_code > 50 && !github.modified_files.include?("CHANGELOG.md") && !declared_trivial
19+
fail("Please update [CHANGELOG.md](https://github.com/polydice/ICInputAccessory/blob/develop/CHANGELOG.md).")
20+
end
21+
22+
# Ensure a clean commits history
23+
if git.commits.any? { |c| c.message =~ /^Merge branch/ }
24+
fail('Please rebase to get rid of the merge commits in this PR')
25+
end

0 commit comments

Comments
 (0)