Skip to content

Bump peter-murray/workflow-application-token-action from b1ad34e28f4ef30582df1bd5f45df2044eb7a6b9 to dc0413987a085fa17d19df9e47d4677cf81ffef3 #26

Bump peter-murray/workflow-application-token-action from b1ad34e28f4ef30582df1bd5f45df2044eb7a6b9 to dc0413987a085fa17d19df9e47d4677cf81ffef3

Bump peter-murray/workflow-application-token-action from b1ad34e28f4ef30582df1bd5f45df2044eb7a6b9 to dc0413987a085fa17d19df9e47d4677cf81ffef3 #26

Workflow file for this run

name: Run Pester Tests
on:
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
if: 1 == 2 # the dockercommand needs to gets fixed and execute the test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Docker image
run: docker build . -f .devcontainer/Dockerfile -t unittest-image
- name: Run Pester tests in the container
run: |
# run the container with the source code mounted as a volume
docker run --name unittest-container -v ${{ github.workspace }}:/workspace -d unittest-image
echo "Running a test command"
docker exec unittest-container pwsh -Command { Write-Host "Hi" }
echo "Running the tests"
docker exec unittest-container pwsh -Command {
try {
Write-Host "Running Pester tests inside the container"
ls
cd workspace
ls
cd ..
Invoke-Pester -Path workspace
Write-Host "Pester tests completed"
} catch {
Write-Host "Error: $_"
exit 1
}
}
- name: Output Docker logs
if: ${{ failure() }}
run: docker logs unittest-container
test-direct:
runs-on: ubuntu-latest
defaults:
run:
shell: pwsh
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Pester tests
run: |
try {
Write-Host "Running Pester tests"
Invoke-Pester -Path . -OutputFormat NUnitXml -OutputFile TestResults.xml
Write-Host "Pester tests completed"
} catch {
Write-Host "Error: $_"
exit 1
}
- name: Set GITHUB_STEP_SUMMARY
run: |
[xml]$testResults = Get-Content -Path TestResults.xml
Write-Host $testResults
$markdownTableRows = $testResults.'test-results'.'test-suite'.results.'test-suite' | ForEach-Object {
"| $($_.name) | $($_.executed) | $($_.result) | $($_.success) |"
}
$markdownTableLines = $markdownTableRows -join "`n"
$markdownTable = "| Test Name | Executed | Result | Success |`n| --- | --- | --- | --- |`n $markdownTableLines"
echo "$markdownTable" >> $env:GITHUB_STEP_SUMMARY