Build on Github Pull Request
It is convenient to have a test build executed when a pull request is submitted to the sim-recon repository on GitHub, to make sure that the software still compiles correctly with the proposed changes. This is done using the webhooks feature of github, which allows for the triggering of external programs when certain actions are performed on the GitHub repository.
- Create webhook
- Go to repository: Settings -> Webhooks & Services -> Add webhook
- Set URL to location of script on halldweb
- Request JSON data
- Only trigger on pull requests
- Set up script on halldweb
- Install python modules: web.py, flup, requests
- Have simple wrapper script: basic idea is that it gets called every time there is a pull request. Only build on open or reopen of pull request. Extract the branch belonging to the pull request and build it
- example on how to check out a particular branch: "git clone https://github.com/sdobbs/sim-recon.git --branch test2 --single-branch" clones branch "test2" to directory "sim-recon"
- sanity checks for input?
- Need shell script that does the build and access to the build logs
- possible sanity check: parse output of "git branch" and make sure that the requested branch is legitimate
- Report results
- Look at build logs - extract errors
- Report errors or lack thereof via comment on pull request
- Need to store github credentials - personal access token? store in local .config file that can't be seen from the web? whose account?