mirror of
https://github.com/86Box/86Box.git
synced 2025-01-22 17:22:25 -05:00
121 lines
3.2 KiB
Groovy
121 lines
3.2 KiB
Groovy
/*
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
* running old operating systems and software designed for IBM
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
* system designs based on the PCI bus.
|
|
*
|
|
* This file is part of the 86Box distribution.
|
|
*
|
|
* Jenkins build pipeline definition.
|
|
*
|
|
*
|
|
*
|
|
* Authors: RichardG, <richardg867@gmail.com>
|
|
*
|
|
* Copyright 2021 RichardG.
|
|
*/
|
|
|
|
/* Run this on /script to get all the approvals necessary to sync build numbers across jobs:
|
|
|
|
def approval = org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.get()
|
|
approval.approveSignature('staticMethod jenkins.model.Jenkins getInstance')
|
|
approval.approveSignature('method hudson.model.ItemGroup getItem java.lang.String')
|
|
approval.approveSignature('field hudson.model.Job nextBuildNumber')
|
|
approval.approveSignature('method hudson.model.Job saveNextBuildNumber')
|
|
|
|
*/
|
|
|
|
def gitClone() {
|
|
cleanWs()
|
|
if (env.GIT_COMMIT == null)
|
|
env.GIT_COMMIT = BRANCH
|
|
println "[-] Building git tag [${env.GIT_COMMIT}]"
|
|
def scmVars = checkout scm: [$class: 'GitSCM',
|
|
branches: [[name: env.GIT_COMMIT]],
|
|
userRemoteConfigs: [[url: 'https://github.com/richardg867/86Box.git']]]
|
|
env.GIT_COMMIT = scmVars.GIT_COMMIT
|
|
}
|
|
|
|
def windowsBuild() {
|
|
bat 'C:\\msys64\\msys2_shell.cmd -msys2 -defterm -here -no-start -c "exec .ci/build.sh"'
|
|
}
|
|
|
|
def unixBuild() {
|
|
sh 'chmod u+x .ci/build.sh && .ci/build.sh'
|
|
}
|
|
|
|
def saveArtifacts() {
|
|
archiveArtifacts artifacts: "${env.JOB_BASE_NAME}-*"
|
|
}
|
|
|
|
pipeline {
|
|
agent any
|
|
|
|
parameters {
|
|
string(name: 'BUILD_TYPE',
|
|
defaultValue: 'beta', /* !!! CHANGE HERE !!! for build type */
|
|
description: 'Build type to pass on to CMake. This may affect the UI icon and feature set.')
|
|
string(name: 'BRANCH',
|
|
defaultValue: 'master',
|
|
description: 'Used internally to make sure all downstream builds use the same commit.')
|
|
}
|
|
|
|
stages {
|
|
stage('Build Windows') {
|
|
steps {
|
|
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
|
|
node('windows') {
|
|
gitClone()
|
|
windowsBuild()
|
|
saveArtifacts()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Build Linux') {
|
|
steps {
|
|
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
|
|
node('debian') {
|
|
gitClone()
|
|
unixBuild()
|
|
saveArtifacts()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* If we're on the main jobs, trigger each of the downstream jobs. */
|
|
stage('Trigger downstream jobs') {
|
|
when {
|
|
expression {
|
|
return env.JOB_BASE_NAME == '86Box-TestBuildPleaseIgnore';
|
|
}
|
|
}
|
|
|
|
steps {
|
|
script {
|
|
["${env.JOB_BASE_NAME}2"].each {
|
|
try {
|
|
/* Set next build number for this job. */
|
|
def job = Jenkins.instance.getItem(it)
|
|
job.nextBuildNumber = env.BUILD_NUMBER as Integer
|
|
job.saveNextBuildNumber()
|
|
} catch (Exception e) {
|
|
println "[!] Could not set next build number for [$it], make sure all the script approvals are in place"
|
|
}
|
|
|
|
/* Trigger this job. */
|
|
build propagate: false,
|
|
wait: false,
|
|
job: it,
|
|
parameters: [
|
|
string(name: 'BUILD_TYPE', value: BUILD_TYPE),
|
|
string(name: 'BRANCH', value: env.GIT_COMMIT)
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|