From a1fa5dc3cb788635a10879c391e6fd54639f074b Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Sat, 28 Oct 2017 00:10:36 -0400 Subject: [PATCH] Windows CI: Only build obs-studio if not cached Run a series of checks to determine if CI needs to build obs-studio before trying to build obs-websocket. --- CI/install-build-obs.cmd | 118 +++++++++++++++++++++++++++++++++++++++ appveyor.yml | 17 ++---- 2 files changed, 122 insertions(+), 13 deletions(-) create mode 100644 CI/install-build-obs.cmd diff --git a/CI/install-build-obs.cmd b/CI/install-build-obs.cmd new file mode 100644 index 00000000..bad23d9d --- /dev/null +++ b/CI/install-build-obs.cmd @@ -0,0 +1,118 @@ +@echo off +SETLOCAL EnableDelayedExpansion + +REM Check if obs-studio build exists. +REM If the obs-studio directory does exist, check if the last OBS tag built +REM matches the latest OBS tag. +REM If the tags match, do not build obs-studio. +REM If the tags do not match, build obs-studio. +REM If the obs-studio directory doesn't exist, build obs-studio. +echo Checking for obs-studio build... + +set OBSLatestTagPrePull=0 +set OBSLatestTagPostPull=0 +echo Latest tag pre-pull: %OBSLatestTagPrePull% +echo Latest tag post-pull: %OBSLatestTagPostPull% + +REM Set up the build flag as undefined. +set "BuildOBS=" + +REM Check the last tag successfully built by CI. +if exist C:\projects\obs-studio-last-tag-built.txt ( + set /p OBSLastTagBuilt= C:\projects\latest-obs-studio-tag-pre-pull.txt + set /p OBSLatestTagPrePull= C:\projects\latest-obs-studio-tag-post-pull.txt + set /p OBSLatestTagPostPull= C:\projects\latest-obs-studio-tag.txt +) + +REM Check the obs-studio tags for mismatches. +REM If a new tag was pulled, set the build flag. +if not %OBSLatestTagPrePull%==%OBSLatestTagPostPull% ( + echo Latest tag pre-pull: %OBSLatestTagPrePull% + echo Latest tag post-pull: %OBSLatestTagPostPull% + echo Tags do not match. Need to rebuild OBS. + set BuildOBS=true +) + +REM If the latest git tag doesn't match the last built tag, set the build flag. +if not %OBSLatestTagPostPull%==%OBSLastTagBuilt% ( + echo Last built OBS tag: %OBSLastTagBuilt% + echo Latest tag post-pull: %OBSLatestTagPostPull% + echo Tags do not match. Need to rebuild OBS. + set BuildOBS=true +) + +REM If obs-studio directory does not exist, clone the git repo, get the latest +REM tag number, and set the build flag. +if not exist C:\projects\obs-studio ( + echo obs-studio directory does not exist + git clone --recursive https://github.com/jp9000/obs-studio + cd C:\projects\obs-studio\ + git describe --tags --abbrev=0 > C:\projects\obs-studio-latest-tag.txt + set /p OBSLatestTag= C:\projects\obs-studio-last-tag-built.txt + set /p OBSLastTagBuilt=