fleet/.github/workflows/test-fma-windows.yml
Konstantin Sykulev b1a392d672
FMA test automation (#31210)
For #29183

# Checklist for submitter

- [x] Added/updated automated tests
- [x] Manual QA for all new/changed functionality


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Introduced automated validation workflows for maintained applications
on both macOS and Windows, ensuring apps can be installed, verified, and
uninstalled as expected.
* Added new command-line tool to validate maintained apps, providing
detailed reporting on validation results.
* Enhanced detection and handling of pre-installed applications during
validation.
* Improved post-installation steps for macOS, including quarantine
removal and system refresh.

* **Chores**
* Added new continuous integration workflows to automate application
validation on pull requests for relevant files.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-31 15:23:36 -05:00

85 lines
3 KiB
YAML

name: Test Fleet Maintained Apps - Windows
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- ee/maintained-apps/inputs/**
- ee/maintained-apps/outputs/**
- cmd/maintained-apps/validate/**
workflow_dispatch: # Manual trigger
inputs:
log_level:
description: 'Log level (debug, info, warn, error)'
required: false
default: 'info'
type: choice
options:
- debug
- info
- warn
- error
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
test-fma:
env:
LOG_LEVEL: ${{ github.event.inputs.log_level || 'info' }}
runs-on: windows-latest
steps:
- name: Checkout Fleet
uses: actions/checkout@v4
with:
repository: fleetdm/fleet
fetch-depth: 1
ref: ${{ github.ref }}
path: fleet
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'fleet/go.mod'
- name: Install osquery windows
run: |
Write-Host "Runner architecture: $env:PROCESSOR_ARCHITECTURE"
curl -L -o osquery.zip "https://github.com/osquery/osquery/releases/download/5.18.1/osquery-5.18.1.windows_x86_64.zip"
Expand-Archive -Path osquery.zip -DestinationPath osquery
Get-ChildItem -Recurse osquery | Where-Object { $_.Name -like "*osquery*" -and $_.Extension -eq ".exe" }
$osqueryPath = (Get-ChildItem -Recurse osquery | Where-Object { $_.Name -eq "osqueryi.exe" }).Directory.FullName
echo "Adding to PATH: $osqueryPath"
echo $osqueryPath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh
- name: Remove pre-installed google chrome
run: |
Write-Host "Listing all installed packages containing 'Chrome':"
Get-Package | Where-Object { $_.Name -like "*Chrome*" } | ForEach-Object {
Write-Host " - $($_.Name) (Version: $($_.Version))"
}
$uninstallPath = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" | Where-Object { $_.DisplayName -like "*Google Chrome*" } | Select-Object -ExpandProperty UninstallString
if ($uninstallPath) {
Write-Host "Found Chrome uninstall path: $uninstallPath"
try {
$guid = ($uninstallPath -split "/X")[1]
Write-Host "Uninstalling Chrome MSI with GUID: $guid"
Start-Process -FilePath "msiexec.exe" -ArgumentList "/X$guid", "/quiet", "/norestart" -Wait -NoNewWindow
Write-Host "Successfully removed Google Chrome via MSI uninstaller"
} catch {
Write-Host "Failed to remove Chrome: $($_.Exception.Message)"
}
} else {
Write-Host "Chrome uninstall path not found in registry"
}
shell: pwsh
- name: Verify Fleet Maintained Apps windows
run: |
ls "C:\Program Files"
cd fleet
go run ./cmd/maintained-apps/validate
shell: pwsh