/
config.yml
223 lines (206 loc) · 8.01 KB
/
config.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
version: 2.1
orbs:
browser-tools: circleci/browser-tools@1.4.8
executors:
dashjs-executor:
working_directory: ~/repo
docker:
- image: cimg/node:20.11.1
commands:
dependencies_setup:
steps:
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Install dependencies
command: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
functional_precondition:
steps:
- run:
name: Check if preconditions are met for functional tests
command: |
if [ -z "$BROWSERSTACK_ACCESS_KEY" ]; then
echo "BrowserStack not configured, functional tests will not be executed."
circleci-agent step halt
fi
functional_test_setup:
steps:
- run:
name: Download the browserstack binary file to create a tunnel
command: wget "https://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip"
- run:
name: Unzip the browserstack binary file
command: unzip BrowserStackLocal-linux-x64.zip
- run:
name: Run browserstack with provided access key
command: ./BrowserStackLocal $BROWSERSTACK_ACCESS_KEY
background: true
run_testbuild:
steps:
- browser-tools/install-browser-tools
- run:
name: Build and run unit tests
command: |
npm run build
process_test_results: # CircleCI can not handle NaN values so we replace them with 0
steps:
- run:
name: Install xmlstarlet
when: always
command: sudo apt-get -y update && sudo apt-get -y install xmlstarlet
- run:
name: Modify XML files recursively and copy to another folder
when: always
command: |
mkdir test/functional/results/test/karma/junit/adjusted
cd test/functional/results/test/karma/junit
for file in *.xml; do
[ -f "$file" ] || continue
xmlstarlet ed -L -u '//testcase[@time="NaN"]/@time' -v '0' "$file"
cp "$file" adjusted/$file
done
- store_test_results:
path: test/functional/results/test/karma/junit/adjusted
functional_steps:
steps:
- functional_precondition
- checkout
- dependencies_setup
- run_testbuild
- functional_test_setup
run_test_suite:
parameters:
streamsfile:
default: "single"
type: string
configfile:
default: "browserstack"
type: string
steps:
- run:
name: Run functional tests <<parameters.configfile>> - <<parameters.streamsfile>>
when: always
command:
node_modules/karma/bin/karma start test/functional/config/karma.functional.conf.cjs --configfile=<<parameters.configfile>> --streamsfile=<<parameters.streamsfile>>
build_samples:
# parameters:
# samples:
# default: "network-interceptor"
# type: string
steps:
- run:
name: Install dependencies and build samples
command: |
for sample in "${SAMPLES}"; do
echo "Build sample $sample"
cd samples/$sample
npm install
npm run build
done
jobs:
build-and-unit-test:
environment:
SAMPLES: "network-interceptor"
executor: dashjs-executor
steps:
- checkout
- dependencies_setup
- run_testbuild
- build_samples
merge-build-and-unit-test:
executor: dashjs-executor
steps:
- checkout
- run:
name: Merge into development virtually
command: |
git config --global user.email "circleci@example.com"
git config --global user.name "CircleCI"
git checkout development
git merge --no-edit --no-ff $CIRCLE_BRANCH
- dependencies_setup
- run_testbuild
functional-tests-smoke:
executor: dashjs-executor
steps:
- functional_precondition
- checkout
- run:
name: Virtual merge into development branch
command: |
if [ "${CIRCLE_BRANCH}" = "development" ]; then
echo "On development branch already, no merge needed"
else
git config --global user.email "circleci@example.com"
git config --global user.name "CircleCI"
git checkout development
git merge --no-edit --no-ff $CIRCLE_BRANCH
fi
- dependencies_setup
- run_testbuild
- functional_test_setup
- run_test_suite:
streamsfile: single
configfile: browserstack
- run_test_suite:
streamsfile: smoke
configfile: browserstack
- process_test_results
functional-tests-full-part-1:
executor: dashjs-executor
steps:
- functional_steps
- run_test_suite:
streamsfile: drm_emsg_eptdelta_gaps
configfile: browserstack
- process_test_results
functional-tests-full-part-2:
executor: dashjs-executor
steps:
- functional_steps
- run_test_suite:
streamsfile: multiperiod_subtitle_vendor
configfile: browserstack
- process_test_results
functional-tests-full-part-3:
executor: dashjs-executor
steps:
- functional_steps
- run_test_suite:
streamsfile: vod_live_lowlatency_mss_multiaudio
configfile: browserstack
- process_test_results
workflows:
version: 2
commit-workflow:
jobs:
- build-and-unit-test # run unit tests on feature branch
- merge-build-and-unit-test: # run unit tests on virtually merged feature branch
filters:
branches:
ignore:
- development # skiping redundant job if already on development
- functional-tests-smoke:
filters:
branches:
ignore: # as creds are available only for non-forked branches
- /pull\/[0-9]+/
scheduled-workflow:
triggers:
- schedule:
cron: "0 0 * * 0,3"
filters:
branches:
only:
- development
jobs:
- functional-tests-full-part-1
- functional-tests-full-part-2
- functional-tests-full-part-3