You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+100-3Lines changed: 100 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ to report coverage with the Code Climate test reporter
8
8
9
9
https://github.com/codeclimate/test-reporter
10
10
11
-
Plugin can handle single, or multiple (parallel), tests.
11
+
Plugin can handle single, [parallel](https://docs.codeclimate.com/docs/configuring-test-coverage#parallel-tests) and [multiple](https://docs.codeclimate.com/docs/configuring-test-coverage#multiple-test-suites) test suites.
12
12
13
13
Also see: https://docs.codeclimate.com/docs/configuring-test-coverage
14
14
@@ -20,14 +20,16 @@ This plugin will download build artifact(s) generated by a previous step, compil
20
20
steps:
21
21
- label: ":codeclimate: Report coverage"
22
22
plugins:
23
-
- jobready/codeclimate-test-reporter#v2.0:
23
+
- jobready/codeclimate-test-reporter#v2.2:
24
24
artifact: "coverage/.resultset.json"
25
25
input_type: simplecov
26
26
prefix: /app
27
27
env:
28
28
CC_TEST_REPORTER_ID:
29
29
```
30
30
31
+
### Parallel tests
32
+
31
33
If you are running parallel builds you'll probably want to create uniquely
32
34
named artifacts. That can be done by renaming the `.resultset.json` file
If your repository has more than one test suite you'll need to format each artifact (coverage file) before the result can be summed and reported to codeclimate.
44
+
45
+
To do this you'll need to configure multiple steps persisting the formated codeclimate compatable configuration files as artifacts between steps.
46
+
47
+
This is best shown via an example;
48
+
49
+
```
50
+
- label: ":rails: Tests"
51
+
key: "rails-tests"
52
+
command: "rails db:test:prepare && rails test"
53
+
env:
54
+
RUBY_OPT: "-W:deprecated"
55
+
depends_on:
56
+
- "build-base"
57
+
plugins:
58
+
- docker-compose#v3.7.0:
59
+
run: base
60
+
config: .buildkite/docker-compose.yml
61
+
volumes:
62
+
- "./coverage:/app/coverage"
63
+
artifact_paths:
64
+
- "coverage/**/*"
65
+
66
+
- label: ":codeclimate: Format Rails Coverage"
67
+
key: "codeclimate-format-rails-report"
68
+
plugins:
69
+
- jobready/codeclimate-test-reporter#v2.2:
70
+
artifact: "coverage/coverage.json"
71
+
input_type: simplecov
72
+
prefix: /app
73
+
report: false
74
+
file_prefix: "codeclimate.rails"
75
+
depends_on:
76
+
- "rails-tests"
77
+
artifact_paths:
78
+
- "coverage/codeclimate.**"
79
+
80
+
- label: ":react: Tests"
81
+
key: "react-tests"
82
+
command: "yarn test"
83
+
depends_on:
84
+
- "build-base"
85
+
plugins:
86
+
- docker-compose#v3.7.0:
87
+
run: base
88
+
config: .buildkite/docker-compose.yml
89
+
volumes:
90
+
- "./coverage:/app/coverage"
91
+
artifact_paths:
92
+
- "coverage/**/*"
93
+
94
+
- label: ":codeclimate: Format React Coverage"
95
+
key: "codeclimate-format-react-report"
96
+
plugins:
97
+
- jobready/codeclimate-test-reporter#v2.2:
98
+
artifact: "coverage/lcov.info"
99
+
input_type: lcov
100
+
prefix: /app
101
+
report: false
102
+
file_prefix: "codeclimate.react"
103
+
depends_on:
104
+
- "react-tests"
105
+
artifact_paths:
106
+
- "coverage/codeclimate.**"
107
+
108
+
- label: ":codeclimate: Report coverage"
109
+
key: "codeclimate-coverage-report"
110
+
plugins:
111
+
- jobready/codeclimate-test-reporter#v2.2:
112
+
artifact: "coverage/codeclimate**"
113
+
format: false
114
+
env:
115
+
CC_TEST_REPORTER_ID:
116
+
depends_on:
117
+
- "codeclimate-format-rails-report"
118
+
- "codeclimate-format-react-report"
119
+
```
120
+
39
121
## Configuration
40
122
41
123
### `artifact` (required)
@@ -86,11 +168,26 @@ Set to true to enable cc-test-reporter --debug flag
86
168
87
169
Example: `true`
88
170
171
+
### `format` (optional, default `true`)
172
+
173
+
Controls if formatting of artifacts should be performed. Set to false when wanting to upload artifacts formatted in a previous step.
174
+
175
+
Example: `false`
176
+
177
+
### `report` (optional, default `true`)
178
+
179
+
Controls if coverage reporting to codeclimate should be performed. Set to false when needing to parse multiple test suites for later upload.
Controls the name outputs files formatted by the codeclimate test reporter. Required to stop artifact names clashing when processing muiltple test suites.
186
+
89
187
### `CC_TEST_REPORTER_ID` (required)
90
188
91
189
The `CC_TEST_REPORTER_ID` environment variable must be configured.
92
190
93
-
94
191
## Linting
95
192
96
193
To run the [Buildkite Plugin Linter](https://github.com/buildkite-plugins/buildkite-plugin-linter), run
0 commit comments