Knowledge Base: The Devver API
One of the ways Devver seeks to serve the needs of developers is by offering a simple API to control and query our distributed testing services. The API as it stands now is still in its infancy. We plan on expanding it though, and we welcome feedback. Please let us know what YOU are looking for in a Devver API.
The Devver API is HTTP-based. In its current form it offers a single service: a GitHub-compatible web hook which will trigger Devver to do a continuous integration-style build of your project, and email you the results.
Integrating Devver with GitHub
Integrating Devver and GitHub currently takes several steps. We plan on simplifying this process in the future.
- Initialize your project by installing the Devver gem according
to the instructions you
received when you created your Devver account, and running
devver --init --key [API_KEY]in the project's root directory. - Edit the file
.devver/hooks/notify, and replace the text "YOUR_EMAIL_GOES_HERE" with the address you want to be notified at when Devver completes a build. - Edit the file
.devver/hooks/buildand verify it runs the appropriate command to build your project. - Open
.devver/hooks/prepare_databaseand insertrake db:schema:loadright above the line that readsrake RAILS_ENV=test db:schema:load - You may also want to check the contents of the
install_dependencieshook to verify it is compatible with your project. See the hooks documentation for more information on project hooks. - If your project requires a database, create a file named
.devver/database.example.yml. This file should contain an entry for a 'test' database similar to Code Snippet 1 (below). Note that theadapterentry can be eithermysql,postgresql, orsqlite3(our supported database adapter types). - If you've added
.devverto your.gitignorefile (which is recommended), add!.devver/database.example.ymland!.devver/hooks/to your.gitignore - Commit
.devver/database.example.ymland the.devver/hooksdirectory to git; and push the commit to GitHub (see Code Snippet 2 below). - Acquire a Devver Project ID by running
devver --project-id(ordevver --project_idon older clients) - Add a Post-Receive hook
to your GitHub project, with the form:
http://services.devver.net/projects/[PROJECT_ID]/runs, where[PROJECT_ID]is the Project ID given in the previous step. - You're done! The next time you push a commit to GitHub, we'll
pull the code, run the command you set up in the
buildhook, and email you the results (you can also test the hook by clicking the 'Test Hook' link when configuring the Post-Receive URL).
Code Snippet 1
test:
adapter: mysql
Code Snippet 2
git add .devver/database.example.yml
git add .devver/hooks
git commit -a -m "Added files for Devver API"
git push origin master # Note: You may need to push to a different remote branch, depending on your setup