From d2336d5d9a3cf9222762330049ecde0cfb65d388 Mon Sep 17 00:00:00 2001 From: Chris Colvard Date: Tue, 26 Mar 2019 07:13:54 -0700 Subject: [PATCH 1/2] Before and after build steps for code climate that handle parallelism --- src/commands/code_climate_after_build.yml | 8 ++++++++ src/commands/code_climate_before_build.yml | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/commands/code_climate_after_build.yml create mode 100644 src/commands/code_climate_before_build.yml diff --git a/src/commands/code_climate_after_build.yml b/src/commands/code_climate_after_build.yml new file mode 100644 index 0000000..4d674f6 --- /dev/null +++ b/src/commands/code_climate_after_build.yml @@ -0,0 +1,8 @@ +description: Sum the coverage files and submit to Code Climate. +steps: + - run: + command: | + ./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json" + - deploy: + command: | + ./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input - diff --git a/src/commands/code_climate_before_build.yml b/src/commands/code_climate_before_build.yml new file mode 100644 index 0000000..b59cb58 --- /dev/null +++ b/src/commands/code_climate_before_build.yml @@ -0,0 +1,14 @@ +description: Install the Code Climate reporter then run before build. +parameters: + version: + type: string + default: latest +steps: + - run: + command: | + if [[ $(command -v cc-test-reporter) == "" ]]; then + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-<< parameters.version >>-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + fi + - run: + command: ./cc-test-reporter before-build From 7d86a892ae88453bf8aeaf37115792f874b6c551 Mon Sep 17 00:00:00 2001 From: Chris Colvard Date: Wed, 3 Apr 2019 10:27:09 -0400 Subject: [PATCH 2/2] Support overriding when attribute --- src/commands/code_climate_after_build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/commands/code_climate_after_build.yml b/src/commands/code_climate_after_build.yml index 4d674f6..3a5d07e 100644 --- a/src/commands/code_climate_after_build.yml +++ b/src/commands/code_climate_after_build.yml @@ -1,8 +1,14 @@ description: Sum the coverage files and submit to Code Climate. +parameters: + when: + type: string + default: on_success steps: - run: command: | ./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json" + when: << parameters.when >> - deploy: command: | ./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input - + when: << parameters.when >>