Merge pull request #8391 from Icinga/feature/gha-windows

GitHub actions: build Windows
This commit is contained in:
Alexander Aleksandrovič Klimov 2021-06-02 14:32:04 +02:00 committed by GitHub
commit ee4fad54dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 71 deletions

View File

@ -287,3 +287,41 @@ jobs:
# -e ICINGA_BUILD_DEB_DEFAULT_ARCH=armhf \ # -e ICINGA_BUILD_DEB_DEFAULT_ARCH=armhf \
# registry.icinga.com/build-docker/raspbian/${{ matrix.codename }} \ # registry.icinga.com/build-docker/raspbian/${{ matrix.codename }} \
# icinga-build-test # 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

@ -1,64 +0,0 @@
---
version: 2.11.0.dev.{build}
os: Visual Studio 2019
platform: x64
environment:
BITS: 64
CMAKE_BUILD_TYPE: Debug
CMAKE_GENERATOR: "Visual Studio 16 2019"
CMAKE_GENERATOR_PLATFORM: x64
# https://www.appveyor.com/docs/windows-images-software/#boost
BOOST_ROOT: 'C:\Libraries\boost_1_71_0'
BOOST_LIBRARYDIR: 'C:\Libraries\boost_1_71_0\lib64-msvc-14.2'
# https://www.appveyor.com/docs/windows-images-software/#tools
OPENSSL_ROOT_DIR: 'C:\OpenSSL-v111-Win64'
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 -> appveyor.yml
- C:\ProgramData\chocolatey\lib\winflexbison3
install:
- ps: |
if (-not (Test-Path "C:\ProgramData\chocolatey\lib\winflexbison3")) {
& choco install winflexbison3
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
}
# why that env handling, see
# https://help.appveyor.com/discussions/questions/18777-how-to-use-vcvars64bat-from-powershell#comment_44999171
before_build:
- ps: |
& .\tools\win32\load-vsenv.ps1
& powershell.exe .\tools\win32\configure.ps1
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
del build\Icinga*.msi
build_script:
- ps: |
& powershell.exe .\tools\win32\build.ps1
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
test_script:
- ps: |
& powershell.exe .\tools\win32\test.ps1
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# Disable until we really need them
# https://github.com/Icinga/icinga2/issues/6106
# https://help.appveyor.com/discussions/problems/10253-maximum-allowed-artifact-storage-size-of-1000-mb-will-be-exceeded
#artifacts:
#- path: build/Icinga*.msi
#- path: build/choco/*.nupkg
#- path: build/Test.xml
deploy: off

View File

@ -16,6 +16,14 @@ $MsvcVersion = '14.2'
$BoostVersion = @(1, 71, 0) $BoostVersion = @(1, 71, 0)
$OpensslVersion = '1_1_1h' $OpensslVersion = '1_1_1h'
switch ($Env:BITS) {
32 { }
64 { }
default {
$Env:BITS = 64
}
}
function Install-Exe { function Install-Exe {
param ( 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' $RegEnv = 'Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
$ChocoPath = ";$(Join-Path $Env:AllUsersProfile chocolatey\bin)" $ChocoPath = ";$(Join-Path $Env:AllUsersProfile chocolatey\bin)"
Set-ItemProperty -Path $RegEnv -Name Path -Value ((Get-ItemProperty -Path $RegEnv -Name Path).Path + $ChocoPath) Set-ItemProperty -Path $RegEnv -Name Path -Value ((Get-ItemProperty -Path $RegEnv -Name Path).Path + $ChocoPath)
$Env:Path += $ChocoPath $Env:Path += $ChocoPath
}
choco install -y "visualstudio${VsVersion}community" choco install -y "visualstudio${VsVersion}community"
@ -72,6 +84,6 @@ choco install -y windows-sdk-8.1
choco install -y wixtoolset 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}"