-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitbucket-pipelines.yml
57 lines (48 loc) · 1.76 KB
/
bitbucket-pipelines.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
image: node:19
pipelines:
default:
- step:
name: Build
script:
- echo "Building .."
- step:
name: Test
caches:
- npm
script:
# Skip this line if not installing your own Node.js packages
- npm ci
# Install Testmo CLI tool locally (then use npx testmo .. to run it)
- npm install --no-save @testmo/testmo-cli
# Optionally add a couple of fields such as the git hash and link to the build
- npx testmo automation:resources:add-field --name git --type string
--value ${BITBUCKET_COMMIT:0:7} --resources resources.json
- BUILD_URL="$BITBUCKET_GIT_HTTP_ORIGIN/addon/pipelines/home#!/results/$BITBUCKET_BUILD_NUMBER"
- npx testmo automation:resources:add-link --name build
--url $BUILD_URL --resources resources.json
# Check if the required variables are available
- >
if [[ -z "${TESTMO_URL}" ]]; then
echo "The TESTMO_URL variable is not defined for this repository"
exit 1
fi
if [[ -z "${TESTMO_TOKEN}" ]]; then
echo "The TESTMO_TOKEN variable is not defined for this repository"
exit 1
fi
# Run automated tests and report results to Testmo
- npx testmo automation:run:submit
--instance "$TESTMO_URL"
--project-id 1
--name "Mocha test run"
--source "unit-tests"
--resources resources.json
--results results/*.xml
-- npm run mocha-junit # Note space after --
- step:
name: Deploy
script:
- echo "Deploying .."
definitions:
caches:
npm: ~/.npm