From b48e556b45f4119f82742212b9b75906bbdc9f9e Mon Sep 17 00:00:00 2001 From: Valentin Kiselev Date: Thu, 13 Jul 2023 14:41:03 +0300 Subject: [PATCH] feat: add new options (#38) - fail_on_error - measure - coverage_files --- .circleci/config.yml | 18 ++++++------------ .circleci/test-deploy.yml | 15 ++++++--------- src/@orb.yml | 16 ++++++++++++++++ src/scripts/coveralls.sh | 12 ++++++++++++ 4 files changed, 40 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d37c7ab..b2e767b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 setup: true orbs: - orb-tools: circleci/orb-tools@11.5 + orb-tools: circleci/orb-tools@12.0.3 shellcheck: circleci/shellcheck@3.1 filters: &filters @@ -19,20 +19,14 @@ workflows: filters: *filters - shellcheck/check: filters: *filters - - orb-tools/publish: - orb-name: coveralls/coveralls - vcs-type: << pipeline.project.type >> + # Triggers the next workflow in the Orb Development Kit. + - orb-tools/continue: + orb_name: coveralls + pipeline_number: << pipeline.number >> + vcs_type: << pipeline.project.type >> requires: - orb-tools/lint - orb-tools/pack - orb-tools/review - shellcheck/check - # Use a context to hold your publishing token. - context: publishing - filters: *filters - # Triggers the next workflow in the Orb Development Kit. - - orb-tools/continue: - pipeline-number: << pipeline.number >> - vcs-type: << pipeline.project.type >> - requires: [orb-tools/publish] filters: *filters diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index 7dbd9a7..23b0417 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -1,13 +1,10 @@ --- version: 2.1 orbs: - coveralls: coveralls/coveralls@dev:<> - orb-tools: circleci/orb-tools@11.5 - + orb-tools: circleci/orb-tools@12.0.3 filters: &filters tags: only: /.*/ - jobs: command-tests: docker: @@ -19,16 +16,16 @@ jobs: - coveralls/upload: dry_run: true verbose: true + measure: true - coveralls/upload: - dry_run: true verbose: true parallel: true coverage_file: test/main.c.gcov + fail_on_error: false - coveralls/upload: dry_run: true verbose: true parallel_finished: true - workflows: test-deploy: jobs: @@ -38,9 +35,9 @@ workflows: - orb-tools/pack: filters: *filters - orb-tools/publish: - orb-name: coveralls/coveralls - vcs-type: << pipeline.project.type >> - pub-type: production + orb_name: coveralls/coveralls + vcs_type: << pipeline.project.type >> + pub_type: production requires: - orb-tools/pack - command-tests diff --git a/src/@orb.yml b/src/@orb.yml index edbe784..1c7898d 100644 --- a/src/@orb.yml +++ b/src/@orb.yml @@ -22,6 +22,11 @@ commands: This is the file that will be sent to the Coveralls API. type: string default: '' + coverage_files: + description: > + Space-separated list of coverage reports to be uploaded. + type: string + default: '' coverage_format: description: > Force coverage report format. If not specified coveralls will try @@ -94,6 +99,14 @@ commands: description: Commit SHA to compare coverage with. type: string default: '' + measure: + description: Enable time measurement logging + type: boolean + default: false + fail_on_error: + description: Whether to fail (exit code 1) on parsing or upload issues + type: boolean + default: true steps: - run: name: Upload Coverage Result To Coveralls @@ -104,6 +117,7 @@ commands: COVERALLS_REPO_TOKEN_ENV: << parameters.token >> COVERALLS_VERBOSE: << parameters.verbose >> COVERALLS_COVERAGE_FILE: << parameters.coverage_file >> + COVERALLS_COVERAGE_FILES: << parameters.coverage_files >> COVERALLS_CARRYFORWARD_FLAGS: << parameters.carryforward >> COVERALLS_FLAG_NAME: << parameters.flag_name >> COVERALLS_PARALLEL: << parameters.parallel >> @@ -111,5 +125,7 @@ commands: COVERALLS_COMPARE_REF: << parameters.compare_ref >> COVERALLS_COMPARE_SHA: << parameters.compare_sha >> COVERALLS_COVERAGE_FORMAT: << parameters.coverage_format >> + COVERALLS_MEASURE: << parameters.measure >> + COVERALLS_FAIL_ON_ERROR: << parameters.fail_on_error >> COVERALLS_SOURCE_HEADER: circleci-orb command: <> diff --git a/src/scripts/coveralls.sh b/src/scripts/coveralls.sh index 2256586..1bbbda1 100755 --- a/src/scripts/coveralls.sh +++ b/src/scripts/coveralls.sh @@ -20,6 +20,14 @@ if [ -z "${COVERALLS_REPO_TOKEN}" ]; then export COVERALLS_REPO_TOKEN=$(printenv "${COVERALLS_REPO_TOKEN_ENV}") fi +if [ "${COVERALLS_MEASURE}" == "1" ]; then + args="${args} --measure" +fi + +if [ "${COVERALLS_FAIL_ON_ERROR}" != "1" ]; then + args="${args} --no-fail" +fi + if [ "${COVERALLS_DONE}" == "1" ]; then echo "Reporting parallel done" @@ -56,6 +64,10 @@ if [ -n "${COVERALLS_COVERAGE_FILE}" ]; then args="${args} ${coverage_file}" fi +if [ -n "${COVERALLS_COVERAGE_FILES}" ]; then + args="${args} ${COVERALLS_COVERAGE_FILES}" +fi + echo "Reporting coverage" set -x