GitLab CI

To use FlowCov with GitLab CI, you need to integrate it into your existing build pipeline, as an additional command after your build. 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 masked environment variables in your project or group. That way everyone can use it, but it's not possible to copy and abuse them.

You can find the required steps to encrypt environment variables in the GitLab CI 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.

- 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 .gitlab-ci.yml in your repository's root directory. It will then automatically be run the next time you push a commit.

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

.gitlab-ci.yml
image: circleci/openjdk:11-jdk
stages:
- build
build:
stage: build
script:
- ./gradlew build
- bash <(curl -s https://bash.flowcov.io)