Update scripts #169
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
# pssa: | |
# permissions: | |
# contents: read # for actions/checkout to fetch code | |
# security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | |
# actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status | |
# name: PSScriptAnalyzer | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Run PSScriptAnalyzer | |
# uses: microsoft/psscriptanalyzer-action@6b2948b1944407914a58661c49941824d149734f | |
# with: | |
# path: "./scripts" | |
# recurse: true | |
# output: results.sarif | |
# # Upload the SARIF file generated in the previous step | |
# - name: Upload SARIF results file | |
# uses: github/codeql-action/upload-sarif@v2 | |
# with: | |
# sarif_file: results.sarif | |
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: | | |
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@v3 | |
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@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./CodeCoverage.xml | |
verbose: true | |
- name: Upload installed apps list | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: installed-applications | |
path: "${{ github.workspace }}\\support\\InstalledApplications.csv" |