
pipeline {
    agent any

    stages {
        stage('Build') {
            steps {
                echo 'Building..'
		sh './build.sh'
		archiveArtifacts artifacts: 'build/hello*', fingerprint: true
            }
        }
        stage('Test') {
            steps {
                echo 'Testing..'
		sh 'make test || true'
		junit 'build/*.xml'
            }
        }
        stage('Deploy') {
	    when {
              expression {
                currentBuild.result == null || currentBuild.result == 'SUCCESS' 
              }
            }
            steps {
            	echo 'Deploying....'
                sh 'make publish'
            }
        }
    }
}

