aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkongr45gpen <electrovesta@gmail.com>2016-12-07 19:35:39 +0200
committerkongr45gpen <electrovesta@gmail.com>2016-12-07 19:35:39 +0200
commit8b9f59ba944eb5291e8700c1af24310d22857e23 (patch)
treef7b990886a8626c9e2db5f66a6a12a634e319baa
parentf161a009ceeb3970f5bed2bc569bb0696e2001c8 (diff)
downloadsupybot_github-8b9f59ba944eb5291e8700c1af24310d22857e23.tar.gz
supybot_github-8b9f59ba944eb5291e8700c1af24310d22857e23.tar.bz2
supybot_github-8b9f59ba944eb5291e8700c1af24310d22857e23.zip
Add support for AppVeyor notifications
Implements #12
-rw-r--r--__init__.py2
-rw-r--r--local/handler/AppVeyorHandler.py13
-rw-r--r--local/handler/GithubHandler.py3
-rw-r--r--samples/appveyor.json51
-rw-r--r--test.py14
5 files changed, 83 insertions, 0 deletions
diff --git a/__init__.py b/__init__.py
index 953dd50..92c68a6 100644
--- a/__init__.py
+++ b/__init__.py
@@ -39,6 +39,7 @@ import local.handler.StatusHandler
import local.handler.TravisHandler
import local.handler.MessageHandler
import local.handler.ReleaseHandler
+import local.handler.AppVeyorHandler
import local.handler.CreateDeleteHandler
import local.handler.IssueCommentHandler
import local.theme.Theme
@@ -55,6 +56,7 @@ reload(local.handler.StatusHandler)
reload(local.handler.TravisHandler)
reload(local.handler.MessageHandler)
reload(local.handler.ReleaseHandler)
+reload(local.handler.AppVeyorHandler)
reload(local.handler.CreateDeleteHandler)
reload(local.handler.IssueCommentHandler)
reload(local.theme.Theme)
diff --git a/local/handler/AppVeyorHandler.py b/local/handler/AppVeyorHandler.py
new file mode 100644
index 0000000..f60fece
--- /dev/null
+++ b/local/handler/AppVeyorHandler.py
@@ -0,0 +1,13 @@
+from ..utility import *
+
+def handle(data, theme):
+ if isStatusVisible(data['eventData']['projectId'], data['eventData']['status'].lower()):
+ theme.travis(
+ branch = data['eventData']['branch'],
+ repo = data['eventData']['repositoryName'].split('/')[1],
+ status = data['eventData']['status'],
+ commitId = data['eventData']['commitId'],
+ commitMessage = data['eventData']['commitMessage'],
+ commitAuthor = data['eventData']['commitAuthor'],
+ buildUrl = getShortURL(data['eventData']['buildUrl'])
+ )
diff --git a/local/handler/GithubHandler.py b/local/handler/GithubHandler.py
index 6b2dd30..ce6edd2 100644
--- a/local/handler/GithubHandler.py
+++ b/local/handler/GithubHandler.py
@@ -35,6 +35,7 @@ import StatusHandler
import TravisHandler
import MessageHandler
import ReleaseHandler
+import AppVeyorHandler
import CreateDeleteHandler
import IssueCommentHandler
@@ -178,6 +179,8 @@ class GithubHandler(BaseHTTPServer.BaseHTTPRequestHandler):
PingHandler.handle(data, theme)
elif 'message' in data:
MessageHandler.handle(data, theme)
+ elif 'eventName' in data:
+ AppVeyorHandler.handle(data, theme)
else:
theme.unknown(eventType)
diff --git a/samples/appveyor.json b/samples/appveyor.json
new file mode 100644
index 0000000..7e4c5c5
--- /dev/null
+++ b/samples/appveyor.json
@@ -0,0 +1,51 @@
+{
+ "eventData": {
+ "branch": "pullr1",
+ "buildId": 6010485,
+ "buildNumber": 2,
+ "buildUrl": "https://ci.appveyor.com/project/kongr45gpen/test/build/1.0.2",
+ "buildVersion": "1.0.2",
+ "commitAuthor": "alezakos",
+ "commitAuthorEmail": "electrovesta@gmail.com",
+ "commitAuthorUsername": "kongr45gpen",
+ "commitDate": "10/10/2016 7:39 PM",
+ "commitId": "3be0d004b9",
+ "commitMessage": "Update README.md",
+ "commitMessageExtended": "",
+ "commitUrl": "https://github.com/kongr45gpen/test/commit/3be0d004b9",
+ "committerEmail": "noreply@github.com",
+ "committerName": "GitHub",
+ "duration": "00:00:03.7343550",
+ "failed": true,
+ "finished": "12/7/2016 5:08 PM",
+ "isPullRequest": false,
+ "jobs": [
+ {
+ "artifacts": [],
+ "compilationMessages": [],
+ "duration": "00:00:03.9843642",
+ "failed": true,
+ "finished": "12/7/2016 5:08 PM",
+ "id": "e80o7hecyuqcb89k",
+ "messages": [],
+ "messagesError": 0,
+ "messagesTotal": 0,
+ "name": "",
+ "passed": false,
+ "started": "12/7/2016 5:08 PM",
+ "status": "Failed"
+ }
+ ],
+ "messages": [],
+ "notificationSettingsUrl": "https://ci.appveyor.com/notifications",
+ "passed": false,
+ "projectId": 261821,
+ "projectName": "test",
+ "repositoryName": "kongr45gpen/test",
+ "repositoryProvider": "gitHub",
+ "repositoryScm": "git",
+ "started": "12/7/2016 5:08 PM",
+ "status": "failed"
+ },
+ "eventName": "build_failure"
+} \ No newline at end of file
diff --git a/test.py b/test.py
index 7c455a6..e52e099 100644
--- a/test.py
+++ b/test.py
@@ -84,6 +84,20 @@ class GithubTestCase(ExpectationPluginTestCase):
self.assertError('get second message')
+ def testAppVeyor(self):
+ self.sendRequest('appveyor')
+
+ self.describe('first message',
+ it().should.contain('pullr1 @ test'),
+ it().should.contain('failed'),
+ it().should.contain('3be0d'),
+ it().should.contain('alezakos'),
+ it().should.contain('Update README.md'),
+ it().should.contain('https://ci.appveyor.com/project/kongr45gpen/test/build/1.0.2')
+ )
+
+ self.assertError('get second message')
+
def testCreateTag(self):
self.sendRequest('create-tag')

© 2014-2024 Faster IT GmbH | imprint | privacy policy