-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJenkinsfile
59 lines (56 loc) · 1.82 KB
/
Jenkinsfile
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
pipeline {
agent {
docker { image 'node' }
}
environment {
TESTMO_URL = credentials('TESTMO_URL')
TESTMO_TOKEN = credentials('TESTMO_TOKEN')
}
stages {
stage('Build') {
steps {
echo 'Building ..'
}
}
stage('Test') {
environment {
GIT_SHORT_COMMIT = "${GIT_COMMIT[0..7]}"
}
steps {
// Skip this line if not installing your own Node.js packages
sh 'npm ci'
// Install Testmo CLI tool locally (then use npx testmo .. to run it)
sh 'npm install --no-save @testmo/testmo-cli'
// Optionally add a couple of fields such as the
// git hash and link to the build
sh '''
npx testmo automation:resources:add-field --name git --type string \
--value $GIT_SHORT_COMMIT --resources resources.json
npx testmo automation:resources:add-link --name build \
--url $BUILD_URL --resources resources.json
'''
// Run automated tests and report results to Testmo
sh '''
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 --
'''
}
}
stage('Deploy') {
steps {
echo 'Deploying ..'
}
}
}
post {
always {
junit 'results/*.xml'
}
}
}