Skip to content
This repository was archived by the owner on Apr 29, 2020. It is now read-only.

Commit 4623d69

Browse files
committed
Add a individual status checks per os + nodejs version
1 parent 8bf2d66 commit 4623d69

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

vars/javascript.groovy

+20-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ import groovy.transform.Field
1818
// Step for running tests on a specific nodejs version with windows
1919
def windowsStep (version) {
2020
node(label: 'windows') { ansiColor('xterm') { withEnv(['CI=true']) {
21+
def ciContext = 'continuous-integration/jenkins/windows/' + version
22+
githubNotify description: 'Tests in progress', status: 'PENDING', context: ciContext
2123
// need to make sure we're using the right line endings
2224
bat 'git config --global core.autocrlf input'
2325
checkout scm
2426
fileExists 'package.json'
25-
nodejs('9.2.0') {
27+
nodejs(version) {
2628
// delete node_modules if it's there
2729
bat 'del /s /q node_modules >nul 2>&1'
2830
// install local version of yarn (prevent concurrency issues again)
@@ -34,7 +36,9 @@ def windowsStep (version) {
3436
// run actual tests
3537
try {
3638
bat yarnPath + ' test'
39+
githubNotify description: 'Tests passed', status: 'SUCCESS', context: ciContext
3740
} catch (err) {
41+
githubNotify description: 'Tests failed', status: 'FAILURE', context: ciContext
3842
throw err
3943
} finally {
4044
junit allowEmptyResults: true, testResults: 'junit-report-*.xml'
@@ -47,6 +51,8 @@ def windowsStep (version) {
4751
// Step for running tests on a specific nodejs version with unix compatible OS
4852
def unixStep(version, nodeLabel) {
4953
node(label: nodeLabel) { ansiColor('xterm') { withEnv(['CI=true']) {
54+
def ciContext = 'continuous-integration/jenkins/' + nodeLabel + '/' + version
55+
githubNotify description: 'Tests in progress', status: 'PENDING', context: ciContext
5056
checkout scm
5157
fileExists 'package.json'
5258
nodejs(version) {
@@ -57,11 +63,14 @@ def unixStep(version, nodeLabel) {
5763
if (nodeLabel == 'linux') { // if it's linux, we need xvfb for display emulation (chrome)
5864
wrap([$class: 'Xvfb', parallelBuild: true, autoDisplayName: true]) {
5965
sh yarnPath + ' test'
66+
githubNotify description: 'Tests passed', status: 'SUCCESS', context: ciContext
6067
}
6168
} else {
6269
sh yarnPath + ' test'
70+
githubNotify description: 'Tests passed', status: 'SUCCESS', context: ciContext
6371
}
6472
} catch (err) {
73+
githubNotify description: 'Tests failed', status: 'FAILURE', context: ciContext
6574
throw err
6675
} finally {
6776
junit allowEmptyResults: true, testResults: 'junit-report-*.xml'
@@ -95,13 +104,21 @@ def call() {
95104
}
96105
}
97106
steps['linting'] = {node(label: 'linux') { ansiColor('xterm') { withEnv(['CI=true']) {
107+
def ciContext = 'continuous-integration/jenkins/linting'
108+
githubNotify description: 'Linting in progress', status: 'PENDING', context: ciContext
98109
checkout scm
99110
fileExists 'package.json'
100111
nodejs('9.2.0') {
101112
sh 'rm -rf node_modules/'
102113
sh 'npm install yarn@' + yarnVersion
103114
sh yarnPath + ' --mutex network'
104-
sh yarnPath + ' lint'
115+
try {
116+
sh yarnPath + ' lint'
117+
githubNotify description: 'Linting passed', status: 'SUCCESS', context: ciContext
118+
} catch (err) {
119+
githubNotify description: 'Linting failed', status: 'FAILURE', context: ciContext
120+
throw err
121+
}
105122
}
106123
}}}}
107124
// Maximum runtime: 1 hour
@@ -111,3 +128,4 @@ def call() {
111128
}
112129
}
113130
}
131+

0 commit comments

Comments
 (0)