Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
umbrella

GitHub Action

DeepSource Test Coverage Action

v1.1.1

DeepSource Test Coverage Action

umbrella

DeepSource Test Coverage Action

GitHub Action that uploads test coverage reports to DeepSource for the Test Coverage analyzer

Installation

Copy and paste the following snippet into your .yml file.

              

- name: DeepSource Test Coverage Action

uses: deepsourcelabs/test-coverage-action@v1.1.1

Learn more about this action in deepsourcelabs/test-coverage-action

Choose a version

DeepSource Test Coverage Action

DeepSource

GitHub Action that enables you to upload your test coverage data to DeepSource easily. You must have the Test Coverage analyzer enabled on your repository for reporting to work. Please refer to the .deepsource.toml configuration reference for details.

If you're not using DeepSource yet, get started for free.

Notice

If you’re using the Test coverage action, we recommend switching to using the DeepSource CLI directly. To do this, rather than using the test-coverage-action step, you can do the following:

steps:
  - name: Checkout code
    uses: actions/checkout@v2
    with:
      ref: ${{ github.event.pull_request.head.sha }}

  # Run your tests here ...

  - name: Report test-coverage to DeepSource
    run: |
      # Install the CLI
      curl https://deepsource.io/cli | sh

      # Send the report to DeepSource
      ./bin/deepsource report --analyzer test-coverage --key <language> --value-file <path/to/coverage/file>

If you want to continue using the Test coverage action, please add a step before the test coverage action, to add a safe.directory parameter to your .gitconfig:

steps:
  - name: Checkout code
    uses: actions/checkout@v2
    with:
      fetch-depth: 50
      ref: ${{ github.event.pull_request.head.sha }}

  # ADD THIS STEP
  - name: Add git safe.directory for container
    run: |
      mkdir -p /home/runner/work/_temp/_github_home
      printf "[safe]\ndirectory = /github/workspace" > /home/runner/work/_temp/_github_home/.gitconfig

  - name: Report test-coverage to DeepSource
    uses: deepsourcelabs/test-coverage-action@master
    with:
      ... The rest of your config is explained in Usage section.

Read this Discuss post for more information.

Usage

This Action assumes that the coverage file has already been generated after the tests have run. To integrate it in your workflow, define a step which refers to this Action in your workflow.yml file. We recommend that you use @master as the ref.

Ensure that you have added the DEEPSOURCE_DSN secret in your GitHub repository. It is available under Settings → Reporting tab of the repository page on DeepSource.

steps:
  - name: Report test coverage to DeepSource
    uses: deepsourcelabs/test-coverage-action@master
    with:
      key: python
      coverage-file: coverage.xml
      dsn: ${{ secrets.DEEPSOURCE_DSN }}

The possible inputs to this action are:

  • key (string, required): Programming language shortcode for which coverage is reported. e.g. python, go, javascript. See the docs for the current list of allowed values.
  • coverage-file (string, required): Path to the coverage data file. e. g. coverage.xml
  • dsn (string, required): DeepSource DSN of this repository.
  • fail-ci-on-error (boolean): Should the CI build fail if there is an error while uploading the report to DeepSource? Allowed values are: true, false. This is set to false by default.

License

This project is released under the MIT License.