-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a340ef1
commit 9d86fbb
Showing
3 changed files
with
64 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#first install vcpkg in collect directory | ||
Set-PSDebug -Trace 2 | ||
|
||
Write-Host "Work in" $pwd.ToString() | ||
|
||
[System.Environment]::SetEnvironmentVariable("VCPKG_BINARY_SOURCES", "clear;files," + $pwd.ToString() + "\vcpkg\vcpkg-binary-cache,readwrite") | ||
[System.Environment]::SetEnvironmentVariable("VCPKG_ROOT",$pwd.ToString()+"\vcpkg") | ||
[System.Environment]::SetEnvironmentVariable("PATH",$pwd.ToString()+"\vcpkg:" + $env:PATH) | ||
[System.Environment]::SetEnvironmentVariable("AWS_EC2_METADATA_DISABLED","true") | ||
|
||
Write-Host $env:VCPKG_BINARY_SOURCES | ||
|
||
$current_dir = $pwd.ToString() | ||
|
||
git clone --depth 1 --single-branch --no-tags https://github.com/microsoft/vcpkg vcpkg | ||
cd vcpkg | ||
bootstrap-vcpkg.bat | ||
cd $current_dir | ||
|
||
#get cache from s3 | ||
$files_to_hash= "vcpkg.json", "custom-triplets\x64-windows.cmake", "CMakeLists.txt", "CMakeListsWindows.txt" | ||
$files_content= Get-Content -Path $files_to_hash -Raw | ||
$stringAsStream = [System.IO.MemoryStream]::new() | ||
$writer = [System.IO.StreamWriter]::new($stringAsStream) | ||
$writer.write($files_content -join " ") | ||
$writer.Flush() | ||
$stringAsStream.Position = 0 | ||
$vcpkg_hash=Get-FileHash -InputStream $stringAsStream -Algorithm SHA256 | Select-Object Hash | ||
$file_name = "windows-agent-binary-cache-" + $vcpkg_hash.Hash | ||
$file_name_extension = "${file_name}.7z" | ||
|
||
aws --quiet s3 cp s3://centreon-collect-robot-report/$file_name_extension $file_name_extension | ||
if ( $? -ne 0 ) { | ||
Write-Host "#######################################################################################################################" | ||
Write-Host "binary cache unavailable for this version we will need to build it, it will take a long time" | ||
Write-Host "#######################################################################################################################" | ||
Write-Host "Create cmake files before upload binary-cache" | ||
cmake --preset=release | ||
|
||
Write-Host "Compress binary archive" | ||
7z a $file_name_extension vcpkg\vcpkg-binary-cache | ||
Write-Host "Upload binary archive" | ||
aws s3 cp $file_name_extension s3://centreon-collect-robot-report/$file_name_extension | ||
} | ||
else { | ||
7z x $file_name_extension | ||
|
||
Write-Host "Create cmake files from binary-cache downloaded" | ||
cmake --preset=release-ci-use-binary-cache | ||
|
||
} | ||
|
||
|
||
Write-Host "build agent and tests" | ||
cmake --build build_windows | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters