From d4ac03783b6f4102b60d184447abf0404c501b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillem=20Hern=C3=A1ndez=20Sola?= Date: Tue, 4 Apr 2017 16:57:47 +0200 Subject: [PATCH] latest progress --- 01-maven-example.groovy | 52 +++++++++++++++++++++++++++++++ 02-maven-html-reports.groovy | 4 +-- 07-ionic-pipeline-browser.groovy | 53 ++++++++++++++++++++++++++++++++ 07-ionic-pipeline-mobile.groovy | 53 ++++++++++++++++++++++++++++++++ 4 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 07-ionic-pipeline-browser.groovy create mode 100644 07-ionic-pipeline-mobile.groovy diff --git a/01-maven-example.groovy b/01-maven-example.groovy index e69de29..e046831 100644 --- a/01-maven-example.groovy +++ b/01-maven-example.groovy @@ -0,0 +1,52 @@ +pipeline { + agent any + tools { + maven "maven_jenkins" + jdk "java_jenkins" + } + stages { + stage('Checkout') { + steps { + git url: 'git@github.com:Gromenaware/corball-test-automation-demo.git' + } + } + stage('Build') { + steps { + sh 'mvn compile -DskipTests' + } + } + stage('Test') { + steps { + sh 'mvn -Dtest=WebDriverTest -Dbrowser=chrome -Dhub=http://selgp:8b819d9d-0298-4f8f-9430-6d44e87ac7b5@ondemand.saucelabs.com:80/wd/hub test' + } + post { + always { + junit 'target/surefire-reports/**/*.xml' + } + } + } + stage('Package') { + steps { + sh 'mvn package -DskipTests' + } + } + } + post { + success { + archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true + emailext ( + subject: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", + body: """SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]': Check console output at ${env.BUILD_URL}""", + to: 'guillem@gromenaware.com' + ) + + } + failure { + emailext ( + subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", + body: """FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]': Check console output at ${env.BUILD_URL}""", + to: 'guillem@gromenaware.com' + ) + } + } +} \ No newline at end of file diff --git a/02-maven-html-reports.groovy b/02-maven-html-reports.groovy index 9f93f54..fc3d447 100644 --- a/02-maven-html-reports.groovy +++ b/02-maven-html-reports.groovy @@ -37,7 +37,7 @@ pipeline { emailext ( subject: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", body: """SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]': Check console output at ${env.BUILD_URL}""", - to: 'guillem@gromenware.com' + to: 'guillem@gromenaware.com' ) } @@ -45,7 +45,7 @@ pipeline { emailext ( subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", body: """FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]': Check console output at ${env.BUILD_URL}""", - to: 'guillem@gromenware.com' + to: 'guillem@gromenaware.com' ) } always{ diff --git a/07-ionic-pipeline-browser.groovy b/07-ionic-pipeline-browser.groovy new file mode 100644 index 0000000..3ace434 --- /dev/null +++ b/07-ionic-pipeline-browser.groovy @@ -0,0 +1,53 @@ +pipeline { + agent any + tools { + maven "maven_jenkins" + jdk "java_jenkins" + nodejs "nodejs" + } + stages { + stage('Checkout') { + steps { + git url: 'https://guillemhs@bitbucket.org/itnove/myexampleapp.git' + } + } + stage('Build') { + steps { + sh 'npm install -g cordova' + sh 'npm install -g ios-sim' + sh 'npm install -g ios-deploy' + sh 'npm config set prefix /usr/local' + sh 'npm root -g' + sh '/usr/local/lib/node_modules/ionic/bin/ionic serve --nobrowser --nolivereload &' + } + } + stage('Test') { + steps { + echo 'Tests here' + sh 'sleep 2m' + } + } + stage('Clean') { + steps { + sh 'killall node' + } + } + } + post { + success { + emailext ( + subject: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", + body: """SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]': Check console output at ${env.BUILD_URL}""", + to: 'guillem@gromenaware.com' + ) + + } + failure { + emailext ( + subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", + body: """FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]': Check console output at ${env.BUILD_URL}""", + to: 'guillem@gromenaware.com' + ) + } + } +} \ No newline at end of file diff --git a/07-ionic-pipeline-mobile.groovy b/07-ionic-pipeline-mobile.groovy new file mode 100644 index 0000000..949f182 --- /dev/null +++ b/07-ionic-pipeline-mobile.groovy @@ -0,0 +1,53 @@ +pipeline { + agent any + tools { + maven "maven_jenkins" + jdk "java_jenkins" + nodejs "nodejs" + } + stages { + stage('Checkout') { + steps { + git url: 'https://guillemhs@bitbucket.org/itnove/myexampleapp.git' + } + } + stage('Build') { + steps { + sh 'npm install -g cordova' + sh 'npm install -g ios-sim' + sh 'npm install -g ios-deploy' + sh 'npm config set prefix /usr/local' + sh 'npm root -g' + sh '/usr/local/lib/node_modules/ionic/bin/ionic build $OS' + } + } + stage('Test') { + steps { + git url: 'git@github.com:Gromenaware/corball-test-automation-demo.git' + sh 'mvn -Dtest=WebDriverTest -Dbrowser=chrome -Dhub=http://selgp:8b819d9d-0298-4f8f-9430-6d44e87ac7b5@ondemand.saucelabs.com:80/wd/hub test' + } + post { + always { + junit 'target/surefire-reports/**/*.xml' + } + } + } + } + post { + success { + emailext ( + subject: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", + body: """SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]': Check console output at ${env.BUILD_URL}""", + to: 'guillem@gromenaware.com' + ) + + } + failure { + emailext ( + subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", + body: """FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]': Check console output at ${env.BUILD_URL}""", + to: 'guillem@gromenaware.com' + ) + } + } +} \ No newline at end of file