Skip to content

Commit 0f39e49

Browse files
feature: CircleCI orb using command instead of job
1 parent ca274e0 commit 0f39e49

File tree

6 files changed

+43
-28
lines changed

6 files changed

+43
-28
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ jobs:
2727
- run:
2828
name: Pack orb
2929
command: |
30-
echo "" >> orbs/jobs/send_report.yml
31-
echo "environment:" >> orbs/jobs/send_report.yml
32-
echo " - CODACY_COVERAGE_REPORTER_VERSION: $(cat .version)" >> orbs/jobs/send_report.yml
30+
echo "" >> orbs/examples/codacy-coverage-report.yml
31+
echo " orbs:" >> orbs/examples/codacy-coverage-report.yml
32+
echo " coverage-reporter: codacy/coverage-reporter@$(cat .version)" >> orbs/examples/codacy-coverage-report.yml
3333
circleci config pack orbs > orb.yml
3434
- run:
3535
name: Validate orb

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,24 @@ after_success:
299299
300300
Make sure you have set `CODACY_PROJECT_TOKEN` as an environment variable in your travis job!
301301

302+
## CircleCI
303+
304+
If you want to use codacy with Circle CI and report coverage generated from your tests run in CircleCI, you can use our [coverage reporter orb](https://circleci.com/orbs/registry/orb/codacy/coverage-reporter):
305+
306+
Example:
307+
308+
jobs:
309+
send-coverage-report:
310+
steps:
311+
- checkout
312+
- run: <run-coverage-command>
313+
- coverage-reporter/send_report
314+
workflows:
315+
version: 2
316+
coverage-example:
317+
jobs:
318+
- send-coverage-report
319+
302320
## Troubleshooting
303321

304322
### `Failed to upload report: Not Found`

orbs/commands/send_report.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
description: "Download Codacy's coverage reporter and run it"
2+
3+
parameters:
4+
tool_version:
5+
type: string
6+
default: latest
7+
description: "Specify Codacy's coverage reporter tool version"
8+
steps:
9+
- run:
10+
command: |
11+
export CODACY_REPORTER_VERSION=<< parameters.tool_version >>
12+
bash <(curl -Ls https://coverage.codacy.com/get.sh)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
description: Send coverage report to Codacy
2+
usage:
3+
jobs:
4+
codacy-coverage-report:
5+
machine: true
6+
steps:
7+
- checkout
8+
- run: <run-coverage-command>
9+
- coverage-reporter/send_report
10+
version: 2.1

orbs/executors/machine.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

orbs/jobs/send_report.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)