-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (70 loc) · 2.76 KB
/
Copy pathAfterAll-ModuleLocal.yml
File metadata and controls
79 lines (70 loc) · 2.76 KB
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
name: AfterAll-ModuleLocal
on:
workflow_call:
secrets:
TestData:
description: |
Optional single-line JSON object with 'secrets' and 'variables' maps. Each entry is exposed
as an environment variable available to the AfterAll teardown script; 'secrets' values are
masked in the logs, 'variables' values are not.
required: false
inputs:
Settings:
type: string
description: The complete settings object including test suites.
required: true
permissions:
contents: read # to checkout the repo
jobs:
AfterAll-ModuleLocal:
name: AfterAll-ModuleLocal
runs-on: ubuntu-latest
env:
SETTINGS: ${{ inputs.Settings }}
steps:
- name: Checkout Code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
fetch-depth: 0
- name: Checkout Process-PSModule
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: ${{ job.workflow_repository }}
ref: ${{ job.workflow_sha }}
path: _wf
persist-credentials: false
- name: Install-PSModule
uses: ./_wf/.github/actions/Install-PSModule
- name: Expose caller-provided test data
uses: ./_wf/.github/actions/Expose-TestData
with:
TestData: ${{ secrets.TestData }}
- name: Run AfterAll Teardown Scripts
if: always()
uses: PSModule/GitHub-Script@8083ec1f733f00357ee4d0db0c6056686e483bc0 # v1.9.0
with:
Name: AfterAll-ModuleLocal
ShowInfo: false
ShowOutput: true
Debug: ${{ fromJson(inputs.Settings).Debug }}
Prerelease: ${{ fromJson(inputs.Settings).Prerelease }}
Verbose: ${{ fromJson(inputs.Settings).Verbose }}
Version: ${{ fromJson(inputs.Settings).Version }}
WorkingDirectory: ${{ fromJson(inputs.Settings).WorkingDirectory }}
Script: |
LogGroup "Running AfterAll Teardown Scripts" {
$afterAllScript = 'tests/AfterAll.ps1'
if (-not (Test-Path $afterAllScript)) {
Write-Host "No AfterAll.ps1 script found at [$afterAllScript] - exiting successfully"
exit 0
}
Write-Host "Running AfterAll teardown script: $afterAllScript"
try {
& $afterAllScript
Write-Host "AfterAll script completed successfully: $afterAllScript"
} catch {
Write-Warning "AfterAll script failed: $afterAllScript - $_"
# Don't throw for teardown scripts to ensure other cleanup scripts can run
}
}