forked from coverallsapp/orb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorb.yml
165 lines (135 loc) · 5 KB
/
orb.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
version: 2.1
description: |
This Orb posts your test suite's LCOV coverage data to coveralls.io for analysis, change tracking, and notifications.
When running on Pull Request builds, a comment will be added to the PR with details about how coverage will be affected if merged.
display:
source_url: https://github.com/coverallsapp/orb
home_url: https://coveralls.io/
examples:
coveralls_simple:
description: >
Build and upload to Coveralls in single job.
Demo: https://github.com/coverallsapp/actions-demo
usage:
version: 2.1
orbs:
coveralls: coveralls/[email protected]
jobs:
build:
docker:
- image: circleci/node:10.0.0
steps:
- checkout
- run:
name: Install and Make
command: 'npm install && make test-coverage'
- coveralls/upload
coveralls_parallel:
description: >
Coveralls parallel build.
'build' jobs uploads coverage, then 'done' job hits parallel complete webhook to finish the build.
Demo: https://github.com/coverallsapp/actions-demo
usage:
version: 2.1
orbs:
coveralls: coveralls/[email protected]
jobs:
build-1:
docker:
- image: circleci/node:10.0.0
steps:
- checkout
- run:
name: Install and Make 1
command: 'npm install && make test-coverage-1'
- coveralls/upload:
parallel: true
flag_name: Test 1
build-2:
docker:
- image: circleci/node:10.0.0
steps:
- checkout
- run:
name: Install and Make 2
command: 'npm install && make test-coverage-2'
- coveralls/upload:
parallel: true
flag_name: Test 2
done:
docker:
- image: circleci/node:10.0.0
steps:
- coveralls/upload:
parallel_finished: true
workflows:
test_parallel_then_upload:
jobs:
- build-1
- build-2
- done:
requires: [build-1, build-2]
commands:
upload:
parameters:
path_to_lcov:
description: >
Local path to the lcov output file produced by your test suite.
An error will be thrown if the file can't be found. This is the file that will be sent to the Coveralls API.
type: string
default: ./coverage/lcov.info
token:
description: Your Coveralls Repo token defined in your Circle's Environment Variables.
type: env_var_name
default: COVERALLS_REPO_TOKEN
flag_name:
description: Options flag name of the job, e.g. "Unit Tests", "Integration Tests", etc.
type: string
default: ''
parallel:
description: Set to true for parallel jobs, where multiple posts to Coveralls will be performed before completing the build with `parallel_finished`.
type: boolean
default: false
parallel_finished:
description: Set to true in the final job, after the other parallel jobs steps have completed. This will send a webhook to Coveralls to set the build complete.
type: boolean
default: false
coveralls_endpoint:
description: >
Hostname and protocol (https://<host>). Specifies a Coveralls Enterprise hostname.
You can also define this in your Circle's Environment Variables as COVERALLS_ENDPOINT
type: string
default: 'https://coveralls.io'
verbose:
description: Set to true for verbose output from the Coveralls API push.
type: boolean
default: false
steps:
- run:
name: Upload Coverage Result To Coveralls
command: |
if << parameters.parallel_finished >>; then
curl "<< parameters.coveralls_endpoint >>/webhook?repo_token=$<< parameters.token >>" \
-d "payload[build_num]=$CIRCLE_WORKFLOW_ID&payload[status]=done"
exit 0
fi
if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi
$SUDO npm install -g coveralls
if [ ! $COVERALLS_REPO_TOKEN ]; then
export COVERALLS_REPO_TOKEN=$<< parameters.token >>
fi
export COVERALLS_ENDPOINT=<< parameters.coveralls_endpoint >>
export COVERALLS_FLAG_NAME="<< parameters.flag_name >>"
if << parameters.parallel >>; then
export COVERALLS_PARALLEL=true
fi
# check for lcov file presence:
if [ ! -r << parameters.path_to_lcov >> ]; then
echo "Please specify a valid 'path_to_lcov' parameter."
exit 1
fi
if << parameters.verbose >>; then
cat << parameters.path_to_lcov >> | coveralls --verbose
else
cat << parameters.path_to_lcov >> | coveralls
fi