-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (92 loc) · 4.03 KB
/
Test-ModuleLocal.yml
File metadata and controls
100 lines (92 loc) · 4.03 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Test-ModuleLocal
on:
workflow_call:
secrets:
TEST_APP_ENT_CLIENT_ID:
description: The client ID of an Enterprise GitHub App for running tests.
required: false
TEST_APP_ENT_PRIVATE_KEY:
description: The private key of an Enterprise GitHub App for running tests.
required: false
TEST_APP_ORG_CLIENT_ID:
description: The client ID of an Organization GitHub App for running tests.
required: false
TEST_APP_ORG_PRIVATE_KEY:
description: The private key of an Organization GitHub App for running tests.
required: false
TEST_USER_ORG_FG_PAT:
description: The fine-grained personal access token with org access for running tests.
required: false
TEST_USER_USER_FG_PAT:
description: The fine-grained personal access token with user account access for running tests.
required: false
TEST_USER_PAT:
description: The classic personal access token for running tests.
required: false
inputs:
Settings:
type: string
description: The settings object as a JSON string.
required: true
permissions:
contents: read # to checkout the repo and create releases on the repo
env:
TEST_APP_ENT_CLIENT_ID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }}
TEST_APP_ENT_PRIVATE_KEY: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }}
TEST_APP_ORG_CLIENT_ID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }}
TEST_APP_ORG_PRIVATE_KEY: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }}
TEST_USER_ORG_FG_PAT: ${{ secrets.TEST_USER_ORG_FG_PAT }}
TEST_USER_USER_FG_PAT: ${{ secrets.TEST_USER_USER_FG_PAT }}
TEST_USER_PAT: ${{ secrets.TEST_USER_PAT }}
GITHUB_TOKEN: ${{ github.token }}
jobs:
Test-ModuleLocal:
name: Test-${{ matrix.TestName }} (${{ matrix.OSName }})
runs-on: ${{ matrix.RunsOn }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(inputs.Settings).TestSuites.Module }}
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0
- name: Download module artifact
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: module
path: ${{ fromJson(inputs.Settings).WorkingDirectory }}/outputs/module
- name: Install-PSModuleHelpers
uses: PSModule/Install-PSModuleHelpers@ed79b6e3aa8c9cd3d30ab2bf02ea6bd4687b9c74 # v1.0.7
- name: Import-Module
id: import-module
shell: pwsh
working-directory: ${{ fromJson(inputs.Settings).WorkingDirectory }}
run: |
$name = Get-ChildItem "outputs/module" | Select-Object -ExpandProperty Name
$path = Install-PSModule -Path "outputs/module/$name" -PassThru
Write-Warning $path
"name=$name" >> $env:GITHUB_OUTPUT
"path=$path" >> $env:GITHUB_OUTPUT
- name: Test-ModuleLocal
uses: PSModule/Invoke-Pester@1fcb663c0efe914e8374d78e16aa7bb907ea2434 # v4.2.3
with:
Debug: ${{ fromJson(inputs.Settings).Debug }}
Prerelease: ${{ fromJson(inputs.Settings).Prerelease }}
Verbose: ${{ fromJson(inputs.Settings).Verbose }}
Version: ${{ fromJson(inputs.Settings).Version }}
TestResult_TestSuiteName: ${{ matrix.TestName }}-${{ matrix.OSName }}
TestResult_Enabled: true
CodeCoverage_Enabled: true
Output_Verbosity: Detailed
CodeCoverage_OutputFormat: JaCoCo
CodeCoverage_CoveragePercentTarget: 0
Filter_ExcludeTag: Flaky
Path: ${{ matrix.TestPath }}
Run_Path: ${{ steps.import-module.outputs.path }}
WorkingDirectory: ${{ fromJson(inputs.Settings).WorkingDirectory }}
Prescript: | # This is to speed up module loading in Pester.
Install-PSResource -Repository PSGallery -TrustRepository -Name PSCustomObject
Import-Module -Name '${{ steps.import-module.outputs.name }}' -RequiredVersion 999.0.0