Skip to content

Update EvergreenLibraryTemplate.json #144

Update EvergreenLibraryTemplate.json

Update EvergreenLibraryTemplate.json #144

Workflow file for this run

name: 'Validate other branches'
env:
BUILD_NUMBER: "704"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
workflow_dispatch:
push:
branches-ignore: [ "main", "development" ]
paths:
- 'Evergreen/**.ps1'
- 'Evergreen/**.psm1'
- 'Evergreen/**.json'
pull_request:
branches: [ "development" ]
paths:
- 'Evergreen/**.ps1'
- 'Evergreen/**.psm1'
- 'Evergreen/**.json'
jobs:
psscriptanalyzer:
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: Run PSScriptAnalyzer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run PSScriptAnalyzer (other branches)
uses: microsoft/psscriptanalyzer-action@6b2948b1944407914a58661c49941824d149734f
with:
path: "./Evergreen"
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@v3
with:
sarif_file: results.sarif
pestertest:
name: Run Pester Tests (other branches)
needs: psscriptanalyzer
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Test with Pester
shell: powershell
working-directory: "${{ github.workspace }}"
run: |
.\tests\Install-Pester.ps1
Import-Module -Name "Pester" -Force -ErrorAction "Stop"
Import-Module -Name "$env:GITHUB_WORKSPACE\Evergreen" -Force
$Config = [PesterConfiguration]::Default
$Config.Run.Path = "$env:GITHUB_WORKSPACE\tests\Main.Tests.ps1"
$Config.Run.PassThru = $true
$Config.CodeCoverage.Enabled = $false
$Config.CodeCoverage.Path = "$env:GITHUB_WORKSPACE\Evergreen"
$Config.CodeCoverage.OutputFormat = "JaCoCo"
$Config.CodeCoverage.OutputPath = "$env:GITHUB_WORKSPACE\tests\CodeCoverage.xml"
$Config.Output.Verbosity = "Normal"
$Config.TestResult.Enabled = $true
$Config.TestResult.OutputFormat = "NUnitXml"
$Config.TestResult.OutputPath = "$env:GITHUB_WORKSPACE\tests\TestResults.xml"
Invoke-Pester -Configuration $Config
# Upload test results
- name: Upload Pester test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: "${{ github.workspace }}\\tests\\TestResults.xml"
# Publish Pester test results
- name: Publish Pester test results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always()
with:
nunit_files: "${{ github.workspace }}\\tests\\TestResults.xml"