File: Jenkinsfile

package info (click to toggle)
view3dscene 4.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,824 kB
  • sloc: pascal: 3,961; sh: 330; xml: 261; makefile: 133
file content (120 lines) | stat: -rw-r--r-- 4,213 bytes parent folder | download
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
112
113
114
115
116
117
118
119
120
/* -*- mode: groovy -*-
  Configure how to run our job in Jenkins.
  See https://castle-engine.io/cloud_builds_jenkins .
*/

pipeline {
  options {
    /* We do not really have a problem with concurrent builds (jenkins_scripts/build.sh
       could execute in parallel in multiple checkouts),
       but it seems that view3dscene job can be created many many times in Jenkins
       and get stuck.
       Using disableConcurrentBuilds as a workaround. */
    disableConcurrentBuilds()
  }
  triggers {
    pollSCM('H/4 * * * *')
    upstream(upstreamProjects: 'castle_game_engine_organization/castle-engine-cloud-builds-tools/master', threshold: hudson.model.Result.SUCCESS)
  }
  agent none
  stages {
    /* Build for each platform in parallel.
       See https://stackoverflow.com/questions/43913698/jenkinsfile-parallel-directive
       https://www.jenkins.io/blog/2017/09/25/declarative-1/
       for parallel syntax. */
    stage('Run parallel builds') {
      parallel {
        stage('Build Linux, Windows, Src') {
          agent {
            docker {
              image 'kambi/castle-engine-cloud-builds-tools:cge-unstable'
            }
          }
          steps {
            sh "repository_cleanup . --remove-unversioned"
            sh 'jenkins_scripts/build.sh'
            /* Do not defer "archiveArtifacts" to later (like post section),
               as this command must run in the same agent and Docker container
               as build.sh. */
            archiveArtifacts artifacts: 'view3dscene-*.tar.gz,view3dscene-*zip,view3dscene-*.apk'
          }
        }

        stage('Raspberry Pi') {
          agent {
            label 'raspberry-pi-cge-builder'
          }
          environment {
            CASTLE_ENGINE_PATH = "${WORKSPACE}/castle_game_engine"
            PATH = "${PATH}:${CASTLE_ENGINE_PATH}/bin"
          }
          stages {
            stage('Cleanup (Raspberry Pi)') {
              steps {
                sh "repository_cleanup . --remove-unversioned"
              }
            }
            stage('Setup CGE (Raspberry Pi)') {
              steps {
                copyArtifacts(projectName: 'castle_game_engine_raspberry_pi/master', filter: 'castle-engine*-linux-arm.zip')
                sh 'unzip castle-engine*-linux-arm.zip'
              }
            }
            stage('Build (Raspberry Pi)') {
              steps {
                sh 'jenkins_scripts/build.sh linux arm'
                archiveArtifacts artifacts: 'view3dscene-*.tar.gz,view3dscene-*zip,view3dscene-*.apk'
              }
            }
          }
        }

        stage('macOS') {
          agent {
            label 'mac-cge-builder'
          }
          environment {
            CASTLE_ENGINE_PATH = "${WORKSPACE}/castle_game_engine"
            PATH = "${PATH}:${CASTLE_ENGINE_PATH}/bin"
          }
          stages {
            stage('Cleanup (macOS)') {
              steps {
                sh "repository_cleanup . --remove-unversioned"
              }
            }
            stage('Setup CGE (macOS)') {
              steps {
                copyArtifacts(projectName: 'castle_game_engine_macos/master', filter: 'castle-engine*-darwin-x86_64.zip')
                sh 'unzip castle-engine*-darwin-x86_64.zip'
              }
            }
            stage('Build (macOS)') {
              steps {
                sh 'jenkins_scripts/build.sh darwin x86_64'
                archiveArtifacts artifacts: 'view3dscene-*.tar.gz,view3dscene-*zip,view3dscene-*.apk'
              }
            }
          }
        }
      }
    }
  }
  post {
    regression {
      mail to: 'michalis@castle-engine.io',
        subject: "[jenkins] Build started failing: ${currentBuild.fullDisplayName}",
        body: "See the build details on ${env.BUILD_URL}"
    }
    failure {
      mail to: 'michalis@castle-engine.io',
        subject: "[jenkins] Build failed: ${currentBuild.fullDisplayName}",
        body: "See the build details on ${env.BUILD_URL}"
    }
    fixed {
      mail to: 'michalis@castle-engine.io',
        subject: "[jenkins] Build is again successfull: ${currentBuild.fullDisplayName}",
        body: "See the build details on ${env.BUILD_URL}"
    }
  }
}