Skip to content
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
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3379397
Add Dangerfile and .travis.yml
xen0l Apr 3, 2017
3a28583
Add Dangerfile and .travis.yml
xen0l Apr 3, 2017
b46d397
Add Dangerfile and .travis.yml
xen0l Apr 3, 2017
bc9aa30
bump nginx
xen0l Apr 3, 2017
2697dff
nginx: add depend.mk
xen0l Apr 3, 2017
aedc8e0
Drop REQUIRED_PACKAGES from bash-completion
xen0l Apr 3, 2017
11e2de5
modify Dangerfile
xen0l Apr 3, 2017
d7fef30
Use ruby 2.4
xen0l Apr 3, 2017
5615b40
Use ruby 2.4.1
xen0l Apr 3, 2017
8cbf7b9
Remove Ruby 2.4 features
xen0l Apr 3, 2017
acfaed4
Drop bundle
xen0l Apr 3, 2017
0abd410
Fix nginx makefile
xen0l Apr 3, 2017
06b91c7
Switch to github reviews
xen0l Apr 3, 2017
23789d6
warn -> fail
xen0l Apr 3, 2017
da2bdbf
Add danger-mention
xen0l Apr 3, 2017
d294341
Add danger-mention
xen0l Apr 3, 2017
64183aa
.travis.yml changes
xen0l Apr 3, 2017
e4a848e
protect important files
xen0l Apr 3, 2017
b06bd8a
Fail based on return code
xen0l Apr 3, 2017
0ae2f70
Disable email notifications
xen0l Apr 3, 2017
d9e3c3e
IRC notifications
xen0l Apr 3, 2017
17ff917
before_script -> script
xen0l Apr 3, 2017
a6d65d7
IRC notifications
xen0l Apr 3, 2017
b7c4eb4
Drop IRC notitications, edit Dangerfile
xen0l Apr 3, 2017
910f599
Drop copyright
xen0l Apr 4, 2017
50939f5
Include links
xen0l Apr 4, 2017
cb87b0a
Links rule the world
xen0l Apr 4, 2017
9336b7d
include -> includes
xen0l Apr 4, 2017
54ed6b9
fix build
xen0l Apr 4, 2017
0452bcd
remove convert_to_link
xen0l Apr 4, 2017
d436aa1
fix build
xen0l Apr 4, 2017
feb8000
Add doc
xen0l Apr 11, 2017
a20bc13
Add impl
xen0l Apr 11, 2017
60df222
Bump revision
xen0l Apr 11, 2017
da235b9
Modify pkg makefile
xen0l Apr 11, 2017
650fcde
Version/Revision check
xen0l Apr 11, 2017
33f20e0
Remove files from zsh.p5m
xen0l Apr 11, 2017
846438f
Add DEBUG logic
xen0l Apr 11, 2017
85c4e59
Add more documentation
xen0l Apr 20, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: ruby

before_script:
- gem install danger --version '~> 4.0'

script:
- danger
96 changes: 96 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# 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 ' + file_name) if check_copyright(file_name)
end

def check_component_makefile(file_name)

check_base_file(file_name)

github.review.warn('Remove depend.mk line from ' + file_name) if check_depend_mk(file_name)
github.review.warn('Remove BUILD_PKG_DEPENDENCIES line from ' + file_name) if check_BUILD_PKG_DEPENDENCIES(file_name)
github.review.warn('Switch Makefile include to use $(WS_MAKE_RULES) variable in ' + file_name) if check_ws_make_rules(file_name)
github.review.warn('Consider adding REQUIRED_PACKAGES to ' + 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_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$/)
end

git.modified_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$/)

if is_component_makefile
check_component_makefile(file_name)
github.review.warn('Bump COMPONENT_REVISION or COMPONENT_VERSION in ' + file_name + ' as it was modified')
end

if is_component_ips_manifest
component_makefile = File.join(File.dirname(file_name), 'Makefile')
github.review.warn('Bump COMPONENT_REVISION or COMPONENT_VERSION in ' + component_makefile + ' as IPS manifest ' + file_name + ' was modified')
end
end

git.deleted_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$/)

if is_component_patch
github.review.warn('Bump COMPONENT_REVISION or COMPONENT_VERSION as ' + file_name + ' was dropped')
end
end
end

github.review.submit
2 changes: 0 additions & 2 deletions components/shell/bash-completion/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,3 @@ install: $(INSTALL_32)
BUILD_PKG_DEPENDENCIES = $(BUILD_TOOLS)

include $(WS_MAKE_RULES)/depend.mk

REQUIRED_PACKAGES += shell/bash
2 changes: 1 addition & 1 deletion components/web/nginx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
include ../../../make-rules/shared-macros.mk

COMPONENT_NAME= nginx
COMPONENT_VERSION= 1.11.12
COMPONENT_VERSION= 1.11.13
COMPONENT_LICENSE= BSD
COMPONENT_PROJECT_URL= http://nginx.net/
COMPONENT_SUMMARY= Nginx Webserver
Expand Down