Skip to content

Commit

Permalink
feat: add new options (#38)
Browse files Browse the repository at this point in the history
- fail_on_error
- measure
- coverage_files
  • Loading branch information
mrexox committed Jul 13, 2023
1 parent 635f170 commit b48e556
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 21 deletions.
18 changes: 6 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
15 changes: 6 additions & 9 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
---
version: 2.1
orbs:
coveralls: coveralls/coveralls@dev:<<pipeline.git.revision>>
orb-tools: circleci/orb-tools@11.5

orb-tools: circleci/orb-tools@12.0.3
filters: &filters
tags:
only: /.*/

jobs:
command-tests:
docker:
Expand All @@ -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:
Expand All @@ -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
Expand Down
16 changes: 16 additions & 0 deletions src/@orb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -104,12 +117,15 @@ 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 >>
COVERALLS_DRY_RUN: << parameters.dry_run >>
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: <<include(scripts/coveralls.sh)>>
12 changes: 12 additions & 0 deletions src/scripts/coveralls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b48e556

Please sign in to comment.