Newer
Older
Code / Jenkinsfile

pipeline {
    agent none

    stages {
        stage('Build') {
            parallel {
		stage('Linux Build') {
		    agent { docker 'linux-build-agent:latest' }
		    steps {
			echo 'Building..'
			sh 'make build/hello-linux-64'
			archiveArtifacts artifacts: 'build/hello-linux-64', fingerprint: true
		    }
		}
		stage('Windows Build') {
		    agent { docker 'windows-build-agent:latest' }
		    steps {
			// echo 'Preparing..'
			// cleanWs()
			echo 'Building..'
			sh 'make build/hello-win64.exe'
			archiveArtifacts artifacts: 'build/hello-win64.exe', fingerprint: true
			// echo 'Cleaning..'
			// cleanWs cleanWhenFailure: false, cleanWhenNotBuilt: false, cleanWhenUnstable: false
		    }
		}
		stage('MacOSX Build') {
		    agent { docker 'macosx-build-agent:latest' }
		    steps {
			echo 'Building..'
			sh 'make build/hello-macosx.bin'
			archiveArtifacts artifacts: 'build/hello-macosx.bin', fingerprint: true
		    }
		}
		stage('Linting') {
		    agent { docker 'lint-agent:latest' }
		    steps {
			echo 'Linting..'
			sh 'make tidy || true'
			//  junit allowEmptyResults: true, healthScaleFactor: 0.0, testResults: 'build/tidy.xml'
			sh 'true'
		    }
		}
	    }
        }
        stage('Test') {
            agent { docker 'linux-build-agent:latest' }
            steps {
                echo 'Testing..'
		sh 'make test || true'
		junit allowEmptyResults: true, healthScaleFactor: 0.0, testResults: 'build/tests.xml'
            }
        }
        stage('Deploy') {
            agent { docker 'linux-build-agent:latest' }
	    when {
              expression {
                currentBuild.result == null || currentBuild.result == 'SUCCESS' 
              }
            }
            steps {
            	echo 'Deploying....'
                sh 'make publish'
            }
        }
    }
}