Skip to content

Update pipelines

Update pipelines #218

Workflow file for this run

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"
$CodeDirs = @("$Env:GITHUB_WORKSPACE\scripts\image",
"$Env:GITHUB_WORKSPACE\scripts\tweaks",
"$Env:GITHUB_WORKSPACE\scripts\uninstall")
$Config = New-PesterConfiguration
$Config.Run.Path = "$Env:GITHUB_WORKSPACE\tests\scripts"
$Config.Run.PassThru = $true
$Config.CodeCoverage.Enabled = $true
$Config.CodeCoverage.Path = $CodeDirs
$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\\"