Jenkinsfile: Fix GitLab commit status forwarding.

This commit is contained in:
/dev/urandom 2016-09-14 22:33:19 +02:00
parent d0702cffc5
commit 9fc98ad5b0
No known key found for this signature in database
GPG Key ID: 41322B973E0F295E

98
Jenkinsfile vendored
View File

@ -126,70 +126,72 @@ def doUnitTests(name, wsid) {
} }
} }
// First though let's give this build a proper name gitlabBuilds(builds: ["Checkout & Versioning", "Build", "Testing", "Archiving"]) {
stage("Checkout & Versioning") { // First though let's give this build a proper name
gitlabCommitStatus("Checkout & Versioning") { stage("Checkout & Versioning") {
node("windows") { gitlabCommitStatus("Checkout & Versioning") {
checkout scm node("windows") {
checkout scm
useShippedPremake { useShippedPremake {
def version = bat(returnStdout: true, script: '@premake5 version').split("\r?\n")[1] def version = bat(returnStdout: true, script: '@premake5 version').split("\r?\n")[1]
currentBuild.setDisplayName "$version (#${env.BUILD_NUMBER})" currentBuild.setDisplayName "$version (#${env.BUILD_NUMBER})"
}
} }
} }
} }
}
// For each available configuration generate a normal build and a unit test build. // For each available configuration generate a normal build and a unit test build.
stage("Build") { stage("Build") {
gitlabCommitStatus("Build") { gitlabCommitStatus("Build") {
def executions = [:] def executions = [:]
for (int i = 0; i < configurations.size(); i++) for (int i = 0; i < configurations.size(); i++)
{ {
def configuration = configurations[i] def configuration = configurations[i]
executions["$configuration"] = { executions["$configuration"] = {
doBuild("IW4x $configuration", "$configuration", "", configuration) doBuild("IW4x $configuration", "$configuration", "", configuration)
} }
executions["$configuration with unit tests"] = { executions["$configuration with unit tests"] = {
doBuild("IW4x $configuration (unit tests)", "$configuration+unittests", "--force-unit-tests", configuration) doBuild("IW4x $configuration (unit tests)", "$configuration+unittests", "--force-unit-tests", configuration)
}
} }
parallel executions
} }
parallel executions
} }
}
// Run unit tests on each configuration. // Run unit tests on each configuration.
stage("Testing") { stage("Testing") {
gitlabCommitStatus("Testing") { gitlabCommitStatus("Testing") {
executions = [:] executions = [:]
for (int i = 0; i < configurations.size(); i++) for (int i = 0; i < configurations.size(); i++)
{ {
def configuration = configurations[i] def configuration = configurations[i]
executions["$configuration"] = { executions["$configuration"] = {
doUnitTests("IW4x $configuration (unit tests)", configuration) doUnitTests("IW4x $configuration (unit tests)", configuration)
}
} }
parallel executions
} }
parallel executions
} }
}
// Collect all the binaries and give each configuration its own subfolder // Collect all the binaries and give each configuration its own subfolder
stage("Publishing") { stage("Archiving") {
gitlabCommitStatus("Publishing") { gitlabCommitStatus("Archiving") {
node("windows") { // any node will do node("windows") { // any node will do
ws("IW4x/pub") { ws("IW4x/pub") {
try { try {
for (int i = 0; i < configurations.size(); i++) for (int i = 0; i < configurations.size(); i++)
{ {
def configuration = configurations[i] def configuration = configurations[i]
dir("$configuration") { dir("$configuration") {
unstash "IW4x $configuration" unstash "IW4x $configuration"
}
} }
archiveArtifacts artifacts: "**/*.dll,**/*.pdb", fingerprint: true
} finally {
deleteDir()
} }
archiveArtifacts artifacts: "**/*.dll,**/*.pdb", fingerprint: true
} finally {
deleteDir()
} }
} }
} }