Adapt Jenkins Pipelines to the new build system.

This commit is contained in:
Nicolas Auvray 2024-08-20 19:34:28 +02:00
parent 0dd48ec57e
commit 270a48b37d
23 changed files with 310 additions and 1468 deletions

View File

@ -1,10 +1,11 @@
FROM debian:buster
FROM debian:buster-slim
RUN useradd -ms /bin/bash --uid 1006 builder
# 0 A.D. dependencies.
ARG DEBIAN_FRONTEND=noninteractive
ARG DEBCONF_NOWARNINGS="yes"
RUN apt-get -qqy update && apt-get install -qqy \
RUN apt-get -qqy update && apt-get install -qqy --no-install-recommends \
cmake \
curl \
libboost-dev \
@ -18,7 +19,6 @@ RUN apt-get -qqy update && apt-get install -qqy \
libgtk-3-dev \
libicu-dev \
libidn11-dev \
libjson-perl \
libminiupnpc-dev \
libogg-dev \
libopenal-dev \
@ -27,15 +27,22 @@ RUN apt-get -qqy update && apt-get install -qqy \
libsodium-dev \
libvorbis-dev \
libwxgtk3.0-dev \
libxcursor-dev \
libxml-simple-perl \
libxml2-dev \
make \
m4 \
patch \
python3-dev \
python3-pip \
subversion \
xz-utils \
zlib1g-dev \
&& apt-get clean
# Install git-lfs
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
RUN apt-get -qqy update && apt-get install -qqy --no-install-recommends git-lfs
RUN git lfs install --system --skip-smudge
# Install rust and Cargo via rustup
USER builder
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

View File

@ -1,6 +1,4 @@
FROM build-base:latest
# Obviously clang8 is not available but 13 is ^^"
FROM buster-base:latest
ARG DEBIAN_FRONTEND=noninteractive
ARG DEBCONF_NOWARNINGS="yes"

View File

@ -1,10 +0,0 @@
FROM 0ad-gcc7:latest
USER root
ARG DEBIAN_FRONTEND=noninteractive
ARG DEBCONF_NOWARNINGS="yes"
RUN apt-get install -qqy graphviz doxygen xsltproc lcov --no-install-recommends
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7 --slave /usr/bin/g++ g++ /usr/bin/g++-7 --slave /usr/bin/gcov gcov /usr/bin/gcov-7
USER builder

View File

@ -1,4 +1,4 @@
FROM build-base:latest
FROM buster-base:latest
ARG DEBIAN_FRONTEND=noninteractive
ARG DEBCONF_NOWARNINGS="yes"

View File

@ -1,23 +0,0 @@
FROM debian:bookworm-slim
ARG DEBIAN_FRONTEND=noninteractive
ARG DEBCONF_NOWARNINGS="yes"
RUN useradd -ms /bin/bash --uid 1006 builder
RUN apt-get -qq update && apt-get install -qqy --no-install-recommends \
python3-dev \
cppcheck \
git \
subversion \
libphutil \
php-cli \
php-curl \
curl \
&& apt-get clean
ENV SHELL /bin/bash
WORKDIR "/home/builder"
RUN curl -fsSLk https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
RUN chmod +x nodesource_setup.sh && ./nodesource_setup.sh && rm nodesource_setup.sh
RUN apt install nodejs -qqy
RUN npm install -g eslint@8.57.0 eslint-plugin-brace-rules
USER builder
RUN git clone https://github.com/phacility/arcanist.git ~/arcanist
ENV PATH="${PATH}:~/arcanist/bin/"

View File

