forked from castle-engine/castle-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile.macos
111 lines (109 loc) · 3.68 KB
/
Jenkinsfile.macos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* -*- mode: groovy -*-
Confgure how to run our job in Jenkins.
This runs on macOS, and can build for iOS and macOS.
See https://github.com/castle-engine/castle-engine/wiki/Cloud-Builds-(Jenkins) .
*/
library 'cag-shared-jenkins-library'
pipeline {
options {
/* While concurrent builds of CGE work OK,
they stuck Jenkins much with too many long-running builds.
Better to wait for previous build to finish. */
disableConcurrentBuilds()
}
agent {
label 'ios-cge-builder'
}
environment {
/* Used by CGE build tool ("castle-engine").
Define env based on another env variable.
According to https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/110
this should be supported. */
CASTLE_ENGINE_PATH = "${WORKSPACE}"
CGE_INSTALL_PREFIX = "${CASTLE_ENGINE_PATH}/jenkins-installed/"
PATH = "${PATH}:${CGE_INSTALL_PREFIX}/bin/"
/* By default Lazarus wants to build with Carbon, which is 32-bit only and deprecated by Apple */
CASTLE_LAZBUILD_OPTIONS = "--widgetset=cocoa"
}
stages {
stage('Info') {
steps {
// check versions (and availability) of our requirements early
sh 'fpc -iV'
sh 'lazbuild --version'
sh 'make --version'
}
}
stage('Build Tools') {
steps {
sh 'rm -Rf ${CGE_INSTALL_PREFIX}'
sh 'mkdir -p ${CGE_INSTALL_PREFIX}'
sh 'make clean tools install PREFIX=${CGE_INSTALL_PREFIX}'
}
}
stage('Build Examples') {
steps {
sh 'make clean examples'
}
}
stage('Build And Run Auto-Tests') {
steps {
sh 'make tests'
}
}
stage('Build Using FpMake') {
steps {
sh 'make clean test-fpmake'
}
}
stage('Build Lazarus Packages') {
steps {
sh 'lazbuild $CASTLE_LAZBUILD_OPTIONS packages/castle_base.lpk'
sh 'lazbuild $CASTLE_LAZBUILD_OPTIONS packages/castle_window.lpk'
sh 'lazbuild $CASTLE_LAZBUILD_OPTIONS packages/castle_components.lpk'
sh 'lazbuild $CASTLE_LAZBUILD_OPTIONS packages/alternative_castle_window_based_on_lcl.lpk'
}
}
stage('Build Editor') {
steps {
sh 'lazbuild $CASTLE_LAZBUILD_OPTIONS tools/castle-editor/castle_editor.lpi'
sh 'cd tools/castle-editor/ && macos/create_bundle.sh'
sh 'cp -R "tools/castle-editor/Castle Game Engine.app" ${CGE_INSTALL_PREFIX}/bin'
}
}
/* TODO: We use a custom method to create macOS package now,
only with sources + command-line tools (without editor),
instead of full way in ./tools/internal/pack_release/pack_release.sh .
*/
stage('Package macOS') {
steps {
sh 'make clean'
// Make binaries packaged in bin/ (similar to official release), remove other leftovers from "make install"
sh 'rm -Rf bin/'
sh 'mv ${CGE_INSTALL_PREFIX}/bin bin'
sh 'rm -Rf ${CGE_INSTALL_PREFIX}'
sh 'tar -czv --exclude=.git -f castle-game-engine-macos.tar.gz .'
}
}
}
post {
success {
archiveArtifacts artifacts: 'castle-game-engine-macos.tar.gz'
}
regression {
mail to: '[email protected]',
subject: "[jenkins] Build started failing: ${currentBuild.fullDisplayName}",
body: "See the build details on ${env.BUILD_URL}"
}
failure {
mail to: '[email protected]',
subject: "[jenkins] Build failed: ${currentBuild.fullDisplayName}",
body: "See the build details on ${env.BUILD_URL}"
}
fixed {
mail to: '[email protected]',
subject: "[jenkins] Build is again successful: ${currentBuild.fullDisplayName}",
body: "See the build details on ${env.BUILD_URL}"
}
}
}