-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (69 loc) · 2.1 KB
/
Copy pathrun-tests.yml
File metadata and controls
76 lines (69 loc) · 2.1 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: HomeLab Tests
on:
push:
branches: [main]
paths-ignore:
- "**.md"
- "docs/**"
pull_request:
branches: [main]
paths-ignore:
- "**.md"
- "docs/**"
workflow_dispatch:
inputs:
test_type:
description: "Type of tests to run"
required: true
default: "All"
type: choice
options:
- All
- Unit
- Integration
- Workflow
jobs:
test:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install required modules
shell: pwsh
run: |
Write-Host "Installing PowerShell modules..."
Install-Module -Name Pester -Force -SkipPublisherCheck
Install-Module -Name Az.Accounts -Force -SkipPublisherCheck
Install-Module -Name Az.Resources -Force -SkipPublisherCheck
Install-Module -Name Az.Network -Force -SkipPublisherCheck
Install-Module -Name Az.Websites -Force -SkipPublisherCheck
Install-Module -Name Az.Dns -Force -SkipPublisherCheck
Install-Module -Name PowerShell-Yaml -Force -SkipPublisherCheck
Write-Host "Module installation completed."
- name: Run tests
shell: pwsh
run: |
$testType = '${{ github.event.inputs.test_type }}'
if ([string]::IsNullOrEmpty($testType)) {
$testType = 'All'
}
Write-Host "Running $testType tests..."
cd tests
./Run-HomeLab-Tests.ps1 -TestType $testType -GenerateReport
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: |
tests/TestResults.xml
tests/TestReport.html
- name: Display test summary
if: always()
shell: pwsh
run: |
if (Test-Path "tests/TestResults.xml") {
Write-Host "Test results available in artifacts" -ForegroundColor Green
} else {
Write-Host "No test results file found" -ForegroundColor Yellow
}