Hi,

I need some help with figuring out how to implement robust pull
requests testing with sympy-bot.

The webapp at reviews.sympy.org (the source code of which is in the
"web" directory of sympy-bot)
has a database of all pull requests, and I can quite easily implement
almost any interaction between
the sympy-bot and the app. The idea is that the webapp's database has
and up-to-date information
about all pull requests and since it is under our control, we can
easily implement any interaction
with the sympy-bot. That seems like a very robust model to me.

The problem is that the database is currently updated by polling the
github API periodically by recursively
going over all pull requests and comparing any changes against our
database (so it's a lot of traffic,
lots of github API requests and a lot of database accesses). Recently
we were running over various app engine quota, so I had to eventually
lower the polling period to
once or twice a day. Not very good.

What is the best way to notify our app, that

a) a new pull request was created
b) a new commit was pushed into the pull request

? I was hoping to use github webhooks
(https://help.github.com/articles/post-receive-hooks), but it seems
that
only notifies us of pushing into the "master" of the sympy repository.
Another option are "Events"
(http://developer.github.com/v3/events/), for example here is a list
of such events for the sympy repo:

http://hurl.it/hurls/999dedbb7a1221912b5dcbea69d8b8b5b235a955/f6e36af68fd5b39d97b4d84cd12a067184f3ec92

it shows all recent changes in issues. It's a simple request, so we
can poll it let's say every 5 minutes
and keep an updated list of changes in our database. This should be
very lightweight.
>From this list, we should be able to determine both a) and b) above.

Update: so actually one should be able to register these "hooks" here:

http://developer.github.com/v3/repos/hooks/

I am not quite sure currently how this is related to the old "hooks"
above, but at least from the docs this
should do exactly what we need --- we would listen to these hooks and
simply trigger a build whenever
there is a push of a new commit to the pull request

And so the way I see it is that the first iteration would be to
implement "sympy-bot work", which would
connect to our webapp, and whenever there is a new pull request or any
new commit, or
a *comment* with a specific command like "sympy-bot test", it would
simply run all tests on the pull request
(just like it does now).

Anyone is then free to run such sympy-bot in the "work" mode. I don't
think we have to worry about spam here,
because you still have to use your github credentials to post any comments.

------------------------------------------

So here is my proposed step by step TODO list:

1) Implement "sympy-bot work" with the following features:
It would poll the github API directly (as often as the rate limiting
of the github API allows) and it would
listen to 3 types of events:

1a) new pull request created
1b) new commit pushed into the pull request
1c) A comment (by anybody) of the exact text "sympy-bot test"

It would trigger a test and report to the pull request just as it is
now. The 1c) feature allows us to
easily test older pull requests manually, while 1a) and 1b) will
automatically test new pull requests.

2) I will leave such sympy-bot running for Python 3.2 and Python 2.7
on my linode. Other people
can keep it running on their hardware.

3) After the above works well, we can setup automatic hooks to our
webapp, and manage all such
changes centrally by the webapp, and the sympy-bot would simply stay
connected to the webapp
without having to periodically poll the github API.

-----------------


If anybody wants to help out with 1), that would be a huge help. I
think it should be relatively easy to implement
and it would allow us to automatically test all pull requests. I can
then setup 2). Finally, maybe later
we can implement 3), but that's not a big deal now.

Ondrej

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to