Skip to content

Instantly share code, notes, and snippets.

@nurrony
Forked from g0t4/solitaire-pipeline-starting-point.groovy
Last active April 23, 2017 16:37
Show Gist options
  • Select an option

  • Save nurrony/b47c8a2e7919b0f42e3ade781357590a to your computer and use it in GitHub Desktop.

Select an option

Save nurrony/b47c8a2e7919b0f42e3ade781357590a to your computer and use it in GitHub Desktop.
stage "CI"
node {
/**git branch: 'jenkins2-course',
url: 'https://github.com/nmrony/solitaire-systemjs-course.git'*/
checkout scm
nodejs(nodeJSInstallationName: 'node') {
sh 'npm install --verbose'
stash excludes: 'test-results/**', includes: '**', name: 'everything'
}
}
node('mac') {
sh 'ls'
sh ' rm -fr *'
unstash 'everything'
sh 'ls'
}
stage 'Browser Testing'
parallel chrome: {
runTests("Chrome")
}, safari: {
runTests("Safari")
}
input 'Deploy to staging?'
// limit concurrency so we don't perform simultinious deploys
// and if multiple pipelines are executing,
// newest is only that will be allowed throughm rest will be canceled
stage name: 'Deploy', concurrency: 1
node {
sh "echo '<h1>${env.BUILD_DISPLAY_NAME}</h1>' >> app/index.html"
sh 'docker-compose up -d --build'
}
def runTests(browser) {
node {
sh 'rm -fr *'
unstash 'everything'
nodejs(nodeJSInstallationName: 'node') {
sh "npm run test-single-run -- --browsers ${browser}"
}
step([$class: 'JUnitResultArchiver',
testResults: 'test-results/**/test-results.xml'])
}
}
stage "CI"
node {
git branch: 'jenkins2-course',
url: 'https://github.com/nmrony/solitaire-systemjs-course.git'
nodejs(nodeJSInstallationName: 'node') {
sh 'npm install --verbose'
stash excludes: 'test-results/**', includes: '**', name: 'everything'
}
}
node('mac') {
sh 'ls'
sh ' rm -fr *'
unstash 'everything'
sh 'ls'
}
stage 'Browser Testing'
parallel chrome: {
runTests("Chrome")
}, safari: {
runTests("Safari")
}
input 'Deploy to staging?'
// limit concurrency so we don't perform simultinious deploys
// and if multiple pipelines are executing,
// newest is only that will be allowed throughm rest will be canceled
stage name: 'Deploy', concurrency: 1
node {
sh "echo '<h1>${env.BUILD_DISPLAY_NAME}</h1>' >> app/index.html"
sh 'docker-compose up -d --build'
}
def runTests(browser) {
node {
sh 'rm -fr *'
unstash 'everything'
nodejs(nodeJSInstallationName: 'node') {
sh "npm run test-single-run -- --browsers ${browser}"
}
step([$class: 'JUnitResultArchiver',
testResults: 'test-results/**/test-results.xml'])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment