-
Notifications
You must be signed in to change notification settings - Fork 2
97 lines (86 loc) · 3.09 KB
/
test-avd.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: "Validate scripts"
on:
workflow_dispatch:
push:
paths:
- 'scripts/image/*.ps1'
- 'scripts/tweaks/*.ps1'
- 'scripts/uninstall/*.ps1'
- 'tests/*.ps1'
- '.github/workflows/test-avd.yml'
# schedule:
# - cron: '0 1 15 * *' #Run on the 15th of each month
jobs:
test:
name: Run tests
#needs: pssa
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
#with:
#token: ${{ secrets.GH_TOKEN }}
- name: Install modules
shell: powershell
working-directory: "${{ github.workspace }}"
run: |
.\tests\Install-Modules.ps1
- name: Test with Pester
shell: powershell
if: always()
working-directory: "${{ github.workspace }}"
run: |
$AzureRegionName = "${{ secrets.AZUREREGIONNAME }}"
$SecureVars = @{ VariablesList = "${{ secrets.VARIABLESLIST }}" }
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
$params = @{
Uri = $SecureVars.VariablesList
UseBasicParsing = $true
ErrorAction = "Stop"
}
Invoke-RestMethod @params
Import-Module -Name "Pester" -Force -ErrorAction "Stop"
$Config = New-PesterConfiguration
$Config.Run.Path = "$Env:GITHUB_WORKSPACE\tests\scripts"
$Config.Run.PassThru = $true
$Config.CodeCoverage.Enabled = $true
$Config.CodeCoverage.Path = "$Env:GITHUB_WORKSPACE\scripts"
$Config.CodeCoverage.OutputFormat = "JaCoCo"
$Config.CodeCoverage.OutputPath = "$Env:GITHUB_WORKSPACE\CodeCoverage.xml"
$Config.TestResult.Enabled = $true
$Config.TestResult.OutputFormat = "NUnitXml"
$Config.TestResult.OutputPath = "$Env:GITHUB_WORKSPACE\tests\TestResults.xml"
$Config.Output.Verbosity = "Detailed"
Invoke-Pester -Configuration $Config
# Upload test results
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: "${{ github.workspace }}\\tests\\TestResults.xml"
# Publish test results
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always()
with:
nunit_files: "${{ github.workspace }}\\tests\\TestResults.xml"
- name: Upload to Codecov
id: codecov
if: always()
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./CodeCoverage.xml
verbose: true
- name: Upload installed apps list
uses: actions/upload-artifact@v4
if: always()
with:
name: installed-applications
path: "${{ github.workspace }}\\support\\InstalledApplications.csv"
- name: Upload installer logs
uses: actions/upload-artifact@v4
if: always()
with:
name: installer-logs
path: "${{ github.workspace }}\\support\\logs\\"