0.2.32 • Published 18 days ago

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

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
18 days 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

21 days ago

0.2.31

24 days ago

0.2.31-next.1

1 month ago

0.2.31-next.0

1 month ago

0.2.30

1 month ago

0.2.29

2 months ago

0.2.28

2 months ago

0.2.28-next.2

2 months ago

0.2.28-next.1

2 months ago

0.2.27

2 months ago

0.2.27-next.0

2 months ago

0.2.26

3 months ago

0.2.25

3 months ago

0.2.24

3 months ago

0.2.24-next.3

3 months ago

0.2.24-next.2

3 months ago

0.2.24-next.1

3 months ago

0.2.24-next.0

4 months ago

0.2.23

4 months ago

0.2.23-next.2

4 months ago

0.2.23-next.1

4 months ago

0.2.23-next.0

5 months ago

0.2.22

5 months ago

0.2.22-next.3

5 months ago

0.2.22-next.2

5 months ago

0.2.22-next.1

5 months ago

0.2.19-next.0

8 months ago

0.2.19-next.1

7 months ago

0.2.20-next.2

7 months ago

0.2.17-next.2

8 months ago

0.2.17-next.3

8 months ago

0.2.17-next.1

8 months ago

0.2.14-next.1

9 months ago

0.2.14-next.2

9 months ago

0.2.14-next.0

10 months ago

0.2.21-next.0

7 months ago

0.2.21-next.2

6 months ago

0.2.21-next.1

6 months ago

0.2.16-next.0

9 months ago

0.2.22-next.0

6 months ago

0.2.21

6 months ago

0.2.20

7 months ago

0.2.19

7 months ago

0.2.18

8 months ago

0.2.17

8 months ago

0.2.16

9 months ago

0.2.15

9 months ago

0.2.14

9 months ago

0.2.13

10 months ago

0.2.13-next.0

11 months ago

0.2.12

11 months ago

0.2.12-next.2

11 months ago

0.2.12-next.3

11 months ago

0.2.11-next.1

1 year ago

0.2.11

12 months ago

0.2.12-next.1

12 months ago

0.2.12-next.0

12 months ago

0.2.10-next.3

1 year ago

0.2.11-next.0

1 year ago

0.2.10

1 year ago

0.2.9-next.1

1 year ago

0.2.9-next.2

1 year ago

0.2.9-next.0

1 year ago

0.2.10-next.2

1 year ago

0.2.10-next.1

1 year ago

0.2.10-next.0

1 year ago

0.2.9

1 year ago

0.2.8

1 year ago

0.2.8-next.1

1 year ago

0.2.8-next.0

1 year ago

0.2.8-next.2

1 year ago

0.2.6-next.1

1 year ago

0.2.6-next.2

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.5-next.0

1 year ago

0.2.5-next.2

1 year ago

0.2.5-next.1

1 year ago

0.2.5-next.3

1 year ago

0.2.4-next.0

2 years ago

0.2.4-next.1

2 years ago

0.2.6-next.0

1 year ago

0.2.3

2 years ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3-next.2

2 years ago

0.2.3-next.1

2 years ago

0.2.3-next.0

2 years ago

0.2.2-next.2

2 years ago

0.2.2-next.1

2 years ago

0.2.2-next.0

2 years ago

0.2.2

2 years ago

0.1.32-next.0

2 years ago

0.1.32-next.1

2 years ago

0.1.32-next.2

2 years ago

0.2.0-next.3

2 years ago

0.1.31-next.0

2 years ago

0.1.31-next.2

2 years ago

0.1.31-next.1

2 years ago

0.2.1-next.0

2 years ago

0.1.31

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.30

2 years ago

0.1.30-next.0

2 years ago

0.1.30-next.1

2 years ago

0.1.29-next.0

2 years ago

0.1.29-next.1

2 years ago

0.1.27

2 years ago

0.1.28

2 years ago

0.1.29

2 years ago

0.1.27-next.0

2 years ago

0.1.26

2 years ago

0.1.21-next.0

2 years ago

0.1.20

2 years ago

0.1.21

2 years ago

0.1.22

2 years ago

0.1.23

2 years ago

0.1.24

2 years ago

0.1.25

2 years ago

0.1.17

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.20-next.0

2 years ago

0.1.22-next.0

2 years ago

0.1.15

2 years ago

0.1.16

2 years ago

0.1.12

3 years ago

0.1.13

3 years ago

0.1.14

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago