CircleCI

To use FlowCov with CircleCI, you need to integrate it into your existing build pipeline, as one step after the build has finished. In this document we will outline the steps required to do so.

Secret Management

You should only ever store your credentials, in this case your API Key and optionally your Repository ID, as secretly stored environment variables. That way everyone can use it, but it's not possible to copy and abuse them.

You can find the required steps to create a context containing secret environment variables in the CircleCI documentation. In this document, we will assume that you stored them as environment variables with the following names:

  • FLOWCOV_API_KEY
  • FLOWCOV_REPOSITORY_ID

Integrate it into an existing pipeline

You can use the following snippet and integrate it into your existing build pipeline to upload the coverage reports after the build has finished. Remember to reference the context containing your environment variables created above.

.circleci/config.yml
- run: bash <(curl -s https://bash.flowcov.io)

This snippet downloads the latest version of the script, and executes it using the API key and repository ID provided in the environment variables described above.

Creating a new pipeline

If you don't have a pipeline definition yet, you can use the following instead. Store it as a new file called .circleci/config.yml in your repository's root directory. It will then automatically be run the next time you push a commit, if you have connected your repository with CircleCI. Consult the CircleCI documentation for more information on that topic.

It builds your source code first, then executes the script as described above.

.circleci/config.yml
version: 2.1
workflows:
examples:
jobs:
- build:
context: flowcov
jobs:
build:
docker:
- image: circleci/openjdk:11-jdk
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx3200m
TERM: dumb
steps:
- checkout
- run: gradle build
- run: bash <(curl -s https://bash.flowcov.io)