Debian Codegraph @

build/jenkins/pipelines/macOS.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 macOS (which uses the clang-10 compiler) and runs tests.
19
20 pipeline {
21 // Stop previous build in pull requests, but not in branches
22 options { disableConcurrentBuilds(abortPrevious: env.CHANGE_ID != null) }
23
24 parameters {
25 booleanParam description: 'Non-incremental build', name: 'CLEANBUILD'
26 }
27
28 agent none
29
30 stages {
31 stage('macOS builds') {
32 matrix {
33 axes {
34 axis {
35 name 'BUILD_TYPE'
36 values 'debug', 'release'
37 }
38 }
39
40 stages {
41 stage('Run') {
42 agent {
43 node {
44 label 'macOSAgentVentura'
45 customWorkspace 'workspace/clang13'
46 }
47 }
48
49 stages {
50 stage('Pre-build') {
51 steps {
52 sh 'git lfs pull -I binaries/data/tests'
53 sh 'git lfs pull -I "binaries/data/mods/_test.*"'
54
55 sh "libraries/build-macos-libs.sh ${JOBS} 2> macos-prebuild-errors.log"
56 sh 'build/workspaces/update-workspaces.sh 2>> macos-prebuild-errors.log'
57
58 script {
59 if (params.CLEANBUILD) {
60 sh 'make -C build/workspaces/gcc config=${BUILD_TYPE} clean'
61 }
62 }
63 }
64 post {
65 failure {
66 echo(message: readFile(file: 'macos-prebuild-errors.log'))
67 }
68 }
69 }
70
71 stage('Build') {
72 steps {
73 sh '''
74 rm -f thepipe
75 mkfifo thepipe
76 tee build.log < thepipe &
77 make -C build/workspaces/gcc/ ${JOBS} config=${BUILD_TYPE} > thepipe 2>&1
78 status=$?
79 rm thepipe
80 exit ${status}
81 '''
82 }
83 post {
84 failure {
85 script {
86 if (!params.CLEANBUILD) {
87 build wait: false, job: "$JOB_NAME", parameters: [booleanParam(name: 'CLEANBUILD', value: true)]
88 }
89 }
90 }
91 always {
92 script {
93 recordIssues(
94 tool: analysisParser(
95 analysisModelId: 'clang',
96 name: env.BUILD_TYPE,
97 id : env.BUILD_TYPE,
98 pattern: 'build.log'
99 ),
100 skipPublishingChecks: true,
101 enabledForFailure: true,
102 qualityGates: [[threshold: 1, type: 'TOTAL', criticality: 'FAILURE']]
103 )
104 }
105 }
106 }
107 }
108
109 stage('Tests') {
110 steps {
111 timeout(time: 15) {
112 script {
113 def bin = env.BUILD_TYPE == 'debug' ? 'test_dbg' : 'test'
114 sh "./binaries/system/${bin} --format junit --output cxxtest.xml"
115 }
116 }
117 }
118 post {
119 always {
120 junit(skipPublishingChecks: true, testResults: 'cxxtest.xml')
121 }
122 }
123 }
124 }
125 }
126 }
127 }
128 }
129 }
130 }