@ -0,0 +1,13 @@
FROM python:3.12-slim-bookworm
ARG DEBIAN_FRONTEND=noninteractive
ARG DEBCONF_NOWARNINGS="yes"
RUN apt -qq update && apt install -qqy --no-install-recommends \
git \
git-lfs \
subversion \
&& apt clean
RUN git lfs install --system --skip-smudge
RUN pip3 install --upgrade lxml

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2022 Wildfire Games.
/* Copyright (C) 2024 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -15,40 +15,31 @@
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
*/
// This pipeline is used to build the design document.
// This pipeline runs source/tools/entity/checkrefs.py to identify
// mistakes and oversights in references to game content (assets,
// templates, etc).
pipeline {
agent {
node {
label 'LinuxSlave'
dockerfile {
label 'LinuxAgent'
customWorkspace 'workspace/checkrefs'
dir 'build/jenkins/dockerfiles'
filename 'tools.Dockerfile'
}
}
stages {
stage("Checkout") {
stage("Asset download") {
steps {
ws("/zpool0/design-docs"){
git "https://code.wildfiregames.com/source/design.git"
}
sh "git lfs pull -I binaries/data/mods/public/maps"
}
}
stage("Generate") {
stage("Data checks") {
steps {
ws("/zpool0/design-docs"){
sh "mkdocs build"
}
sh "cd source/tools/entity/ && python3 checkrefs.py -tax"
}
}
stage("Upload") {
steps {
ws("/zpool0/design-docs"){
sh "rsync -rti --delete-after --progress site/ docs.wildfiregames.com:~/www/design/"
}
}
}
}
post {
always {
step([$class: 'PhabricatorNotifier'])
}
}
}

View File

@ -1,194 +0,0 @@
/* Copyright (C) 2022 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 pipeline is used to build patches on various compilers.
def compilers = []
if (params["With Clang"])
{
compilers = ["clang7"]
}
else
{
compilers = ["gcc7"]
}
def patchesMap = compilers.collectEntries {
["${it}": patch(it)]
}
def patch(compiler) {
return {
stage("Patch: ${compiler}") {
try {
ws("/zpool0/${compiler}") {
sh "arc patch ${params.DIFF_ID} --force"
}
} catch(e) {
sh "sudo zfs rollback zpool0/${compiler}@latest"
throw e
}
}
}
}
def buildsMap = compilers.collectEntries {
["${it}": build(it)]
}
def build(compiler) {
return {
stage("Build: ${compiler}") {
try {
ws("/zpool0/${compiler}") {
docker.image("0ad-${compiler}:latest").inside {
script {
def NoAudioOption = ""
def NoPchOption = ""
def GlesOption = ""
def NoLobbyOption = ""
if (params["No PCH"])
{
NoPchOption="--without-pch "
}
if (params["OpenGL ES"])
{
GlesOption="--gles "
}
if (params["No Audio"])
{
NoAudioOption="--without-audio "
}
if (params["No Lobby"])
{
NoLobbyOption="--without-lobby "
}
sh "build/workspaces/update-workspaces.sh ${NoAudioOption}${GlesOption}${NoPchOption}${NoLobbyOption} -j1"
}
test_env="this is test env"
withEnv(["CXXFLAGS=${params.CXXFLAGS}", "CFLAGS=${params.CFLAGS}", "LDFLAGS=${params.LDFLAGS}"]){
if (params["CXXFLAGS"])
{
echo "Custom CXXFLAGS: ${env.CXXFLAGS}"
}
if (params["CFLAGS"])
{
echo "Custom CFLAGS: ${env.CFLAGS}"
}
if (params["Debug Build"])
{
def debugBuildErrorFile = "builderr-debug-${compiler}.log"
try {
try {
sh '''
CC_VERSION="$($CC --version | sed -e \'s/version//g\' -e \'s/(.*)//g' -e \'s/\\s//\' | sed 1q)"
CXX_VERSION="$($CXX --version | sed -e \'s/version//g\' -e \'s/(.*)//g' -e \'s/\\s//\' | sed 1q)"
echo "Building pyrogenesis in debug with $CC_VERSION/$CXX_VERSION using 2 jobs..."
'''
sh "cd build/workspaces/gcc/ && make config=debug clean && make -j2 config=debug 2> ../../../${debugBuildErrorFile}"
} catch(e) {
sh "rm -rf build/workspaces/gcc/obj/test_Debug"
throw e
}
} catch(e) {
throw e
} finally {
archiveArtifacts artifacts: "${debugBuildErrorFile}", fingerprint: true
}
def debugBuildTestFile = "cxxtest-debug-${compiler}.log"
try {
sh "binaries/system/test_dbg > ${debugBuildTestFile}"
} catch (e) {
echo (message: readFile (file: "${debugBuildTestFile}"))
throw e
} finally {
archiveArtifacts artifacts: "${debugBuildTestFile}", fingerprint: true
}
}
def releaseBuildErrorFile = "builderr-release-${compiler}.log"
try {
try {
sh '''
CC_VERSION="$($CC --version | sed -e \'s/version//g\' -e \'s/(.*)//g' -e \'s/\\s//\' | sed 1q)"
CXX_VERSION="$($CXX --version | sed -e \'s/version//g\' -e \'s/(.*)//g' -e \'s/\\s//\' | sed 1q)"
echo "Building pyrogenesis in release with $CC_VERSION/$CXX_VERSION using 2 jobs..."
'''
sh "cd build/workspaces/gcc/ && make clean && make -j2 config=release 2> ../../../${releaseBuildErrorFile}"
} catch(e) {
sh "rm -rf build/workspaces/gcc/obj/test_Release"
throw e
}
} catch(e) {
throw e
} finally {
archiveArtifacts artifacts: "${releaseBuildErrorFile}", fingerprint: true
}
def releaseBuildTestFile = "cxxtest-release-${compiler}.log"
try {
sh "binaries/system/test > ${releaseBuildTestFile}"
} catch (e) {
echo (message: readFile (file: "${releaseBuildTestFile}"))
throw e
} finally {
archiveArtifacts artifacts: "${releaseBuildTestFile}", fingerprint: true
}
}
}
}
} catch (e) {
throw e
} finally {
sh "sudo zfs rollback zpool0/${compiler}@latest"
}
}
}
}
pipeline {
agent {
node {
label 'LinuxSlave'
customWorkspace '/zpool0/trunk'
}
}
parameters {
string(name: 'DIFF_ID', defaultValue: '', description: 'ID of the Phabricator Differential.')
booleanParam(name: 'OpenGL ES', defaultValue: false, description: 'Build with --gles.')
booleanParam(name: 'No PCH', defaultValue: false, description: 'Build with --without-pch.')
booleanParam(name: 'No Audio', defaultValue: false, description: 'Build with --without-audio.')
booleanParam(name: 'No Lobby', defaultValue: false, description: 'Build with --without-lobby.')
}
stages {
stage("Patch") {
when { expression { return !!params.DIFF_ID } }
steps {
script { parallel patchesMap }
}
}
stage("Build") {
options {
timeout(time: 2, unit: 'HOURS')
}
steps {
script { parallel buildsMap }
}
}
}
}

View File

@ -1,261 +0,0 @@
/* Copyright (C) 2024 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 pipeline is used to build patches on various compilers.
def compilers = ["gcc7", "clang8"]
def patchesMap = compilers.collectEntries {
["${it}": patch(it)]
}
def patch(compiler) {
return {
stage("Patch: ${compiler}") {
try {
ws("/zpool0/${compiler}") {
sh "arc patch --diff ${params.DIFF_ID} --force"
}
} catch(e) {
reset("${compiler}").call()
throw e
}
}
}
}
def resetMap = compilers.collectEntries {
["${it}": reset(it)]
}
def reset(compiler)
{
return {
stage("Reset: ${compiler}") {
sleep 30
sh "sudo zfs rollback zpool0/${compiler}@latest"
}
}
}
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"
try {
retry(3) {
try {
sh "cd build/workspaces/gcc/ && make -j1 config=debug 2> ../../../builderr-debug-${compiler}.txt"
} catch(e) {
sh "rm -rf build/workspaces/gcc/obj/test_Debug"
throw e
}
}
} catch(e) {
throw e
} finally {
stash includes: "builderr-debug-${compiler}.txt", name: "build-debug-${compiler}"
}
try {
sh "binaries/system/test_dbg > cxxtest-debug-${compiler}.xml"
} catch (e) {
echo (message: readFile (file: "cxxtest-debug-${compiler}.xml"))
throw e
} finally {
stash includes: "cxxtest-debug-${compiler}.xml", name: "tests-debug-${compiler}"
}
try {
retry(3) {
try {
sh "cd build/workspaces/gcc/ && make -j1 config=release 2> ../../../builderr-release-${compiler}.txt"
} catch(e) {
sh "rm -rf build/workspaces/gcc/obj/test_Release"
throw e
}
}
} catch(e) {
throw e
} finally {
stash includes: "builderr-release-${compiler}.txt", name: "build-release-${compiler}"
}
try {
sh "binaries/system/test > cxxtest-release-${compiler}.xml"
} catch (e) {
echo (message: readFile (file: "cxxtest-release-${compiler}.xml"))
throw e
} finally {
stash includes: "cxxtest-release-${compiler}.xml", name: "tests-release-${compiler}"
}
}
}
} catch (e) {
throw e
} finally {
reset("${compiler}").call()
}
}
}
}
pipeline {
agent {
node {
label 'LinuxSlave'
customWorkspace '/zpool0/trunk'
}
}
parameters {
string(name: 'DIFF_ID', defaultValue: '', description: 'ID of the Phabricator Differential.')
string(name: 'PHID', defaultValue: '', description: 'Phabricator ID')
}
stages {
stage("Patch") {
when { expression { return !!params.DIFF_ID } }
steps {
script {
try {
sh "arc patch --diff ${params.DIFF_ID} --force"
script { parallel patchesMap }
} catch(e) {
// In case of failure, reset both, since they were patched together.
parallel resetMap
throw e
}
}
}
}
stage("Build") {
steps {
script {
try {
buildsMap.each { key, value ->
value.call()
}
} catch(e) {
// In case of failure, reset both, since they were patched together.
parallel resetMap
throw e
}
}
}
post {
always {
script {
for(compiler in compilers) {
catchError { unstash "build-debug-${compiler}" }
catchError { unstash "tests-debug-${compiler}" }
catchError { unstash "build-release-${compiler}" }
catchError { unstash "tests-release-${compiler}" }
}
}
catchError {
sh '''
for file in builderr-*.txt ; do
if [ -s "$file" ]; then
echo "$file" >> build-errors.txt
cat "$file" >> build-errors.txt
fi
done
'''
}
catchError { junit 'cxxtest*.xml' }
}
}
}
stage("Lint") {
steps {
script {
try {
docker.image("0ad-lint:latest").inside {
try {
// arc lint outputs an empty file on success - unless there is nothing to lint.
// On failure, it'll output the file and a failure error code.
// Explicitly checking for the file presence is thus best to detect the linter did run
sh '~/arcanist/bin/arc lint --never-apply-patches --output jenkins --outfile .phabricator-lint && touch .phabricator-lint'
}
catch (e) {
if (!fileExists(".phabricator-lint")) {
sh '''echo '{"General":[{"line": 0, "char": 0, "code": "Jenkins", "severity": "error", "name": "ci-error", "description": "Error running lint", "original": null, "replacement": null, "granularity": 1, "locations": [], "bypassChangedLineFiltering": true, "context": null}]}' > .phabricator-lint '''
}
else {
sh 'echo "error(s) were found running lint"'
}
}
finally {
stash includes: ".phabricator-lint", name: "Lint File"
}
}
}
finally {
unstash("Lint File")
if (fileExists(".phabricator-lint")) {
sh '''cat .phabricator-lint '''
}
}
}
}
}
stage("Data checks") {
steps {
warnError('CheckRefs.py script failed!') {
sh "cd source/tools/entity/ && python3 checkrefs.py -tax 2> data-errors.txt"
}
}
}
}
post {
always {
script {
catchError {
sh "if [ -s build-errors.txt ]; then cat build-errors.txt >> .phabricator-comment ; fi"
sh '''
if [ -s data-errors.txt ]; then
echo "Data checks errors:" >> .phabricator-comment
cat data-errors.txt >> .phabricator-comment
fi
'''
}
try {
if (fileExists(".phabricator-comment")) {
step([$class: 'PhabricatorNotifier', commentOnSuccess: true, commentWithConsoleLinkOnFailure: true, customComment: true, commentFile: ".phabricator-comment", processLint: true, lintFile: ".phabricator-lint"])
} else {
step([$class: 'PhabricatorNotifier', commentWithConsoleLinkOnFailure: true, processLint: true, lintFile: ".phabricator-lint"])
}
} catch(e) {
throw e
} finally {
sh "sudo zfs rollback zpool0/trunk@latest"
}
}
}
}
}

View File

@ -1,87 +0,0 @@
/* Copyright (C) 2022 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 pipeline is used to build a clean base from scratch in order to
// use ZFS snapshots efficiently.
def compilers = ["gcc7", "clang7"]
def volumeUpdatesMap = compilers.collectEntries {
["${it}": volumeUpdate(it)]
}
def volumeUpdate(compiler) {
return {
stage("Recreate: ${compiler}") {
sh "sudo zfs clone zpool0/trunk@base zpool0/${compiler}"
}
}
}
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"
sh "binaries/system/test_dbg"
sh "cd build/workspaces/gcc/ && make -j1 config=release"
sh "binaries/system/test"
}
}
} catch (e) {
throw e
} finally {
sh "sudo zfs snapshot zpool0/${compiler}@latest"
}
}
}
}
pipeline {
agent {
node {
label 'LinuxSlave'
customWorkspace '/zpool0/trunk'
}
}
stages {
stage("Volume updates") {
steps {
// Note: latest must always be the last snapshot in order to be able to rollback to it
sh "sudo zfs rollback zpool0/trunk@latest"
sh "sudo zfs destroy -R zpool0/trunk@latest"
sh "sudo zfs destroy -R zpool0/trunk@base"
sh "sudo zfs snapshot zpool0/trunk@base"
sh "sudo zfs snapshot zpool0/trunk@latest"
script { parallel volumeUpdatesMap }
}
}
stage("Build") {
steps {
script { parallel buildsMap }
}
}
}
}

View File

@ -1,100 +0,0 @@
/* Copyright (C) 2024 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 a helper pipeline to build Docker images and setup ZFS volumes.
pipeline {
agent {
node {
label 'LinuxSlave'
customWorkspace '/zpool0/trunk'
}
}
parameters {
booleanParam(name: 'no-cache', defaultValue: false, description: 'Rebuild containers from scratch')
booleanParam(name: 'reset-volumes', defaultValue: false, description: 'Reset ZFS volumes')
}
stages {
stage("Cleanup") {
steps {
sh 'docker system prune -f'
}
}
stage("Full Rebuild") {
when {
environment name: 'no-cache', value: 'true'
}
steps {
sh 'docker build --no-cache -t build-base ~/dockerfiles/build-base'
sh 'docker build --no-cache -t 0ad-gcc7 ~/dockerfiles/gcc7'
sh 'docker build --no-cache -t 0ad-gcc7-docs ~/dockerfiles/gcc7-docs'
sh 'docker build --no-cache -t 0ad-clang8 ~/dockerfiles/clang8'
sh 'docker build --no-cache -t 0ad-translations ~/dockerfiles/translations'
sh 'docker build --no-cache -t 0ad-lint ~/dockerfiles/lint'
}
}
stage("Build") {
when {
environment name: 'no-cache', value: 'true'
}
steps {
sh 'docker build -t build-base ~/dockerfiles/build-base'
sh 'docker build -t 0ad-gcc7 ~/dockerfiles/gcc7'
sh 'docker build -t 0ad-gcc7-docs ~/dockerfiles/gcc7-docs'
sh 'docker build -t 0ad-clang8 ~/dockerfiles/clang8'
sh 'docker build -t 0ad-translations ~/dockerfiles/translations'
sh 'docker build -t 0ad-lint ~/dockerfiles/lint'
sh """
docker rmi debian:buster
DANGLING_IMAGES="\$(docker images --filter \"\"\"dangling=true\"\"\" -q --no-trunc)"
if [ -n "\$DANGLING_IMAGES" ]; then
echo "Removing dangling images: \$DANGLING_IMAGES"
docker rmi \$(docker images --filter \"\"\"dangling=true\"\"\" -q --no-trunc)
echo "Done."
else
echo "No dangling images found."
fi
"""
}
}
stage("Update") {
steps {
sh "svn cleanup 2>/dev/null || true"
svn "https://svn.wildfiregames.com/public/ps/trunk"
sh "svn st --no-ignore | cut -c 9- | xargs rm -rf"
sh "svn revert -R ."
}
}
stage("Volumes") {
when {
environment name: 'reset-volumes', value: 'true'
}
steps {
sh "sudo zfs destroy -R zpool0/trunk@base || true"
sh "sudo zfs destroy -R zpool0/trunk@latest || true"
sh "sudo zfs snapshot zpool0/trunk@base"
sh "sudo zfs clone zpool0/trunk@base zpool0/gcc7"
sh "sudo zfs clone zpool0/trunk@base zpool0/clang8"
sh "sudo zfs snapshot zpool0/trunk@latest"
sh "sudo zfs snapshot zpool0/clang8@latest"
sh "sudo zfs snapshot zpool0/gcc7@latest"
}
}
}
}

View File

@ -1,64 +0,0 @@
/* Copyright (C) 2022 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 pipeline is used to build the documentation.
pipeline {
agent {
node {
label 'LinuxSlave'
}
}
stages {
stage("Setup") {
steps {
sh "sudo zfs clone zpool0/gcc7@latest zpool0/docker-nopch"
}
}
stage("Build") {
steps {
ws("/zpool0/docker-nopch"){
dir('build/workspaces/'){
sh "./update-workspaces.sh -j1 --without-pch"
dir('gcc/'){
sh "make clean"
sh "make -j1"
}
}
}
}
}
stage("Test") {
steps {
ws("/zpool0/docker-nopch"){
dir('build/workspaces/gcc'){
// as where it was built else nothing is generated.
sh "../../../binaries/system/test"
}
}
}
}
}
post {
always {
ws("/zpool0/trunk") {
sleep 10
sh "sudo zfs destroy zpool0/docker-nopch"
}
}
}
}

View File

@ -1,147 +0,0 @@
/* 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'])
}
}
}

View File

@ -0,0 +1,120 @@
/* Copyright (C) 2024 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 pipeline builds the game on Linux (with min and max supported versions of GCC and clang) and runs tests.
pipeline {
agent none
stages {
stage("Setup") {
agent {
node {
label 'LinuxAgent'
customWorkspace 'workspace/linux'
}
}
steps {
discoverGitReferenceBuild()
sh "cd build/jenkins/dockerfiles/ && docker build -t buster-base -f buster-base.Dockerfile ."
}
}
stage("Linux Build") {
failFast true
matrix {
axes {
axis {
name 'JENKINS_COMPILER'
values 'gcc7' //, 'gcc14', 'clang8', 'clang18'
}
axis {
name 'JENKINS_PCH'
values 'pch' //, 'no-pch'
}
}
agent {
dockerfile {
label 'LinuxAgent'
customWorkspace "workspace/${JENKINS_COMPILER}-${JENKINS_PCH}"
dir 'build/jenkins/dockerfiles'
filename "${JENKINS_COMPILER}.Dockerfile"
}
}
stages {
stage("Pre-build") {
steps {
sh "git lfs pull -I binaries/data/tests"
sh "git lfs pull -I \"binaries/data/mods/_test.*\""
sh "libraries/build-source-libs.sh -j1 2> ${JENKINS_COMPILER}-prebuild-errors.log"
script {
if (env.JENKINS_PCH == "no-pch") {
sh "build/workspaces/update-workspaces.sh -j1 --jenkins-tests --without-pch 2>> ${JENKINS_COMPILER}-prebuild-errors.log"
} else {
sh "build/workspaces/update-workspaces.sh -j1 --jenkins-tests 2>> ${JENKINS_COMPILER}-prebuild-errors.log"
}
}
}
post {
failure {
echo (message: readFile (file: "${JENKINS_COMPILER}-prebuild-errors.log"))
}
}
}
stage("Debug Build") {
steps {
sh "cd build/workspaces/gcc/ && make -j1 config=debug"
timeout(time: 15) {
sh "cd binaries/system/ && ./test_dbg > cxxtest-debug.xml"
}
}
post {
always {
junit 'binaries/system/cxxtest-debug.xml'
}
}
}
stage("Release Build") {
steps {
sh "cd build/workspaces/gcc/ && make -j1 config=release"
timeout(time: 15) {
sh "cd binaries/system/ && ./test > cxxtest-release.xml"
}
}
post {
always {
junit 'binaries/system/cxxtest-release.xml'
}
}
}
}
}
post {
always {
node('LinuxSlave') { ws('workspace/linux') {
recordIssues enabledForFailure: true, qualityGates: [[threshold: 1, type: 'NEW']], tools: [clang(), gcc()]
}}
}
}
}
}
}

View File

@ -0,0 +1,80 @@
/* Copyright (C) 2024 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 pipeline builds the game on macOS (which uses the clang-10 compiler) and runs tests.
pipeline {
agent {
node {
label 'macOSAgent'
customWorkspace 'workspace/clang10'
}
}
stages {
stage ("Pre-build") {
steps {
discoverGitReferenceBuild()
sh "git lfs pull -I binaries/data/tests"
sh "git lfs pull -I \"binaries/data/mods/_test.*\""
sh "libraries/build-macos-libs.sh -j4 2> macos-prebuild-errors.log"
sh "build/workspaces/update-workspaces.sh -j4 --jenkins-tests 2>> macos-prebuild-errors.log"
}
post {
failure {
echo (message: readFile (file: "macos-prebuild-errors.log"))
}
}
}
stage("Debug Build") {
steps {
sh "cd build/workspaces/gcc/ && make -j4 config=debug"
timeout(time: 15) {
sh "cd binaries/system/ && ./test_dbg > cxxtest-debug.xml"
}
}
post {
always {
junit 'binaries/system/cxxtest-debug.xml'
}
}
}
stage("Release Build") {
steps {
sh "cd build/workspaces/gcc/ && make -j4 config=release"
timeout(time: 15) {
sh "cd binaries/system/ && ./test > cxxtest-release.xml"
}
}
post {
always {
junit 'binaries/system/cxxtest-release.xml'
}
}
}
}
post {
always {
recordIssues enabledForFailure: true, qualityGates: [[threshold: 1, type: 'NEW']], tool: clang()
}
}
}

View File

@ -1,143 +0,0 @@
/* 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/>.
*/
pipeline {
agent { label 'MacSlave' }
options {
skipDefaultCheckout()
}
parameters {
string(name: 'DIFF_ID', defaultValue: '', description: 'ID of the Phabricator Differential.')
string(name: 'PHID', defaultValue: '', description: 'Phabricator ID')
booleanParam(name: 'CLEAN_WORKSPACE', defaultValue: false, description: 'Delete the workspace before compiling (NB: does not delete the compiled libraries)')
}
stages {
stage ("Checkout") {
options {
retry(3)
}
steps {
script {
try {
sh "svn update"
} catch(e) {
sh "svn cleanup"
sleep 300
throw e
}
}
sh "svn cleanup"
}
}
stage ("Patch") {
steps {
script {
try {
sh "arc patch --diff ${params.DIFF_ID} --force"
} catch (e) {
sh "svn st binaries/data/ | cut -c 9- | xargs rm -rfv"
sh "svn st source/ | cut -c 9- | xargs rm -rfv"
sh "svn st -q | cut -c 9- | xargs rm -rfv"
sh "svn revert -R ."
sh "arc patch --diff ${params.DIFF_ID} --force"
}
}
}
}
stage("macOS libraries build") {
steps {
sh "cd libraries/osx/ && ./build-osx-libs.sh -j4"
}
}
stage("Update workspaces") {
steps {
script {
if (params.CLEAN_WORKSPACE) {
sh "rm -rf build/workspaces/gcc"
}
sh "cd build/workspaces/ && ./update-workspaces.sh -j4 --jenkins-tests"
}
}
}
stage("Debug Build & Tests") {
steps {
sh "cd build/workspaces/gcc/ && make -j4 config=debug 2> ../../../builderr-debug-macos.txt"
script {
try {
sh "binaries/system/test_dbg > cxxtest-debug.xml"
} catch (e) {
echo (message: readFile (file: "cxxtest-debug.xml"))
throw e
} finally {
junit "cxxtest-debug.xml"
}
}
}
}
stage("Release Build & Tests") {
steps {
sh "cd build/workspaces/gcc/ && make -j4 config=release 2> ../../../builderr-release-macos.txt"
script {
try {
sh "binaries/system/test > cxxtest-release.xml"
} catch (e) {
echo (message: readFile (file: "cxxtest-release.xml"))
throw e
} finally {
junit "cxxtest-release.xml"
}
}
}
}
}
post {
always {
script {
catchError {
sh '''
for file in builderr-*.txt ; do
if [ -s "$file" ]; then
echo "$file" >> .phabricator-comment
cat "$file" >> .phabricator-comment
fi
done
'''
}
try {
if (fileExists(".phabricator-comment")) {
step([$class: 'PhabricatorNotifier', commentOnSuccess: true, commentWithConsoleLinkOnFailure: true, customComment: true, commentFile: ".phabricator-comment"])
} else {
step([$class: 'PhabricatorNotifier', commentWithConsoleLinkOnFailure: true])
}
} catch(e) {
throw e
} finally {
sh "rm -f .phabricator-comment builderr-*.txt cxxtest-*.xml"
sh "svn st binaries/data/ | cut -c 9- | xargs rm -rfv"
sh "svn st source/ | cut -c 9- | xargs rm -rfv"
sh "svn st -q | cut -c 9- | xargs rm -rfv"
sh "svn revert -R ."
}
}
}
}
}

View File

@ -1,98 +0,0 @@
/* 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/>.
*/
pipeline {
agent { label 'MacSlave' }
parameters {
string(name: 'SVN_REV', defaultValue: '', description: 'For instance 21000')
string(name: 'PHID', defaultValue: '', description: 'Phabricator ID')
booleanParam(name: 'CLEAN_WORKSPACE', defaultValue: false, description: 'Delete the workspace before compiling (NB: does not delete the compiled libraries)')
}
stages {
stage("Checkout") {
options {
// Account for network errors
retry(3)
}
steps {
script {
try {
svn "https://svn.wildfiregames.com/public/ps/trunk@${params.SVN_REV}"
} catch(e) {
sh "svn cleanup"
sleep 300
throw e
}
}
sh "svn cleanup"
}
}
stage("macOS libraries build") {
steps {
sh "cd libraries/osx/ && ./build-osx-libs.sh -j4"
}
}
stage("Update workspaces") {
steps {
script {
if (params.CLEAN_WORKSPACE) {
sh "rm -rf build/workspaces/gcc"
}
sh "cd build/workspaces/ && ./update-workspaces.sh -j4 --jenkins-tests"
}
}
}
stage("Debug Build & Tests") {
steps {
sh "cd build/workspaces/gcc/ && make -j4 config=debug"
script {
try {
sh "binaries/system/test_dbg > cxxtest-debug.xml"
} catch (e) {
echo (message: readFile (file: "cxxtest-debug.xml"))
throw e
} finally {
junit "cxxtest-debug.xml"
}
}
}
}
stage("Release Build & Tests") {
steps {
sh "cd build/workspaces/gcc/ && make -j4 config=release"
script {
try {
sh "binaries/system/test > cxxtest-release.xml"
} catch (e) {
echo (message: readFile (file: "cxxtest-release.xml"))
throw e
} finally {
junit "cxxtest-release.xml"
}
}
}
}
}
post {
always {
step([$class: 'PhabricatorNotifier'])
}
}
}

View File

@ -1,139 +0,0 @@
/* 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 pipeline builds Windows binaries. It is run at most daily, every
// time a commit touches the source code.
def AtlasOption = ""
def GlooxOption = ""
def AtlasPrj = ""
def output = ""
def jobs = "2"
pipeline {
agent { label 'WindowsSlave' }
parameters {
booleanParam(name: 'pyrogenesis', defaultValue: true, description: 'Build and commit the main executable.')
booleanParam(name: 'atlas', defaultValue: false, description: 'Build and commit the AtlasUI library.')
booleanParam(name: 'collada', defaultValue: false, description: 'Build and commit the Collada library.')
booleanParam(name: 'gloox', defaultValue: false, description: 'Build and commit the gloox wrapper.')
}
stages {
stage("Checkout") {
options {
// Account for network errors
retry(3)
}
steps {
script {
try {
checkout([$class: 'SubversionSCM', locations: [[credentialsId: 'redacted', local: '.', remote: 'https://svn.wildfiregames.com/svn/ps/trunk']]])
} catch(e) {
bat "svn cleanup"
sleep 300
throw e
}
}
bat "svn cleanup"
}
}
stage('Setup workspace') {
steps {
bat "del binaries\\system\\pyrogenesis.pdb binaries\\system\\pyrogenesis.exe"
script {
if (env.atlas == 'true') {
echo "atlas is enabled"
AtlasOption = "--atlas"
AtlasPrj = "/t:AtlasUI /t:ActorEditor"
bat "(robocopy /MIR C:\\wxwidgets-3.1.4\\lib libraries\\win32\\wxwidgets\\lib) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "(robocopy /MIR C:\\wxwidgets-3.1.4\\include libraries\\win32\\wxwidgets\\include) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "del binaries\\system\\AtlasUI.dll"
}
if (env.gloox == 'true') {
echo "gloox is enabled"
GlooxOption = "--build-shared-glooxwrapper"
bat "del binaries\\system\\glooxwrapper.pdb binaries\\system\\glooxwrapper.lib binaries\\system\\glooxwrapper.dll"
bat "del binaries\\system\\glooxwrapper_dbg.pdb binaries\\system\\glooxwrapper_dbg.lib binaries\\system\\glooxwrapper_dbg.dll"
}
if (env.collada == 'true') {
echo "collada is enabled"
bat "del binaries\\system\\Collada.dll"
}
output = bat(returnStdout: true, script: 'svnversion source -n').trim()
output = (output.readLines().drop(1).join("").toInteger() + 1)
}
bat "cd build\\workspaces && update-workspaces.bat ${AtlasOption} ${GlooxOption} --large-address-aware --jenkins-tests"
bat "echo L\"${output}\" > build\\svn_revision\\svn_revision.txt"
bat "echo ${output}"
}
}
stage ('Build') {
steps {
bat("cd build\\workspaces\\vs2017 && \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe\" pyrogenesis.sln /nologo /p:XPDeprecationWarning=false /p:XPDeprecationWarning=false /m:${jobs} /p:PlatformToolset=v141_xp /t:pyrogenesis ${AtlasPrj} /t:test /p:Configuration=Release")
}
}
stage ('Build debug glooxwrapper') {
when { environment name: 'gloox', value: 'true'}
steps {
bat("cd build\\workspaces\\vs2017 && \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe\" pyrogenesis.sln /nologo /p:XPDeprecationWarning=false /p:XPDeprecationWarning=false /m:${jobs} /p:PlatformToolset=v141_xp /t:glooxwrapper /p:Configuration=Debug")
}
}
stage ('Tests') {
steps {
bat 'binaries\\system\\test.exe'
}
}
stage ('Commit') {
options {
// Account for network errors
retry(3)
}
steps {
bat "svn changelist --remove --recursive --cl commit ."
script {
if (env.pyrogenesis == 'true') {
bat "svn changelist commit binaries\\system\\pyrogenesis.pdb binaries\\system\\pyrogenesis.exe"
}
if (env.atlas == 'true') {
bat "svn changelist commit binaries\\system\\AtlasUI.dll binaries\\system\\ActorEditor.exe"
}
if (env.collada == 'true') {
bat "svn changelist commit binaries\\system\\Collada.dll"
}
if (env.gloox == 'true') {
bat "svn changelist commit binaries\\system\\glooxwrapper.dll binaries\\system\\glooxwrapper.lib binaries\\system\\glooxwrapper.pdb binaries\\system\\glooxwrapper_dbg.dll binaries\\system\\glooxwrapper_dbg.lib binaries\\system\\glooxwrapper_dbg.pdb"
}
}
withCredentials([usernamePassword(credentialsId: 'redacted', passwordVariable: 'SVNPASS', usernameVariable: 'SVNUSER')]) {
bat 'svn commit --username %SVNUSER% --password %SVNPASS% --no-auth-cache --non-interactive --changelist commit -m "[Windows] Automated build."'
}
}
}
}
post {
always {
bat "svn revert -R ."
}
}
}

View File

@ -1,169 +0,0 @@
/* Copyright (C) 2022 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 pipeline is used to build patches on MSVC 15.0 (Visual Studio 2017).
def jobs = "2"
def visualStudioPath = "\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe\""
def cleanFiles() {
bat 'powershell.exe "svn st -q | ForEach-Object { Remove-Item -ErrorAction Ignore -Recurse -Force -Verbose -LiteralPath $_.substring(8) } " '
bat 'powershell.exe "svn st binaries/data | ForEach-Object { Remove-Item -ErrorAction Ignore -Recurse -Verbose -Force -LiteralPath $_.substring(8) } " '
bat 'powershell.exe "svn st source/ | ForEach-Object { Remove-Item -ErrorAction Ignore -Recurse -Force -Verbose -LiteralPath $_.substring(8) } " '
bat 'svn revert -R .'
}
pipeline {
agent { label 'WindowsSlave' }
options {
skipDefaultCheckout()
}
parameters {
string(name: 'DIFF_ID', defaultValue: '', description: 'ID of the Phabricator Differential.')
string(name: 'PHID', defaultValue: '', description: 'Phabricator ID')
}
stages {
stage ('Checkout') {
options {
retry(3)
}
steps {
script {
try {
svn "https://svn.wildfiregames.com/public/ps/trunk"
} catch(e) {
bat "svn cleanup"
sleep 300
throw e
}
}
bat "svn cleanup"
}
}
stage ('Patch') {
steps {
script {
try {
bat "arc patch --diff ${params.DIFF_ID} --force"
} catch (e) {
cleanFiles()
bat "arc patch --diff ${params.DIFF_ID} --force"
}
}
}
}
stage ('Update-Workspace') {
steps {
bat "(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC C:\\wxwidgets3.0.4\\lib libraries\\win32\\wxwidgets\\lib) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC C:\\wxwidgets3.0.4\\include libraries\\win32\\wxwidgets\\include) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "cd build\\workspaces && update-workspaces.bat --atlas --build-shared-glooxwrapper --jenkins-tests"
}
}
stage ('Debug: Build') {
steps {
dir('build\\workspaces\\vs2017'){
bat("${visualStudioPath} pyrogenesis.sln /nologo /p:XPDeprecationWarning=false /m:${jobs} /p:PlatformToolset=v141_xp /t:pyrogenesis /t:AtlasUI /t:test /p:Configuration=Debug -clp:Warningsonly -clp:ErrorsOnly > ..\\..\\..\\build-errors-debug.txt 2>&1")
}
}
post {
always {
bat "if exist build-errors-debug.txt type build-errors-debug.txt"
}
}
}
stage ('Debug: Test') {
options {
timeout(time: 30)
}
steps {
catchError {
script {
try {
bat 'binaries\\system\\test_dbg.exe > cxxtest_debug.xml'
} catch(err) {
echo (message: readFile (file: "cxxtest_debug.xml"))
}
}
}
}
post {
failure {
echo (message: readFile (file: "cxxtest_debug.xml"))
archiveArtifacts artifacts: "cxxtest_debug.xml", fingerprint: true
}
always {
junit "cxxtest_debug.xml"
archiveArtifacts artifacts: "cxxtest_debug.xml", fingerprint: true
}
}
}
stage ('Release: Build') {
steps {
dir('build\\workspaces\\vs2017'){
bat("${visualStudioPath} pyrogenesis.sln /nologo /p:XPDeprecationWarning=false /m:${jobs} /p:PlatformToolset=v141_xp /t:pyrogenesis /t:AtlasUI /t:test /p:Configuration=Release -clp:Warningsonly -clp:ErrorsOnly > ..\\..\\..\\build-errors-release.txt 2>&1")
}
}
post {
always {
bat "if exist build-errors-release.txt type build-errors-release.txt"
}
}
}
stage ('Release: Test') {
options {
timeout(time: 30)
}
steps {
bat 'binaries\\system\\test.exe > cxxtest_release.xml'
}
post {
failure {
echo (message: readFile (file: "cxxtest_release.xml"))
}
always {
junit "cxxtest_release.xml"
}
}
}
}
post {
always {
script {
catchError {
bat 'powershell.exe "if (![String]::IsNullOrWhiteSpace((Get-Content -ErrorAction Ignore -Path build-errors-debug.txt))) { Add-Content .phabricator-comment Debug: }" '
bat "if exist build-errors-debug.txt type build-errors-debug.txt >> .phabricator-comment"
bat 'powershell.exe "if (![String]::IsNullOrWhiteSpace((Get-Content -ErrorAction Ignore -Path build-errors-release.txt))) { Add-Content .phabricator-comment Release: }" '
bat "if exist build-errors-release.txt type build-errors-release.txt >> .phabricator-comment"
}
try {
if (fileExists(".phabricator-comment")) {
bat "if exist .phabricator-comment type .phabricator-comment"
step([$class: 'PhabricatorNotifier', commentOnSuccess: true, commentWithConsoleLinkOnFailure: true, customComment: true, commentFile: ".phabricator-comment"])
}
} catch(e) {
throw e
} finally {
bat 'del .phabricator-comment'
bat 'del build-errors-debug.txt'
bat 'del build-errors-release.txt'
bat 'del cxxtest_*.xml'
cleanFiles()
}
}
}
}
}

View File

@ -0,0 +1,68 @@
/* Copyright (C) 2024 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 pipeline builds the game on Windows (which uses the MSVC 15.0 compiler from Visual Studio 2017) and runs tests.
def visualStudioPath = "\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe\""
def buildOptions = "/p:PlatformToolset=v141_xp /p:XPDeprecationWarning=false /t:pyrogenesis /t:AtlasUI /t:test /m:2 /nologo -clp:NoSummary"
pipeline {
agent {
node {
label 'WindowsAgent'
customWorkspace 'workspace/vs2017'
}
}
stages {
stage ("Pre-build") {
steps {
discoverGitReferenceBuild()
bat "git lfs pull -I binaries/data/tests"
bat "git lfs pull -I \"binaries/data/mods/_test.*\""
bat "cd libraries && get-windows-libs.bat"
bat "(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC C:\\wxwidgets3.0.4\\lib libraries\\win32\\wxwidgets\\lib) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC C:\\wxwidgets3.0.4\\include libraries\\win32\\wxwidgets\\include) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "cd build\\workspaces && update-workspaces.bat --atlas --jenkins-tests"
}
}
stage ("Release Build") {
steps {
dir('build\\workspaces\\vs2017'){
bat("${visualStudioPath} pyrogenesis.sln /p:Configuration=Release ${buildOptions}")
}
timeout(time: 5) {
bat "cd binaries\\system && test.exe > cxxtest-release.xml"
}
}
post {
always {
junit 'binaries/system/cxxtest-release.xml'
}
}
}
}
post {
always {
recordIssues enabledForFailure: true, qualityGates: [[threshold: 1, type: 'NEW']], tool: msBuild()
}
}
}