Last Updated: February 25, 2016
·
595
· captn3m0

Upload your build artifacts or coverage reports to Dropbox for free

Most CI services recommend you to use S3 or rsync as a way to store your coverage reports, or build artifacts. Instead, I decided to use Dropbox as a free and easy way.

This was done with a Rails project.

This has the additional advantage that you can share that particular dropbox directory with the team and everyone gets the latest version, automatically.

Steps

  1. Create a new dropbox app via https://www.dropbox.com/developers/apps/ (Make it a app restricted to its folder)
  2. gem install dbox (on your local machine)
  3. Generate an access token using instructions on https://github.com/kenpratt/dbox
  4. Export all 4 DROPBOX_ variables to your CI server and your laptop (temporarily)
  5. Run dbox create coverage to create a coverage directory in your app folder on dropbox. Do this locally.
  6. Run your test cases once (locally)
  7. cp -r html/* coverage/ # Assuming your coverage report is in html/ directory
  8. cd coverage && dbox push # first push
  9. Write an after_build script on CI server, which uploads to dbox using the following command
# Upload our coverage to dropbox
gem install dbox
dbox clone coverage
rm -rf coverage/assets/ # Delete any directories
mv coverage/* coverage/ # Copy all files
mv coverage/.[!.]* coverage/ # Move hidden files
cd coverage
dbox push

This is just the basic gist. Feel free to modify as per your needs. Comment below if you face any issues implementing this.

*PS: * A restricted app folder cannot be shared as per Dropbox limitations. Instead what I have done is set up a symlink on my local machine as `Dropbox/appcoverage -> Dropbox/Apps/appcoverage/coverage/. This means my colleagues only get the latest coverage reports if my machine is running dropbox. However, its better than creating an unsandboxed app on Dropbox.