forked from OpenIndiana/oi-userland
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dangerfile #3
Closed
Closed
Dangerfile #3
Changes from 35 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
3379397
Add Dangerfile and .travis.yml
xen0l 3a28583
Add Dangerfile and .travis.yml
xen0l b46d397
Add Dangerfile and .travis.yml
xen0l bc9aa30
bump nginx
xen0l 2697dff
nginx: add depend.mk
xen0l aedc8e0
Drop REQUIRED_PACKAGES from bash-completion
xen0l 11e2de5
modify Dangerfile
xen0l d7fef30
Use ruby 2.4
xen0l 5615b40
Use ruby 2.4.1
xen0l 8cbf7b9
Remove Ruby 2.4 features
xen0l acfaed4
Drop bundle
xen0l 0abd410
Fix nginx makefile
xen0l 06b91c7
Switch to github reviews
xen0l 23789d6
warn -> fail
xen0l da2bdbf
Add danger-mention
xen0l d294341
Add danger-mention
xen0l 64183aa
.travis.yml changes
xen0l e4a848e
protect important files
xen0l b06bd8a
Fail based on return code
xen0l 0ae2f70
Disable email notifications
xen0l d9e3c3e
IRC notifications
xen0l 17ff917
before_script -> script
xen0l a6d65d7
IRC notifications
xen0l b7c4eb4
Drop IRC notitications, edit Dangerfile
xen0l 910f599
Drop copyright
xen0l 50939f5
Include links
xen0l cb87b0a
Links rule the world
xen0l 9336b7d
include -> includes
xen0l 54ed6b9
fix build
xen0l 0452bcd
remove convert_to_link
xen0l d436aa1
fix build
xen0l feb8000
Add doc
xen0l a20bc13
Add impl
xen0l 60df222
Bump revision
xen0l da235b9
Modify pkg makefile
xen0l 650fcde
Version/Revision check
xen0l 33f20e0
Remove files from zsh.p5m
xen0l 846438f
Add DEBUG logic
xen0l 85c4e59
Add more documentation
xen0l File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
language: ruby | ||
|
||
script: | ||
- gem install danger --version '~> 4.0' && danger | ||
|
||
notifications: | ||
email: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet | ||
if github.pr_title.include? "WIP" | ||
warn("PR is classed as Work in Progress") | ||
end | ||
|
||
# Ensure a clean commits history | ||
if git.commits.any? { |c| c.message =~ /^Merge branch/ } | ||
fail('Please rebase to get rid of the merge commits in this PR') | ||
end | ||
|
||
# Which parts of the repository did the PR touch? | ||
has_build_system_changes = !git.modified_files.grep(/make-rules\/*.mk/).empty? | ||
has_doc_changes = !git.modified_files.grep(/doc\//).empty? | ||
has_transform_changes = !git.modified_files.grep(/transforms\//).empty? | ||
has_tools_changes = !git.modified_files.grep(/tools\//).empty? | ||
has_component_changes = !git.modified_files.grep(/components\//).empty? | ||
|
||
# Checker functions | ||
def check_depend_mk(file_name) | ||
return !`grep '^include.*depend.mk' #{file_name}`.empty? | ||
end | ||
|
||
def check_BUILD_PKG_DEPENDENCIES(file_name) | ||
return !`grep '^BUILD_PKG_DEPENDENCIES = .*' #{file_name}`.empty? | ||
end | ||
|
||
def check_required_packages(file_name) | ||
return `grep '^REQUIRED_PACKAGES \+= ' #{file_name}`.empty? | ||
end | ||
|
||
def check_ws_make_rules(file_name) | ||
return !`grep '^include .*' #{file_name} | grep -v 'shared-macros.mk' | grep '$(WS_MAKE_RULES)'`.empty? | ||
end | ||
|
||
def check_copyright(file_name) | ||
return !`grep '^# Copyright 2017 <contributor>' #{file_name}`.empty? | ||
end | ||
|
||
# Helper functions | ||
def check_base_file(file_name) | ||
github.review.warn('Please add your copyright to ' + github.html_link(file_name)) if check_copyright(file_name) | ||
end | ||
|
||
def check_component_makefile(file_name) | ||
check_base_file(file_name) | ||
|
||
github.review.fail('Remove depend.mk line from ' + github.html_link(file_name)) if check_depend_mk(file_name) | ||
github.review.fail('Remove BUILD_PKG_DEPENDENCIES line from ' + github.html_link(file_name)) if check_BUILD_PKG_DEPENDENCIES(file_name) | ||
github.review.fail('Switch Makefile includes to use $(WS_MAKE_RULES) variable in ' + github.html_link(file_name)) if check_ws_make_rules(file_name) | ||
github.review.warn('Consider adding REQUIRED_PACKAGES to ' + github.html_link(file_name)) if check_required_packages(file_name) | ||
end | ||
|
||
|
||
github.review.start | ||
|
||
# Component-related checks | ||
if has_component_changes | ||
git.added_files.each do |file_name| | ||
is_dangerfile = file_name.match(/Dangerfile$/) | ||
is_component_makefile = file_name.match(/Makefile$/) | ||
is_component_ips_manifest = file_name.match(/.p5m$/) | ||
is_component_patch = file_name.match(/.patch$/) | ||
is_component_license = file_name.match(/.license$/) | ||
|
||
file_html_link = github.html_link(file_name) | ||
|
||
if is_component_patch | ||
component_makefile = File.join(File.dirname(file_name), 'Makefile') | ||
github.review.fail('Bump COMPONENT_REVISION or COMPONENT_VERSION in ' + convert_to_link(component_makefile) + ' as new patch ' + file_html_link + ' was added') | ||
end | ||
end | ||
|
||
git.modified_files.each do |file_name| | ||
is_travis_cfg = file_name.match(/^\.travis\.yml$/) | ||
is_dangerfile = file_name.match(/Dangerfile$/) | ||
is_vagrantfile = file_name.match(/Vagrantfile$/) | ||
is_component_makefile = file_name.match(/Makefile$/) | ||
is_component_ips_manifest = file_name.match(/.p5m$/) | ||
is_component_patch = file_name.match(/.patch$/) | ||
is_component_license = file_name.match(/.license$/) | ||
|
||
file_html_link = github.html_link(file_name) | ||
|
||
if (is_travis_cfg || is_dangerfile || is_vagrantfile) | ||
github.review.message('This PR touches ' + file_html_link, sticky: false) | ||
end | ||
|
||
if is_component_makefile | ||
check_component_makefile(file_name) | ||
github.review.fail('Bump COMPONENT_REVISION or COMPONENT_VERSION in ' + file_html_link + ' as it was modified') | ||
end | ||
|
||
if is_component_ips_manifest | ||
component_makefile = File.join(File.dirname(file_name), 'Makefile') | ||
github.review.fail('Bump COMPONENT_REVISION or COMPONENT_VERSION in ' + convert_to_link(component_makefile) + ' as IPS manifest ' + file_html_link + ' was modified') | ||
end | ||
end | ||
|
||
git.deleted_files.each do |file_name| | ||
is_travis_cfg = file_name.match(/^\.travis\.yml$/) | ||
is_dangerfile = file_name.match(/Dangerfile$/) | ||
is_vagrantfile = file_name.match(/Vagrantfile$/) | ||
is_component_makefile = file_name.match(/Makefile$/) | ||
is_component_ips_manifest = file_name.match(/.p5m$/) | ||
is_component_patch = file_name.match(/.patch$/) | ||
is_component_license = file_name.match(/.license$/) | ||
|
||
file_html_link = github.html_link(file_name) | ||
|
||
if (is_travis_cfg || is_dangerfile || is_vagrantfile) | ||
github.review.fail('Do not remove ' + File.basename(file_name), sticky: false) | ||
end | ||
|
||
if is_component_patch | ||
github.review.fail('Bump COMPONENT_REVISION or COMPONENT_VERSION as ' + file_html_link + ' was dropped') | ||
end | ||
end | ||
end | ||
|
||
github.review.submit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Automated reviews of oi-userland | ||
|
||
This file contains a list of all checks currently being controlled in [Dangerfile](https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/doc/automated-reviews.md). Comments are divided into the following categories: | ||
|
||
* **component changes** - any change in [components/](https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components) directory | ||
* **documentation changes** - any change in [doc/](https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/doc) directory | ||
* **build system changes** - any change in [make-rules/](https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/make-rules) directory | ||
* **tools changes** - any change in [tools/](https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/tools) directory | ||
* **transform changes** - change in [transforms/](https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/doc) directory | ||
|
||
Currently, only component, documentation and build system changes are being reviewed. The aim of these checks is to offload developers | ||
from reviews and enforce unified style of oi-userland assets, e.g. Makefiles. | ||
|
||
## Implementation | ||
|
||
Automated reviews are implemented via [Dangerfile](https://danger.systems) and [Travis CI](https://www.travis-ci.org), which is run | ||
for every new PR opened. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do we check that COMPONENT_REVISION or COMPONENT_VERSION was bumped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nowhere, right now. I am still checking out options. I need to find out a good way how to get this information across different commits (COMPONENT_VERSION can consist of other variables, so gmake print-COMPONENT_VERSION have to be used, but I am not sure how to do it nicely over different commits).
For now, I am trying to keep things simple and emit warning once there is a reason for bumping COMPONENT_REVISION. Are you OK with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Can you check if COMPONENT_REVISION starts with "$(shell" ?