From 4a1375cc5f99f4f88b98359bfeaf68935acf1599 Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Fri, 2 Feb 2018 17:22:15 +0100 Subject: [PATCH] Add AppVeyor definition --- appveyor.yml | 55 ++++++++++++++++++++++++++++++++ tools/win32/download-openssl.ps1 | 34 ++++++++++---------- tools/win32/test.ps1 | 23 +++++++++++++ 3 files changed, 96 insertions(+), 16 deletions(-) create mode 100644 appveyor.yml create mode 100644 tools/win32/test.ps1 diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..415bf70ad --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,55 @@ +--- +version: 2.9.0.dev.{build} + +os: Visual Studio 2017 + +environment: + CMAKE_GENERATOR: "Visual Studio 15 2017 Win64" + BOOST_ROOT: 'C:\Libraries\boost_1_65_1' + BOOST_LIBRARYDIR: 'C:\Libraries\boost_1_65_1\lib64-msvc-14.1' + BISON_BINARY: 'C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_bison.exe' + FLEX_BINARY: 'C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_flex.exe' + +branches: + only: + - master + +cache: +- build +- vendor -> tools\win32\download-openssl.ps1 +- C:\ProgramData\chocolatey\lib\winflexbison3 + +install: +- ps: | + if (-not (Test-Path "vendor\OpenSSL")) { + .\tools\win32\download-openssl.ps1 + if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } + } +- ps: | + if (-not (Test-Path "C:\ProgramData\chocolatey\lib\winflexbison3")) { + choco install winflexbison3 + if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } + } + +before_build: +- ps: | + .\tools\win32\configure.ps1 + if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } + del build\Icinga*.msi + +build_script: +- ps: | + .\tools\win32\build.ps1 + if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } + +test_script: +- ps: | + .\tools\win32\test.ps1 + if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } + +artifacts: +- path: build/Icinga*.msi +- path: build/choco/*.nupkg +- path: build/Test.xml + +deploy: off diff --git a/tools/win32/download-openssl.ps1 b/tools/win32/download-openssl.ps1 index 466e661c8..1ebe348f9 100644 --- a/tools/win32/download-openssl.ps1 +++ b/tools/win32/download-openssl.ps1 @@ -1,18 +1,19 @@ [string]$pwd = Get-Location -$OpenSSL_version = '1.1.0g' +$OpenSSL_version = '1.1.0g-1' $OpenSSL_arch = 'x64' $OpenSSL_vcbuild = 'vc150' -$OpenSSL_fileversion = $OpenSSL_version.Replace('.', '_') +$OpenSSL_fileversion = $OpenSSL_version.Replace('.', '_').Split('-')[0] $OpenSSL_file = [string]::Format( 'openssl-{0}-binary-icinga-{1}-{2}.zip', $OpenSSL_fileversion, $OpenSSL_arch, $OpenSSL_vcbuild ) - -# TODO: from GitHub Release! -#$OpenSSL_url = '' -$OpenSSL_url = 'https://ci.appveyor.com/api/buildjobs/4hwjjxgvvyeplrjd/artifacts/' + $OpenSSL_file +$OpenSSL_url = [string]::Format( + 'https://github.com/Icinga/openssl-windows/releases/download/v{0}/{1}', + $OpenSSL_version, + $OpenSSL_file +) $OpenSSL_zip_location = $pwd + '\vendor\' + $OpenSSL_file $vendor_path = $pwd + '\vendor' @@ -23,11 +24,12 @@ if (-not (Test-Path $vendor_path)) { } if (Test-Path $OpenSSL_zip_location) { - Write-Output "OpenSSL archive available at $OpenSSL_zip_location" + Write-Output "OpenSSL archive available at $OpenSSL_zip_location" } else { - Write-Output "Downloading OpenSSL binary dist from $OpenSSL_url" + Write-Output "Downloading OpenSSL binary dist from $OpenSSL_url" + $progressPreference = 'silentlyContinue' - Invoke-WebRequest -Uri $OpenSSL_url -OutFile $OpenSSL_zip_location + Invoke-WebRequest -Uri $OpenSSL_url -OutFile $OpenSSL_zip_location if ($lastexitcode -ne 0){ exit $lastexitcode } $progressPreference = 'Continue' @@ -38,11 +40,11 @@ if (Test-Path $OpenSSL_zip_location) { if (-not (Test-Path $OpenSSL_vendor_path)) { mkdir $OpenSSL_vendor_path -} -Write-Output "Extracting ZIP to $OpenSSL_vendor_path" -Add-Type -AssemblyName System.IO.Compression.FileSystem -[System.IO.Compression.ZipFile]::ExtractToDirectory($OpenSSL_zip_location, $OpenSSL_vendor_path) -if ($lastexitcode -ne 0){ exit $lastexitcode } - -exit 0 + Write-Output "Extracting ZIP to $OpenSSL_vendor_path" + Add-Type -AssemblyName System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::ExtractToDirectory($OpenSSL_zip_location, $OpenSSL_vendor_path) + if ($lastexitcode -ne 0){ exit $lastexitcode } +} else { + Write-Output "OpenSSL is already available at $OpenSSL_vendor_path" +} diff --git a/tools/win32/test.ps1 b/tools/win32/test.ps1 new file mode 100644 index 000000000..913c82c58 --- /dev/null +++ b/tools/win32/test.ps1 @@ -0,0 +1,23 @@ +[string]$pwd = Get-Location + +if (-not (Test-Path build)) { + Write-Host "Path '$pwd\build' does not exist!" + exit 1 +} + +if (-not (Test-Path env:CMAKE_PATH)) { + $env:CMAKE_PATH = 'C:\Program Files\CMake\bin' +} +if (-not ($env:PATH -contains $env:CMAKE_PATH)) { + $env:PATH = $env:CMAKE_PATH + ';' + $env:PATH +} + +cd build + +ctest.exe -C RelWithDebInfo -T test -O build/Test.xml --output-on-failure +if ($lastexitcode -ne 0) { + cd .. + exit $lastexitcode +} + +cd .. \ No newline at end of file -- 2.40.0