Skip to content

Commit

Permalink
fix: shell fixes and verbose steps (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexox committed Mar 7, 2023
1 parent 7443545 commit f7b42b8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
13 changes: 11 additions & 2 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@ filters: &filters
jobs:
command-tests:
docker:
- image: cimg/base:current
- image: circleci/node:16.13.0
environment:
COVERALLS_REPO_TOKEN: test-token
steps:
- checkout
# Run dummy jobs to make sure it works.
- coveralls/greet
- coveralls/upload:
dry_run: true
parallel: true
path_to_lcov: ./src/@orb.yml

- coveralls/upload:
dry_run: true
parallel_finished: true
workflows:
test-deploy:
jobs:
Expand Down
11 changes: 5 additions & 6 deletions src/@orb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ display:
home_url: https://coveralls.io/

commands:
greet:
steps:
- run:
name: Greeting
command: echo 'Coveralls Orb'

upload:
parameters:
path_to_lcov:
Expand Down Expand Up @@ -72,6 +66,10 @@ commands:
(if missing).
type: string
default: ''
dry_run:
description: Don't send any requests
type: boolean
default: false
steps:
- run:
name: Upload Coverage Result To Coveralls
Expand All @@ -84,4 +82,5 @@ commands:
COVERALLS_CARRYFORWARD_FLAGS: << parameters.carryforward >>
COVERALLS_FLAG_NAME: << parameters.flag_name >>
COVERALLS_PARALLEL: << parameters.parallel >>
COVERALLS_DRY_RUN: << parameters.dry_run >>
command: <<include(scripts/coveralls.sh)>>
14 changes: 11 additions & 3 deletions src/scripts/coveralls.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/bin/bash

if [ ! "${COVERALLS_REPO_TOKEN}" ]; then
COVERALLS_REPO_TOKEN=$(printenv "${COVERALLS_REPO_TOKEN_ENV}")
COVERALLS_REPO_TOKEN=$(printenv "${COVERALLS_REPO_TOKEN_ENV}") || (echo "Token not configured" && exit 1)
export COVERALLS_REPO_TOKEN
fi

if "${COVERALLS_DONE}"; then
if [ "${COVERALLS_DONE}" == "1" ]; then
echo "Sending parallel finish webhook"

[ "${COVERALLS_DRY_RUN}" == "1" ] && exit 0

curl "${COVERALLS_ENDPOINT}/webhook?repo_token=${COVERALLS_REPO_TOKEN}&carryforward=${COVERALLS_CARRYFORWARD_FLAGS}" \
-d "payload[build_num]=${CIRCLE_WORKFLOW_ID}&payload[status]=done"

Expand All @@ -26,7 +30,11 @@ if [ ! -r "${COVERALLS_COVERAGE_FILE}" ]; then
exit 1
fi

if "${COVERALLS_VERBOSE}"; then
echo "Processing coverage from ${COVERALLS_COVERAGE_FILE}"

[ "${COVERALLS_DRY_RUN}" == "1" ] && exit 0

if [ "${COVERALLS_VERBOSE}" == "1" ]; then
coveralls --verbose < "${COVERALLS_COVERAGE_FILE}"
else
coveralls < "${COVERALLS_COVERAGE_FILE}"
Expand Down

0 comments on commit f7b42b8

Please sign in to comment.