This commit is contained in:
OBattler
2021-11-19 23:14:00 +01:00
2 changed files with 71 additions and 29 deletions

96
.ci/Jenkinsfile vendored
View File

@@ -78,13 +78,26 @@ def presetFlags = [
def anyFailure = false def anyFailure = false
def gitClone() { def gitClone() {
/* Read git tag from environment or set the default one. */
if (env.GIT_COMMIT == null) if (env.GIT_COMMIT == null)
env.GIT_COMMIT = 'master' env.GIT_COMMIT = 'master'
println "[-] Using git tag [${env.GIT_COMMIT}]" println "[-] Using git tag [${env.GIT_COMMIT}]"
def scmVars = checkout scm: [$class: 'GitSCM',
branches: [[name: env.GIT_COMMIT]], /* Use stashes to avoid performing multiple clones. */
userRemoteConfigs: [[url: 'https://github.com/86Box/86Box.git']]] if (env.GIT_STASHED != 'true') {
env.GIT_COMMIT = scmVars.GIT_COMMIT /* Perform clone/checkout. */
def scmVars = checkout scm: [$class: 'GitSCM',
branches: [[name: env.GIT_COMMIT]],
userRemoteConfigs: [[url: 'https://github.com/86Box/86Box.git']]]
env.GIT_COMMIT = scmVars.GIT_COMMIT
/* Stash data and mark it as stashed. */
stash name: 'git'
env.GIT_STASHED = 'true'
} else {
/* Unstash data. */
unstash name: 'git'
}
} }
def removeDir(dir) { def removeDir(dir) {
@@ -98,41 +111,68 @@ def runBuild(args) {
if (isUnix()) if (isUnix())
sh "chmod u+x \"$WORKSPACE/.ci/build.sh\" && exec \"$WORKSPACE/.ci/build.sh\" $args" sh "chmod u+x \"$WORKSPACE/.ci/build.sh\" && exec \"$WORKSPACE/.ci/build.sh\" $args"
else else
bat "C:\\msys64\\msys2_shell.cmd -msys2 -defterm -here -no-start -c 'exec \"\$(cygpath -u \\'%WORKSPACE%\\')\"/.ci/build.sh $args'" bat "C:\\msys64\\msys2_shell.cmd -msys2 -defterm -here -no-start -c 'exec \"\$(cygpath -u \\'%WORKSPACE%\\')/.ci/build.sh\" $args'"
} }
pipeline { pipeline {
agent none agent none
environment {
DISCORD_WEBHOOK_URL = credentials('discord-webhook-url')
}
options {
disableConcurrentBuilds()
quietPeriod(0)
}
parameters { parameters {
string(name: 'BUILD_TYPE', string(name: 'BUILD_TYPE',
defaultValue: 'beta', /* !!! CHANGE HERE !!! for build type */ defaultValue: 'beta', /* !!! CHANGE HERE !!! for build type */
description: "Build type to pass on to CMake. Don't change this, you should instead change the default value on .ci/Jenkinsfile") description: "Build type to pass on to CMake. Don't change this, you should instead change the default value on .ci/Jenkinsfile")
} }
environment {
DISCORD_WEBHOOK_URL = credentials('discord-webhook-url')
}
stages { stages {
stage('Source Tarball') { stage('Source Tarball') {
agent none agent none
steps { steps {
script { script {
/* Run a dummy git clone on any node to try and save the latest commit regardless of executor status. /* Hack to extract the current HEAD commit from this build's git polling
This avoids a timing issue where HEAD changes between polling and the nodes being available below. log. This avoids a race condition where HEAD changes in the time period
I talked to a few people, and we reached the conclusion that reading the polled commit from within between Jenkins polling the git repository and the first build node
the pipeline is not really possible (maybe short of switching to a multi-branch pipeline), so we performing the first git clone once ready. (See issue JENKINS-20518) */
have to live with this hack, which shortens but doesn't fully eliminate the timing issue's window. */ if (env.GIT_COMMIT == null) {
node { /* This must run on the master node to read the polling log. */
/* Ignore exceptions as this is not really critical. */ node('master') {
try { /* Ignore exceptions as this is not really critical. */
gitClone() try {
} catch (e) {} /* Switch to this build's directory. */
try { dir("${env.JENKINS_HOME}/jobs/${env.JOB_NAME}/builds/${env.BUILD_NUMBER}") {
cleanWs() /* Parse polling log. */
} catch (e) {} def pollingLog = readFile file: 'polling.log'
def match = pollingLog =~ /Latest remote head revision on [^ ]+ is: ([a-zA-Z0-9]+)/
if (match && match[0]) {
env.GIT_COMMIT = match[0][1]
println "[-] Read git tag [${env.GIT_COMMIT}] from polling log"
}
}
} catch (e) {}
}
/* If the polling log parsing fails, perform a dummy git clone on any node.
Not quite as fast as reading the polling log, but it works as a backup. */
if (env.GIT_COMMIT == null) {
node {
/* Ignore exceptions again as this is not really critical. */
try {
gitClone()
} catch (e) {}
try {
cleanWs()
} catch (e) {}
}
}
} }
/* Create source tarball. */ /* Create source tarball. */
@@ -188,12 +228,10 @@ pipeline {
/* Switch to output directory. */ /* Switch to output directory. */
dir('output') { dir('output') {
/* Run build process. */
def packageName = "${env.JOB_BASE_NAME}${dynarecSlugs[dynarec]}${presetSlugs[preset]}-$os-$arch-b${env.BUILD_NUMBER}" def packageName = "${env.JOB_BASE_NAME}${dynarecSlugs[dynarec]}${presetSlugs[preset]}-$os-$arch-b${env.BUILD_NUMBER}"
dir(dynarecNames[dynarec]) { dir("${dynarecNames[dynarec]}/$os - ${archNames[arch]}") {
dir("$os - ${archNames[arch]}") { runBuild("-b \"$packageName\" \"$arch\" ${presetFlags[preset]} ${dynarecFlags[dynarec]} -D \"BUILD_TYPE=$BUILD_TYPE\" -D \"EMU_BUILD=build ${env.BUILD_NUMBER}\" -D \"EMU_BUILD_NUM=${env.BUILD_NUMBER}\"")
/* Run build process. */
runBuild("-b \"$packageName\" \"$arch\" ${presetFlags[preset]} ${dynarecFlags[dynarec]} -D \"BUILD_TYPE=$BUILD_TYPE\" -D \"EMU_BUILD=build ${env.BUILD_NUMBER}\" -D \"EMU_BUILD_NUM=${env.BUILD_NUMBER}\"")
}
} }
/* Archive resulting artifacts. */ /* Archive resulting artifacts. */
@@ -223,12 +261,14 @@ pipeline {
post { post {
always { always {
script { script {
/* Mark build as failed if any step has failed. */
if (anyFailure) { if (anyFailure) {
println "[!] Failing build because a build stage failed" println "[!] Failing build because a build stage failed"
currentBuild.result = 'FAILURE' currentBuild.result = 'FAILURE'
} }
if (!env.JOB_BASE_NAME.contains("TestBuildPleaseIgnore")) { /* Send out build notifications. */
if (!env.JOB_BASE_NAME.contains('TestBuildPleaseIgnore')) {
try { try {
/* Notify Discord. */ /* Notify Discord. */
def result = currentBuild.currentResult.toLowerCase() def result = currentBuild.currentResult.toLowerCase()

View File

@@ -542,7 +542,7 @@ ac97_codec_init(const device_t *info)
/* Associate this codec to the current controller. */ /* Associate this codec to the current controller. */
if (!ac97_codec || (ac97_codec_count <= 0)) { if (!ac97_codec || (ac97_codec_count <= 0)) {
fatal("AC97 Codec %d: No controller to associate codec\n", ac97_codec_id); pclog("AC97 Codec %d: No controller to associate codec\n", ac97_codec_id);
return NULL; return NULL;
} }
*ac97_codec = dev; *ac97_codec = dev;
@@ -583,6 +583,8 @@ static void
ac97_codec_close(void *priv) ac97_codec_close(void *priv)
{ {
ac97_codec_t *dev = (ac97_codec_t *) priv; ac97_codec_t *dev = (ac97_codec_t *) priv;
if (!dev)
return;
ac97_codec_log("AC97 Codec %d: close()\n", dev->codec_id); ac97_codec_log("AC97 Codec %d: close()\n", dev->codec_id);