Skip to content

github_actions: use the latest test resources #47

github_actions: use the latest test resources

github_actions: use the latest test resources #47

name: Cloudbase-Init - build and functionally test MSI
on: [push, pull_request]
env:
TEST_RESOURCES: "https://github.com/cloudbase/cloudbase-init-test-resources"
TEST_RESOURCES_BRANCH: "master"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 100
matrix:
os: ['windows-2022']
download_official_python_msi: ["true"]
remove_python_pycs: ["true"]
install_with_pymanager: ["true"]
cbsinit_repo: ['https://github.com/cloudbase/cloudbase-init']
cbsinit_branch: ['master']
python_version: ['3.14_4']
platform: ['x64']
cloud: [openstack]
steps:
- uses: actions/checkout@v6
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v3
- name: Build msi
shell: cmd
run:
powershell.exe .\BuildAutomation\BuildCloudbaseInitSetup.ps1 ^
-ClonePullInstallerRepo:$false ^
-PythonVersion ${{ matrix.python_version }} ^
-Platform ${{ matrix.platform }} ^
-VCVars "automatic" ^
-VSRedistDir "''" ^
-CloudbaseInitRepoUrl ${{ matrix.cbsinit_repo }} ^
-CloudbaseInitRepoBranch ${{ matrix.cbsinit_branch }} ^
-InstallOfficialPythonMsi:$${{ matrix.download_official_python_msi }} ^
-OfficialPythonMsiChecksum "C10234D0D9BD89F6F6DD55BAE28EDE0F97EE0DF4" ^
-RemovePythonPycs:$${{ matrix.remove_python_pycs }} ^
-InstallOfficialPythonUsingPyManager:$${{ matrix.install_with_pymanager }}
- uses: actions/upload-artifact@v7
with:
name: "CloudbaseInit_platform-${{ matrix.platform }}_build-env-os-${{ matrix.os }}_download-official-msi-${{ matrix.download_official_python_msi }}_remove-pycs-${{ matrix.remove_python_pycs }}_install-with-pymanager${{ matrix.install_with_pymanager }}_cbs-init-branch-${{ matrix.cbsinit_branch }}_MSI"
path: 'CloudbaseInitSetup/bin/release/${{ matrix.platform }}/CloudbaseInitSetup.msi'
- name: Install MSI and functionally test Cloudbase-Init
shell: powershell
run: |
$Erroractionpreference = "Continue"
$log = "install.log"
touch $log
$msiPath = (Resolve-Path "CloudbaseInitSetup/bin/release/${{ matrix.platform }}/CloudbaseInitSetup.msi").Path
Write-Output $msiPath
echo $msiPath
$procMain = Start-Process "msiexec" "/i `"$msiPath`" /qn /l*! `"$log`"" -NoNewWindow -PassThru
$procLog = Start-Process "powershell" "Get-Content -Path `"$log`" -Wait" -NoNewWindow -PassThru
$procMain.WaitForExit()
$procLog.Kill()
- name: Download external dependencies
shell: cmd
run: |
git clone %TEST_RESOURCES% -b %TEST_RESOURCES_BRANCH% test-resources
- name: Run Cloudbase-Init functional tests
shell: powershell
run: |
Install-Module -Force -AllowClobber -Confirm:$false "Pester"
$ENV:CLOUD = "${{ matrix.cloud }}"
$ENV:TEST_ARCHITECTURE = "${{ matrix.architecture }}"
Invoke-Pester test-resources/functional-tests -Output Detailed -FullNameFilter TestVerifyBeforeAllPlugins
try {
& cmd /c "'C:\\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Scripts\cloudbase-init.exe' --noreset_service_password --config-file ./test-resources/${{ matrix.cloud }}/cloudbase-init.conf 2>&1" | Tee-Object -FilePath cloudbase-init.log
} catch {}
$errors = $(cat ./cloudbase-init.log | Where-Object {$_ -like "*error*"})
$pluginExecution = $(cat ./cloudbase-init.log | Where-Object {$_ -like "*Plugins execution done*"})
if ($errors -or !$pluginExecution) {
exit 1
}
Invoke-Pester test-resources/functional-tests -Output Detailed -FullNameFilter TestVerifyAfterAllPlugins
- name: Audit Cloudbase-Init pip packages
shell: powershell
run: |
$pythonPath = "C:\\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\python.exe"
$pipAuditPath = "C:\\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Scripts\pip-audit.exe"
& "${pythonPath}" -m pip install pip-audit
$pipAuditLogs = & "${pipAuditPath}"
Write-Output "$pipAuditLogs"
if ($LASTEXITCODE) {
throw "pip audit failed"
}