0ad/build/jenkins/pipelines/docker-svn.Jenkinsfile
bb 157c6af18e Make the space in 0 A.D. non-breaking throughout the codebase.
Avoid cases of filenames
Update years in terms and other legal(ish) documents
Don't update years in license headers, since change is not meaningful

Will add linter rule in seperate commit

Happy recompiling everyone!

Original Patch By: Nescio
Comment By: Gallaecio
Differential Revision: D2620
This was SVN commit r27786.
2023-07-27 20:54:46 +00:00

147 lines
3.8 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* 0 A.D. is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
*/
// This is the post-commit pipeline.
// In case of success, it provides a clean base for incremental builds
// with the `differential` pipeline.
def compilers = ["gcc7"]
def volumeUpdatesMap = compilers.collectEntries {
["${it}": volumeUpdate(it)]
}
def volumeUpdate(compiler) {
return {
stage("Update: ${compiler}") {
ws("/zpool0/${compiler}") {
sh "svn up -r ${params.SVN_REV}"
}
}
}
}
def buildsMap = compilers.collectEntries {
["${it}": build(it)]
}
def build(compiler) {
return {
stage("Build: ${compiler}") {
try {
ws("/zpool0/${compiler}") {
docker.image("0ad-${compiler}:latest").inside {
sh "build/workspaces/update-workspaces.sh -j1 --jenkins-tests"
sh "cd build/workspaces/gcc/ && make -j1 config=debug"
try {
sh "binaries/system/test_dbg > cxxtest-debug-${compiler}.xml"
} catch (e) {
echo (message: readFile (file: "cxxtest-debug-${compiler}.xml"))
throw e
} finally {
catchError {
sh "sed -i 's/date/timestamp/g' cxxtest-debug-${compiler}.xml"
}
stash includes: "cxxtest-debug-${compiler}.xml", name: "tests-debug-${compiler}"
}
sh "cd build/workspaces/gcc/ && make -j1 config=release"
try {
sh "binaries/system/test > cxxtest-release-${compiler}.xml"
} catch (e) {
echo (message: readFile (file: "cxxtest-release-${compiler}.xml"))
throw e
} finally {
catchError {
sh "sed -i 's/date/timestamp/g' cxxtest-release-${compiler}.xml"
}
stash includes: "cxxtest-release-${compiler}.xml", name: "tests-release-${compiler}"
}
}
}
sh "sudo zfs destroy zpool0/${compiler}@latest"
sh "sudo zfs snapshot zpool0/${compiler}@latest"
} catch (e) {
sh "sudo zfs rollback zpool0/${compiler}@latest"
throw e
}
}
}
}
pipeline {
agent {
node {
label 'LinuxSlave'
customWorkspace '/zpool0/trunk'
}
}
parameters {
string(name: 'SVN_REV', defaultValue: '', description: 'For instance 21000')
string(name: 'PHID', defaultValue: '', description: 'Phabricator ID')
}
stages {
stage("Update") {
steps {
sh "svn cleanup 2>/dev/null || true"
svn "https://svn.wildfiregames.com/public/ps/trunk@${params.SVN_REV}"
sh "svn st --no-ignore | cut -c 9- | xargs rm -rf"
sh "svn revert -R ."
}
}
stage("Volume updates") {
steps {
script { parallel volumeUpdatesMap }
}
}
stage("Build") {
steps {
script { parallel buildsMap }
}
post {
always {
script {
for(compiler in compilers) {
catchError { unstash "tests-debug-${compiler}" }
catchError { unstash "tests-release-${compiler}" }
}
}
catchError { junit 'cxxtest*.xml' }
}
failure {
sh "sudo zfs rollback zpool0/trunk@latest"
}
success {
sh "sudo zfs destroy -R zpool0/trunk@latest"
sh "sudo zfs snapshot zpool0/trunk@latest"
}
}
}
stage("Data checks") {
steps {
sh "cd source/tools/entity/ && perl checkrefs.pl --check-map-xml --validate-templates"
}
}
}
post {
always {
step([$class: 'PhabricatorNotifier'])
}
}
}