Skip to content

danhper/opencov

Repository files navigation

OpenCov

Build Status Coverage Status

OpenCov is a self-hosted opensource test coverage history viewer. It is (mostly) compatible with coveralls, so most coverage tools will work easily.

Demo and screenshots

A demo is available at http://demo.opencov.com, you can create an account or login with

For "security" reasons, the user is not admin. NOTE: the demo is on a Heroku free dyno, so it may not always be available and might be very slow.

Projects list

projects

Project page

project page

Build page

build page

Coverage page

coverage page

Admin panel

admin panel

Deploying the application

Configuring

First, you will need to at least setup a database To configure the app, create a local.exs file and override the configuration you need. Check config/local.sample.exs to see the available configurations.

Using docker

With an existing database

If you already have a database to use, you can simply start the application using docker:

Setup database, run migrations and seeds

$ docker run --rm -v /absolute/path/to/local.exs:/opencov/config/local.exs danhper/opencov mix ecto.setup

Execute Phoenix Server

$ docker run -v /absolute/path/to/local.exs:/opencov/config/local.exs danhper/opencov

This will start the server on the port you set in local.exs.

With docker-compose

If you do not have a database, you can start one with docker and docker-compose. See docker-compose.yml for a sample docker-compose.yml file.

Once you have your docker-compose.yml and local.exs ready, you can run

$ docker-compose run opencov mix ecto.setup
$ docker-compose up

Manually

$ git clone https://github.com/danhper/opencov.git
$ cd opencov
$ cp /path/to/local.exs config/local.exs # local.exs must be in the `config` directory of the app

$ npm install # (or yarn install)
$ mix deps.get
$ mix ecto.setup
$ mix phoenix.server

This should start OpenCov at port 4000.

If you want to setup the server for production, you will need to run the above commands with MIX_ENV=prod and to run

$ mix assets.compile

before starting the server.

Deploying to Heroku

You should also be able to deploy to Heroku by simply git pushing this repository. You will need to set the following environment variables using heroku config:set

  • OPENCOV_PORT
  • OPENCOV_SCHEME
  • SECRET_KEY_BASE
  • SMTP_USER
  • SMTP_PASSWORD

You will need to run

$ heroku run mix ecto.setup

before you can use your application.

Default user

In all setups, mix ecto.setup creates the following admin user

You should use it for your first login and the change the email and password.

Sending test metrics

A few languages are documented in the wiki. For other languages, coveralls instructions should work out of the box, you just need to set the URL to your OpenCov server and to explicitly set the token, even when using Travis.

Development status

The application is more or less stable. I have been using it for a little while now with coverage data from the 4 languages in the Wiki.

The main missing feature is the ability to send coverage status on pull requests. The implementation is started in the integrations branch but I could not find the time to finish it yet.

I am open to any other suggestions, and help is very welcome.