Skip to content

Commit 1d7095f

Browse files
committed
Added coverage-files + tags inputs
1 parent 6fb39f7 commit 1d7095f

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,16 @@ jobs:
2727
- run: echo "Run your tests and generate XML reports for your test results"
2828

2929
- buildpulse/upload:
30-
path: test/reports
30+
account-id: 123
31+
repository-id: 123
32+
path: ./spec/reports
33+
access-key-id: BUILDPULSE_ACCESS_KEY_ID
34+
secret-access-key: BUILDPULSE_SECRET_ACCESS_KEY
35+
path: test/reports # path to JUnit XML file
3136
account-id: <buildpulse-account-id>
3237
repository-id: <buildpulse-repository-id>
38+
coverage-files: ./coverage/lcov/project.lcov # optional
39+
tags: tag1 tag2 tag3 # optional
3340

3441
workflows:
3542
version: 2

src/@orb.yml

+14
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ commands:
5656
test results (e.g., "test/reports").
5757
type: string
5858

59+
coverage-files:
60+
description: |
61+
Paths to coverage files (space-separated).
62+
default: ""
63+
type: string
64+
65+
tags:
66+
description: |
67+
Tags to apply to this build (space-separated).
68+
default: ""
69+
type: string
70+
5971
repository-path:
6072
description: |
6173
Path to the local git clone of the repository (default: ".").
@@ -83,6 +95,8 @@ commands:
8395
INPUT_PATH: << parameters.path >>
8496
INPUT_REPOSITORY_PATH: << parameters.repository-path >>
8597
INPUT_WHEN_BRANCH_MATCHES: << parameters.when-branch-matches >>
98+
INPUT_COVERAGE_FILES: << parameters.coverage-files >>
99+
INPUT_TAGS: << parameters.tags >>
86100
command: << include(upload.sh) >>
87101

88102
setup:

src/upload.sh

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2+
# Enable double globbing if supported by the shell on the base github runner
3+
if shopt -s globstar; then
4+
echo "This bash shell version supports double globbing: '${BASH_VERSION}'."
5+
fi
6+
17
if ! [[ "$CIRCLE_BRANCH" =~ $INPUT_WHEN_BRANCH_MATCHES ]]
28
then
39
echo "The current branch (${CIRCLE_BRANCH}) does not match the regex specified in the when-branch-matches parameter ($INPUT_WHEN_BRANCH_MATCHES). Skipping BuildPulse upload."
@@ -32,13 +38,15 @@ else
3238
REPOSITORY_ID=$INPUT_REPOSITORY_ID
3339
fi
3440

41+
for path in $INPUT_PATH; do
42+
if [ ! -e "$path" ]
43+
then
44+
echo "🐛 The given path does not exist: $path"
45+
echo "🧰 To resolve this issue, set the 'path' parameter to the location of your XML test report(s)."
46+
exit 1
47+
fi
48+
done
3549
REPORT_PATH="${INPUT_PATH}"
36-
if [ ! -d "$REPORT_PATH" ]
37-
then
38-
echo "The given report path is not a directory: ${REPORT_PATH}"
39-
echo "To resolve this issue, set the buildpulse/upload 'path' parameter to the directory that contains your test report(s)."
40-
exit 1
41-
fi
4250

4351
REPOSITORY_PATH="${INPUT_REPOSITORY_PATH}"
4452
if [ ! -d "$REPOSITORY_PATH" ]
@@ -80,4 +88,4 @@ chmod +x ./buildpulse-test-reporter
8088

8189
BUILDPULSE_ACCESS_KEY_ID="${!INPUT_ACCESS_KEY_ID}" \
8290
BUILDPULSE_SECRET_ACCESS_KEY="${!INPUT_SECRET_ACCESS_KEY}" \
83-
./buildpulse-test-reporter submit "${REPORT_PATH}" --account-id $ACCOUNT_ID --repository-id $REPOSITORY_ID --repository-dir $REPOSITORY_PATH
91+
./buildpulse-test-reporter submit "${REPORT_PATH}" --account-id "${ACCOUNT_ID}" --repository-id "${REPOSITORY_ID}" --repository-dir "${REPOSITORY_PATH}" --coverage-files "${INPUT_COVERAGE_FILES}" --tags "${INPUT_TAGS}" --disable-coverage-auto

0 commit comments

Comments
 (0)