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.

  1. 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.
  2. 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.
  3. Edit the file .devver/hooks/build and verify it runs the appropriate command to build your project.
  4. Open .devver/hooks/prepare_database and insert rake db:schema:load right above the line that reads rake RAILS_ENV=test db:schema:load
  5. You may also want to check the contents of the install_dependencies hook to verify it is compatible with your project. See the hooks documentation for more information on project hooks.
  6. 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 the adapter entry can be either mysql, postgresql, or sqlite3 (our supported database adapter types).
  7. If you've added .devver to your .gitignore file (which is recommended), add !.devver/database.example.yml and !.devver/hooks/ to your .gitignore
  8. Commit .devver/database.example.yml and the .devver/hooks directory to git; and push the commit to GitHub (see Code Snippet 2 below).
  9. Acquire a Devver Project ID by running devver --project-id (or devver --project_id on older clients)
  10. 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.
  11. 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 build hook, 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