Debian Codegraph @

build/jenkins/pipelines/freeBSD.Jenkinsfile

raw
1 /* Copyright (C) 2025 Wildfire Games.
2 * This file is part of 0 A.D.
3 *
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 // This pipeline builds the game on FreeBSD (which uses the clang-17 compiler) and runs tests.
19 // Due to a compilation bug with SpiderMonkey, the game is only built with the release configuration.
20
21 pipeline {
22 // Stop previous build in pull requests, but not in branches
23 options { disableConcurrentBuilds(abortPrevious: env.CHANGE_ID != null) }
24
25 parameters {
26 booleanParam description: 'Non-incremental build', name: 'CLEANBUILD'
27 }
28
29 agent {
30 node {
31 label 'FreeBSDAgent'
32 customWorkspace 'workspace/clang17'
33 }
34 }
35
36 environment {
37 USE = 'iconv'
38 WX_CONFIG = '/usr/local/bin/wxgtk3u-3.2-config'
39 CXXFLAGS = '-stdlib=libc++ '
40 LLVM_OBJDUMP = '/usr/bin/llvm-objdump'
41 }
42
43 stages {
44 stage('Pre-build') {
45 steps {
46 sh 'git lfs pull -I binaries/data/tests'
47 sh 'git lfs pull -I "binaries/data/mods/_test.*"'
48
49 sh "libraries/build-source-libs.sh ${JOBS} 2> freebsd-prebuild-errors.log"
50 sh 'build/workspaces/update-workspaces.sh 2>> freebsd-prebuild-errors.log'
51
52 script {
53 if (params.CLEANBUILD) {
54 sh 'cd build/workspaces/gcc/ && gmake clean config=release'
55 }
56 }
57 }
58 post {
59 failure {
60 echo(message: readFile(file: 'freebsd-prebuild-errors.log'))
61 }
62 }
63 }
64
65 stage('Release Build') {
66 steps {
67 sh '''
68 rm -f thepipe
69 mkfifo thepipe
70 tee build.log < thepipe &
71 gmake -C build/workspaces/gcc/ ${JOBS} config=release > thepipe 2>&1
72 status=$?
73 rm thepipe
74 exit ${status}
75 '''
76 }
77 post {
78 failure {
79 script {
80 if (!params.CLEANBUILD) {
81 build wait: false, job: "$JOB_NAME", parameters: [booleanParam(name: 'CLEANBUILD', value: true)]
82 }
83 }
84 }
85 always {
86 script {
87 recordIssues(
88 tool: analysisParser(
89 analysisModelId: 'clang',
90 name: 'Release Build',
91 id : 'release',
92 pattern: 'build.log'
93 ),
94 skipPublishingChecks: true,
95 enabledForFailure: true,
96 qualityGates: [[threshold: 1, type: 'TOTAL', criticality: 'FAILURE']]
97 )
98 }
99 }
100 }
101 }
102
103 stage('Release Tests') {
104 steps {
105 timeout(time: 15) {
106 sh './binaries/system/test --format junit --output cxxtest.xml'
107 }
108 }
109 post {
110 always {
111 junit(skipPublishingChecks: true, testResults: 'cxxtest.xml')
112 }
113 }
114 }
115 }
116 }