From c1b7f8aa88c50e82372bf98bfc3dccbae03ea459 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Thu, 28 Feb 2019 20:45:50 +0100 Subject: [PATCH] ci: Configure and build 32/64-bit in parallel and reduce noise By configuring and building 32-bit and 64-bit builds in parallel we can save massive amounts of time usually spent just waiting on other resources while the CPU is idle. On AppVeyor, this results in a roughly 50% lower build time, ensuring that builds can complete faster than before. Artifacts have been reduced to only be created for tagged releases, which also reduces total build time. Additionally the notifications have been reduced to only happen when the build status changes, as there is no reason to notify about things that did not change the status. --- appveyor.yml | 50 ++++++++++++++------- ci/appveyor-build.bat | 4 -- ci/appveyor-build.js | 98 +++++++++++++++++++++++++++++++++++++++++ ci/appveyor-install.bat | 1 + ci/appveyor-package.bat | 15 ++++--- 5 files changed, 141 insertions(+), 27 deletions(-) delete mode 100644 ci/appveyor-build.bat create mode 100644 ci/appveyor-build.js diff --git a/appveyor.yml b/appveyor.yml index 7dbf5e1..f06e1db 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,40 +1,57 @@ +# Generic Settings +version: '{build}-{branch}' + matrix: fast_finish: true -branches: - except: - - /i18n_.*/ +# Build Image & Environment +platform: x64 image: - Visual Studio 2017 -platform: x64 - -version: '{build}-{branch}' - environment: CMAKE_SYSTEM_VERSION: 10.0.17134.0 PACKAGE_PREFIX: amd-encoder-for-obs-studio INNOSETUP_URL: http://www.jrsoftware.org/download.php/is-unicode.exe CURL_VERSION: 7.39.0 - + +# Resource Cache +cache: + - inno.exe + - build/32/libobs-download + - build/32/libobs-src + - build/64/libobs-download + - build/64/libobs-src + +# Repository Settings +clone_depth: 1 +shallow_clone: true + +branches: + except: + - /i18n_.*/ + +# Building install: - cmd: ci/appveyor-install.bat build_script: -- cmd: ci/appveyor-build.bat +- cmd: node ci/appveyor-build.js after_build: - cmd: ci/appveyor-package.bat -cache: - - inno.exe +# Testing +test: off +# Artifacts artifacts: - path: build/obs-stream-effects-*.zip - path: build/obs-stream-effects-*.7z - path: build/obs-stream-effects-*.exe +# Deploying deploy: - provider: GitHub auth_token: @@ -45,16 +62,15 @@ deploy: on: appveyor_repo_tag: true -test: off - +# Notifications notifications: - provider: Webhook url: secure: PTtt5ALhmK0q42jYyx4/Qa1Uf18+gLMXKGdzJjDISJt8IE/K0Zyp58UYmDDbbyLp4pBRf/Ylj8rn/zYL/mqBoDVRIH5zasPqIvBD0ZhtvNjTOxQ3QoRkAmxgpWeMowm3A3I1rLizA2H4EctPpoAJGrvQ1G2HEYn9tVsGYeetFTo= - on_build_success: true - on_build_failure: true + on_build_success: false + on_build_failure: false on_build_status_changed: true body: >- { - "content": "**Build {{status}}**: {{buildUrl}}\n[{{commitId}}] {{commitMessage}}\nBy {{commitAuthor}} on {{commitDate}}" - } \ No newline at end of file + "content": "**Build {{status}}**: [{{commitId}}] {{commitMessage}}\nBy {{commitAuthor}} on {{commitDate}}\n{{buildUrl}}" + } diff --git a/ci/appveyor-build.bat b/ci/appveyor-build.bat deleted file mode 100644 index b0c1b72..0000000 --- a/ci/appveyor-build.bat +++ /dev/null @@ -1,4 +0,0 @@ -cmake -H. -B"build/32" -G"Visual Studio 15 2017" -DCMAKE_INSTALL_PREFIX="%CD%/build/distrib" -DCMAKE_PACKAGE_PREFIX="%CD%/build" -DCMAKE_PACKAGE_NAME="obs-stream-effects" -cmake -H. -B"build/64" -G"Visual Studio 15 2017 Win64" -T"host=x64" -DCMAKE_INSTALL_PREFIX="%CD%/build/distrib" -DCMAKE_PACKAGE_PREFIX="%CD%/build" -DCMAKE_PACKAGE_NAME="obs-stream-effects" -DOBS_DEPENDENCIES_DIR="%CD%/build/32/obsdeps-src" -cmake --build build/32 --target INSTALL --config RelWithDebInfo -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" -cmake --build build/64 --target INSTALL --config RelWithDebInfo -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" \ No newline at end of file diff --git a/ci/appveyor-build.js b/ci/appveyor-build.js new file mode 100644 index 0000000..f43946c --- /dev/null +++ b/ci/appveyor-build.js @@ -0,0 +1,98 @@ +const cp = require('child_process'); + +var config32 = cp.spawn( + "cmake", [ + '-H.', + '-B"build/32"', + '-G"Visual Studio 15 2017"', + '-DCMAKE_INSTALL_PREFIX="build/distrib"', + '-DCMAKE_PACKAGE_PREFIX="build"', + '-DCMAKE_PACKAGE_NAME="obs-stream-effects"' + ], { + windowsVerbatimArguments: true, + windowsHide: true + } +); +config32.stdout.on('data', (data) => { + process.stdout.write(`[32:Out] ${data}`); +}); +config32.stderr.on('data', (data) => { + console.log(`[32:Err] ${data}`); +}); +config32.on('exit', (code, signal) => { + if (code != 0) { + process.exit(code) + } + var build32 = cp.spawn( + "cmake", [ + '--build build/32', + '--target INSTALL', + '--config RelWithDebInfo', + '--', + '/logger:"C:\\Program Files\\AppVeyor\\BuildAgent\\Appveyor.MSBuildLogger.dll"' + ], { + windowsVerbatimArguments: true, + windowsHide: true + } + ); + build32.stdout.on('data', (data) => { + process.stdout.write(`[32:Out] ${data}`); + }); + build32.stderr.on('data', (data) => { + process.stderr.write(`[32:Err] ${data}`); + }); + build32.on('exit', (code, signal) => { + if (code != 0) { + process.exit(code) + } + }); +}); + +var config64 = cp.spawn( + "cmake", [ + '-H.', + '-B"build/64"', + '-G"Visual Studio 15 2017 Win64"', + '-DCMAKE_INSTALL_PREFIX="build/distrib"', + '-DCMAKE_PACKAGE_PREFIX="build"', + '-DCMAKE_PACKAGE_NAME="obs-stream-effects"' + ], { + windowsVerbatimArguments: true, + windowsHide: true + } +); +config64.stdout.on('data', (data) => { + process.stdout.write(`[64:Out] ${data}`); +}); +config64.stderr.on('data', (data) => { + console.log(`[64:Err] ${data}`); +}); +config64.on('exit', (code, signal) => { + if (code != 0) { + process.exit(code) + } + var build64 = cp.spawn( + "cmake", [ + '--build build/64', + '--target INSTALL', + '--config RelWithDebInfo', + '--', + '/logger:"C:\\Program Files\\AppVeyor\\BuildAgent\\Appveyor.MSBuildLogger.dll"' + ], { + windowsVerbatimArguments: true, + windowsHide: true + } + ); + build64.stdout.on('data', (data) => { + process.stdout.write(`[32:Out] ${data}`); + }); + build64.stderr.on('data', (data) => { + process.stderr.write(`[32:Err] ${data}`); + }); + build64.on('exit', (code, signal) => { + if (code != 0) { + process.exit(code) + } + }); +}); + diff --git a/ci/appveyor-install.bat b/ci/appveyor-install.bat index d579ad8..0745982 100644 --- a/ci/appveyor-install.bat +++ b/ci/appveyor-install.bat @@ -1,3 +1,4 @@ +@ECHO OFF git submodule update --init --force --recursive IF EXIST inno.exe ( diff --git a/ci/appveyor-package.bat b/ci/appveyor-package.bat index 191d5a9..ebf2cb3 100644 --- a/ci/appveyor-package.bat +++ b/ci/appveyor-package.bat @@ -1,6 +1,9 @@ -ECHO -- Building 7z Archive -- -cmake --build build/64 --target PACKAGE_7Z --config RelWithDebInfo -ECHO -- Building Zip Archive -- -cmake --build build/64 --target PACKAGE_ZIP --config RelWithDebInfo -ECHO -- Building Installer -- -"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" /Qp ".\build\64\installer.iss" > nul \ No newline at end of file +@ECHO OFF +IF "%APPVEYOR_REPO_TAG%"=="true" ( + ECHO -- Building 7z Archive -- + cmake --build build/64 --target PACKAGE_7Z --config RelWithDebInfo + ECHO -- Building Zip Archive -- + cmake --build build/64 --target PACKAGE_ZIP --config RelWithDebInfo + ECHO -- Building Installer -- + "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" /Qp ".\build\64\installer.iss" > nul +) \ No newline at end of file