#!/usr/bin/env groovy
pipeline {
    agent any

    stages {
        stage('Test') {
            steps {
              // output for collapse setions plugin
              echo "END JENKINS SETUP"

              // run regression tests with 4 build threads
              sh("cd regression && ./suntest_driver.sh 4 ${env.BRANCH_NAME}")
            }
        }
    }
    post {
         always {
                 echo 'Tests Complete'
         }
         success {
                 sh("cd regression && ./suntest_notify.py success ${env.BRANCH_NAME} ${env.BUILD_URL}")
         }
         failure {
                 sh("cd regression && ./suntest_notify.py failure ${env.BRANCH_NAME} ${env.BUILD_URL}")
         }
         unstable {
                 sh("cd regression && ./suntest_notify.py unstable ${env.BRANCH_NAME} ${env.BUILD_URL}")
         }
    }
}