0.2.32 • Published 1 year ago

@backstage/plugin-code-coverage-backend v0.2.32

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

code-coverage-backend

This is the backend part of the code-coverage plugin. It takes care of processing various coverage formats and standardizing them into a single json format, used by the frontend.

Configuring your entity

In order to use this plugin, you must set the backstage.io/code-coverage annotation.

metadata:
  annotations:
    backstage.io/code-coverage: enabled

There's a feature to only include files that are in VCS in the coverage report, this is helpful to not count generated files for example. To enable this set the backstage.io/code-coverage annotation to scm-only.

metadata:
  annotations:
    backstage.io/code-coverage: scm-only

Note: It may be required to set the backstage.io/source-location annotation, however this should generally not be needed.

API

Adding a Cobertura report

POST a Cobertura XML file to /report

Example:

// curl -X POST -H "Content-Type:text/xml" -d @cobertura.xml "localhost:7000/api/code-coverage/report?entity=component:default/entity-name&coverageType=cobertura"
{
  "links": [
    {
      "href": "http://localhost:7000/api/code-coverage/report?entity=component:default/entity-name",
      "rel": "coverage"
    }
  ]
}

Adding a JaCoCo report

POST a JaCoCo XML file to /report

Example:

// curl -X POST -H "Content-Type:text/xml" -d @jacoco.xml "localhost:7000/api/code-coverage/report?entity=component:default/entity-name&coverageType=jacoco"
{
  "links": [
    {
      "href": "http://localhost:7000/api/code-coverage/report?entity=component:default/entity-name",
      "rel": "coverage"
    }
  ]
}

Reading json coverage

GET /report

Example:

// curl localhost:7000/api/code-coverage/report?entity=component:default/entity-name
{
  "aggregate": {
    "branch": {
      "available": 0,
      "covered": 0,
      "missed": 0,
      "percentage": 0
    },
    "line": {
      "available": 5,
      "covered": 4,
      "missed": 1,
      "percentage": 80
    }
  },
  "entity": {
    "kind": "Component",
    "name": "entity-name",
    "namespace": "default"
  },
  "files": [
    {
      "branchHits": {},
      "filename": "main.go",
      "lineHits": {
        "117": 12,
        "142": 8,
        "34": 8,
        "42": 0,
        "58": 6
      }
    }
  ]
}

Coverage history

GET /history

Example

// curl localhost:7000/api/code-coverage/history?entity=component:default/entity-name
{
  "entity": {
    "kind": "Component",
    "name": "entity-name",
    "namespace": "default"
  },
  "history": [
    {
      "branch": {
        "available": 0,
        "covered": 0,
        "missed": 0,
        "percentage": 0
      },
      "line": {
        "available": 299,
        "covered": 116,
        "missed": 183,
        "percentage": 38.8
      },
      "timestamp": 1615490766141
    },
    {
      "branch": {
        "available": 0,
        "covered": 0,
        "missed": 0,
        "percentage": 0
      },
      "line": {
        "available": 299,
        "covered": 116,
        "missed": 183,
        "percentage": 38.8
      },
      "timestamp": 1615406307929
    }
  ]
}
0.2.32

1 year ago

0.2.31

1 year ago

0.2.31-next.1

1 year ago

0.2.31-next.0

1 year ago

0.2.30

1 year ago

0.2.29

1 year ago

0.2.28

1 year ago

0.2.28-next.2

1 year ago

0.2.28-next.1

1 year ago

0.2.27

1 year ago

0.2.27-next.0

1 year ago

0.2.26

1 year ago

0.2.25

1 year ago

0.2.24

1 year ago

0.2.24-next.3

1 year ago

0.2.24-next.2

1 year ago

0.2.24-next.1

1 year ago

0.2.24-next.0

1 year ago

0.2.23

1 year ago

0.2.23-next.2

1 year ago

0.2.23-next.1

1 year ago

0.2.23-next.0

1 year ago

0.2.22

1 year ago

0.2.22-next.3

2 years ago

0.2.22-next.2

2 years ago

0.2.22-next.1

2 years ago

0.2.19-next.0

2 years ago

0.2.19-next.1

2 years ago

0.2.20-next.2

2 years ago

0.2.17-next.2

2 years ago

0.2.17-next.3

2 years ago

0.2.17-next.1

2 years ago

0.2.14-next.1

2 years ago

0.2.14-next.2

2 years ago

0.2.14-next.0

2 years ago

0.2.21-next.0

2 years ago

0.2.21-next.2

2 years ago

0.2.21-next.1

2 years ago

0.2.16-next.0

2 years ago

0.2.22-next.0

2 years ago

0.2.21

2 years ago

0.2.20

2 years ago

0.2.19

2 years ago

0.2.18

2 years ago

0.2.17

2 years ago

0.2.16

2 years ago

0.2.15

2 years ago

0.2.14

2 years ago

0.2.13

2 years ago

0.2.13-next.0

2 years ago

0.2.12

2 years ago

0.2.12-next.2

2 years ago

0.2.12-next.3

2 years ago

0.2.11-next.1

2 years ago

0.2.11

2 years ago

0.2.12-next.1

2 years ago

0.2.12-next.0

2 years ago

0.2.10-next.3

2 years ago

0.2.11-next.0

2 years ago

0.2.10

2 years ago

0.2.9-next.1

2 years ago

0.2.9-next.2

2 years ago

0.2.9-next.0

2 years ago

0.2.10-next.2

2 years ago

0.2.10-next.1

2 years ago

0.2.10-next.0

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.8-next.1

2 years ago

0.2.8-next.0

2 years ago

0.2.8-next.2

2 years ago

0.2.6-next.1

2 years ago

0.2.6-next.2

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5-next.0

3 years ago

0.2.5-next.2

3 years ago

0.2.5-next.1

3 years ago

0.2.5-next.3

2 years ago

0.2.4-next.0

3 years ago

0.2.4-next.1

3 years ago

0.2.6-next.0

2 years ago

0.2.3

3 years ago

0.2.5

2 years ago

0.2.4

3 years ago

0.2.3-next.2

3 years ago

0.2.3-next.1

3 years ago

0.2.3-next.0

3 years ago

0.2.2-next.2

3 years ago

0.2.2-next.1

3 years ago

0.2.2-next.0

3 years ago

0.2.2

3 years ago

0.1.32-next.0

3 years ago

0.1.32-next.1

3 years ago

0.1.32-next.2

3 years ago

0.2.0-next.3

3 years ago

0.1.31-next.0

3 years ago

0.1.31-next.2

3 years ago

0.1.31-next.1

3 years ago

0.2.1-next.0

3 years ago

0.1.31

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.30

3 years ago

0.1.30-next.0

3 years ago

0.1.30-next.1

3 years ago

0.1.29-next.0

3 years ago

0.1.29-next.1

3 years ago

0.1.27

3 years ago

0.1.28

3 years ago

0.1.29

3 years ago

0.1.27-next.0

3 years ago

0.1.26

3 years ago

0.1.21-next.0

3 years ago

0.1.20

3 years ago

0.1.21

3 years ago

0.1.22

3 years ago

0.1.23

3 years ago

0.1.24

3 years ago

0.1.25

3 years ago

0.1.17

3 years ago

0.1.18

3 years ago

0.1.19

3 years ago

0.1.20-next.0

3 years ago

0.1.22-next.0

3 years ago

0.1.15

4 years ago

0.1.16

4 years ago

0.1.12

4 years ago

0.1.13

4 years ago

0.1.14

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago