-
Notifications
You must be signed in to change notification settings - Fork 6
53 lines (44 loc) · 2.09 KB
/
windows-agent-build-vcpkg.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Centreon Monitoring Agent Windows packaging
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
jobs:
build-vcpkg-and-export:
runs-on: windows-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.COLLECT_S3_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.COLLECT_S3_SECRET_KEY }}
steps:
- name: Checkout sources
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: install msvc command prompt
uses: ilammy/[email protected]
- name: install vcpkg
run: |
git clone --depth 1 https://github.com/microsoft/vcpkg
cd vcpkg
bootstrap-vcpkg.bat
- name: compile packages
run: |
[System.Environment]::SetEnvironmentVariable("VCPKG_ROOT",$pwd.ToString()+"\vcpkg")
[System.Environment]::SetEnvironmentVariable("PATH",$pwd.ToString()+"\vcpkg:" + $env:PATH)
cmake.exe --preset=release
- name: 7zip packages and save to s3
run: |
$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 = "centreon-agent-prebuild-" + $vcpkg_hash.Hash
$file_name_extension = "${file_name}.7z"
Write-Host "store vcpkg package to $file_name"
7z a $file_name_extension vcpkg
Write-Host "aws s3 cp $file_name_extension s3://centreon-collect-robot-report/$file_name_extension"
[System.Environment]::SetEnvironmentVariable("AWS_EC2_METADATA_DISABLED","true")
aws s3 cp $file_name_extension s3://centreon-collect-robot-report/$file_name_extension