GitHub actions: build Windows

This commit is contained in:
Alexander A. Klimov 2020-11-10 18:34:00 +01:00
parent 98583190b6
commit 14111de7e9
2 changed files with 57 additions and 7 deletions

View File

@ -298,3 +298,41 @@ jobs:
# -e ICINGA_BUILD_DEB_DEFAULT_ARCH=armhf \
# registry.icinga.com/build-docker/raspbian/${{ matrix.codename }} \
# icinga-build-test
windows:
name: Windows
strategy:
fail-fast: false
matrix:
bits: [32, 64]
runs-on: windows-latest
env:
BITS: '${{ matrix.bits }}'
ICINGA_BUILD_TYPE: snapshot
UPSTREAM_GIT_URL: file://D:/a/icinga2/icinga2/.git
steps:
- name: Checkout HEAD
uses: actions/checkout@v1
- name: windows-icinga2
run: |
git clone https://git.icinga.com/packaging/windows-icinga2.git
- name: Build tools
run: |
& .\doc\win-dev.ps1
- name: Source
run: |
git checkout -B master
cd windows-icinga2
& .\source.ps1
- name: Binary
working-directory: windows-icinga2
run: |
New-Item -ItemType Directory -Path 'C:\Program Files\Icinga2\WillBeRemoved' -ErrorAction SilentlyContinue
& .\build.ps1

View File

@ -16,6 +16,14 @@ $MsvcVersion = '14.2'
$BoostVersion = @(1, 71, 0)
$OpensslVersion = '1_1_1h'
switch ($Env:BITS) {
32 { }
64 { }
default {
$Env:BITS = 64
}
}
function Install-Exe {
param (
@ -47,13 +55,17 @@ function Install-Exe {
}
Invoke-Expression (New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')
try {
Get-Command choco
} catch {
Invoke-Expression (New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')
$RegEnv = 'Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
$ChocoPath = ";$(Join-Path $Env:AllUsersProfile chocolatey\bin)"
$RegEnv = 'Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
$ChocoPath = ";$(Join-Path $Env:AllUsersProfile chocolatey\bin)"
Set-ItemProperty -Path $RegEnv -Name Path -Value ((Get-ItemProperty -Path $RegEnv -Name Path).Path + $ChocoPath)
$Env:Path += $ChocoPath
Set-ItemProperty -Path $RegEnv -Name Path -Value ((Get-ItemProperty -Path $RegEnv -Name Path).Path + $ChocoPath)
$Env:Path += $ChocoPath
}
choco install -y "visualstudio${VsVersion}community"
@ -72,6 +84,6 @@ choco install -y windows-sdk-8.1
choco install -y wixtoolset
Install-Exe -Url "https://packages.icinga.com/windows/dependencies/boost_$($BoostVersion -join '_')-msvc-${MsvcVersion}-64.exe" -Dir "C:\local\boost_$($BoostVersion -join '_')-Win64"
Install-Exe -Url "https://packages.icinga.com/windows/dependencies/boost_$($BoostVersion -join '_')-msvc-${MsvcVersion}-${Env:BITS}.exe" -Dir "C:\local\boost_$($BoostVersion -join '_')-Win${Env:BITS}"
Install-Exe -Url "https://packages.icinga.com/windows/dependencies/Win64OpenSSL-${OpensslVersion}.exe" -Dir "C:\local\OpenSSL_${OpensslVersion}-Win64"
Install-Exe -Url "https://packages.icinga.com/windows/dependencies/Win${Env:BITS}OpenSSL-${OpensslVersion}.exe" -Dir "C:\local\OpenSSL_${OpensslVersion}-Win${Env:BITS}"