pipeline {
agent none
stages {
stage('Build') {
parallel {
stage('Linux Build') {
// agent {
// docker {
// image 'linux-build-agent:latest'
// args '-u 0:0'
// }
// }
agent { docker 'linux-build-agent:latest' }
steps {
echo 'Building..'
sh 'whoami || true'
sh 'which -a make || true'
sh 'make -v || true'
sh 'sh -c make build/hello-linux-64'
archiveArtifacts artifacts: 'build/hello-linux-64', fingerprint: true
}
}
stage('Windows Build') {
// agent {
// docker {
// image 'windows-build-agent:latest'
// args '-u 0:0'
// }
// }
agent { docker 'windows-build-agent:latest' }
steps {
// echo 'Preparing..'
// cleanWs()
echo 'Building..'
sh 'whoami || true'
sh 'which -a make || true'
sh 'make -v || true'
sh 'sh -c 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 {
// image 'macosx-build-agent:latest'
// args '-u 0:0'
// }
// }
agent { docker 'macosx-build-agent:latest' }
steps {
echo 'Building..'
sh 'whoami || true'
sh 'which -a make || true'
sh 'make -v || true'
sh 'sh -c make build/hello-macosx.bin || true'
archiveArtifacts artifacts: 'build/hello-macosx.bin', fingerprint: true
}
}
stage('Linting') {
agent {
docker {
image 'lint-agent:latest'
args '-u 0:0'
}
}
// agent { docker 'lint-agent:latest' }
steps {
echo 'Linting..'
sh 'whoami'
sh 'which -a make || true'
sh 'make -v || true'
sh 'make tidy || true'
// junit allowEmptyResults: true, healthScaleFactor: 0.0, testResults: 'build/tidy.xml'
sh 'true'
}
}
}
}
stage('Test') {
agent {
docker {
image 'linux-build-agent:latest'
args '-u 0:0'
}
}
// 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 {
image 'linux-build-agent:latest'
args '-u 0:0'
}
}
// agent { docker 'linux-build-agent:latest' }
when {
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
}
}
steps {
echo 'Deploying....'
sh 'make publish'
}
}
}
}