From 5f91898b79c679e0141acf36b6e5a376ee7874b8 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sun, 17 Jul 2016 19:00:48 +0100 Subject: [PATCH] Add AppVeyor config AppVeyor provides a free Windows-based CI environment, which allows native Windows LOOT builds to be automated! --- appveyor.yml | 74 ++++++++++++++++++++++++++++++ scripts/appveyor/install_boost.ps1 | 46 +++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 appveyor.yml create mode 100644 scripts/appveyor/install_boost.ps1 diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..77fdf1a9 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,74 @@ +os: Visual Studio 2015 + +version: "{build}-{branch}" + +configuration: Release + +cache: + - node_modules + - bower_components + - C:\projects\boost_1_61_0\boost + - C:\projects\boost_1_61_0\stage\lib + +install: + - npm install + - .\node_modules\.bin\bower install + - ps: .\scripts\appveyor\install_boost.ps1 + +before_build: + - cd %APPVEYOR_BUILD_FOLDER% + - ps: mkdir build + - cd build + - cmake .. -G "Visual Studio 14 2015" -DBOOST_ROOT="C:\projects\boost_1_61_0" + +build: + verbosity: minimal + project: 'c:\projects\loot\build\LOOT.sln' + +test_script: + - cd %APPVEYOR_BUILD_FOLDER%\build\%CONFIGURATION% + - tests.exe --gtest_output=xml:tests.xml + - api-tests.exe --gtest_output=xml:api-tests.xml + +after_test: + - cd %APPVEYOR_BUILD_FOLDER% + - node scripts\potomo.js + - node scripts\archive.js + # AppVeyor checks out a specific commit, but that means the archive script + # can't tell which branch it's on, so rename the 7z archives. + - ps: $env:GIT_DESCRIBE = ((git describe --tags --long) | Out-String) -replace "`n|`r", "" + - ps: mv "build\LOOT $($env:GIT_DESCRIBE)-HEAD.7z" "build\LOOT $($env:GIT_DESCRIBE)-$($env:APPVEYOR_REPO_BRANCH).7z" + - ps: mv "build\LOOT API $($env:GIT_DESCRIBE)-HEAD.7z" "build\LOOT API $($env:GIT_DESCRIBE)-$($env:APPVEYOR_REPO_BRANCH).7z" + +artifacts: + - path: build\LOOT $(GIT_DESCRIBE)-$(APPVEYOR_REPO_BRANCH).7z + name: LOOT + - path: build\LOOT API $(GIT_DESCRIBE)-$(APPVEYOR_REPO_BRANCH).7z + name: API + +deploy: + - provider: BinTray + username: wrinklyninja + api_key: + secure: u234T2688DZmz4JH5+0iAHcUcL2fEIGculb8655bn4B1q7GckhplsitzgEbv3NFc + subject: wrinklyninja + repo: loot + package: LOOT + version: $(GIT_DESCRIBE)-$(APPVEYOR_REPO_BRANCH) + publish: true + artifact: LOOT + + - provider: BinTray + username: wrinklyninja + api_key: + secure: u234T2688DZmz4JH5+0iAHcUcL2fEIGculb8655bn4B1q7GckhplsitzgEbv3NFc + subject: wrinklyninja + repo: loot + package: LOOT_API + version: $(GIT_DESCRIBE)-$(APPVEYOR_REPO_BRANCH) + publish: true + artifact: API + +on_finish: + - ps: (New-Object System.Net.WebClient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", "$($env:APPVEYOR_BUILD_FOLDER)\build\$($env:CONFIGURATION)\tests.xml") + - ps: (New-Object System.Net.WebClient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", "$($env:APPVEYOR_BUILD_FOLDER)\build\$($env:CONFIGURATION)\api-tests.xml") diff --git a/scripts/appveyor/install_boost.ps1 b/scripts/appveyor/install_boost.ps1 new file mode 100644 index 00000000..383c555e --- /dev/null +++ b/scripts/appveyor/install_boost.ps1 @@ -0,0 +1,46 @@ +Add-Type -AssemblyName System.IO.Compression.FileSystem + +$boostUrl = 'http://downloads.sourceforge.net/project/boost/boost/1.61.0/boost_1_61_0.7z?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F1.61.0%2F&ts=1468862599&use_mirror=ncu' +$boostArchive = 'C:\projects\boost_1_61_0.7z' +$boostFolder = 'C:\projects\boost_1_61_0' +$boostLibraries = @( + 'libboost_atomic-vc140-mt-s-1_61.lib' + 'libboost_chrono-vc140-mt-s-1_61.lib' + 'libboost_date_time-vc140-mt-s-1_61.lib' + 'libboost_filesystem-vc140-mt-s-1_61.lib' + 'libboost_iostreams-vc140-mt-s-1_61.lib' + 'libboost_locale-vc140-mt-s-1_61.lib' + 'libboost_log_setup-vc140-mt-s-1_61.lib' + 'libboost_log-vc140-mt-s-1_61.lib' + 'libboost_regex-vc140-mt-s-1_61.lib' + 'libboost_system-vc140-mt-s-1_61.lib' + 'libboost_thread-vc140-mt-s-1_61.lib' +) + +function Is-LibraryMissing { + $libFolder = $boostFolder + '\stage\lib' + foreach($library in $boostLibraries) { + if (!(Test-Path ($libFolder + '\' + $library))) { + return $true + } + } + + return $false +} + +if (Is-LibraryMissing) { + Write-Output 'Downloading Boost 1.61.0...' + + $start_time = Get-Date + (New-Object System.Net.WebClient).DownloadFile($boostUrl, $boostArchive) + + Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)" + + Write-Output 'Extracting ' + $boostArchive + '...' + cd + 7z x $boostArchive -o"C:\projects" + + cd $boostFolder + .\bootstrap.bat + .\b2 toolset=msvc threadapi=win32 link=static runtime-link=static variant=release address-model=32 --with-log --with-date_time --with-thread --with-filesystem --with-locale --with-regex --with-system --with-iostreams +}