-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (127 loc) · 4.82 KB
/
Test-ModuleLocal.yml
File metadata and controls
134 lines (127 loc) · 4.82 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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:
RunsOn:
type: string
description: The type of runner to use for the job.
required: true
OS:
type: string
description: The operating system name.
required: true
Name:
type: string
description: The name of the module to process. Scripts default to the repository name if nothing is specified.
required: false
TestPath:
type: string
description: The path to the tests folder.
required: false
default: tests
TestName:
type: string
description: The path to the tests folder.
required: false
default: tests
Debug:
type: boolean
description: Enable debug output.
required: false
default: false
Verbose:
type: boolean
description: Enable verbose output.
required: false
default: false
Version:
type: string
description: Specifies the version of the GitHub module to be installed. The value must be an exact version.
required: false
default: ''
Prerelease:
type: boolean
description: Whether to use a prerelease version of the 'GitHub' module.
required: false
default: false
WorkingDirectory:
type: string
description: The working directory where the script will run from.
required: false
default: '.'
permissions:
contents: read # to checkout the repo and create releases on the repo
jobs:
Test-ModuleLocal:
name: Test-${{ inputs.TestName }} (${{ inputs.RunsOn }})
runs-on: ${{ inputs.RunsOn }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Download module artifact
uses: actions/download-artifact@v4
with:
name: module
path: ${{ inputs.WorkingDirectory }}/outputs/module
- name: Install-PSModuleHelpers
uses: PSModule/Install-PSModuleHelpers@v1
- name: Import-Module
id: import-module
shell: pwsh
working-directory: ${{ inputs.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@v4
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 }} # Used in tests!
with:
Debug: ${{ inputs.Debug }}
Prerelease: ${{ inputs.Prerelease }}
Verbose: ${{ inputs.Verbose }}
Version: ${{ inputs.Version }}
TestResult_TestSuiteName: ${{ inputs.TestName }}-${{ inputs.OS }}
TestResult_Enabled: true
CodeCoverage_Enabled: true
Output_Verbosity: Detailed
CodeCoverage_OutputFormat: JaCoCo
CodeCoverage_CoveragePercentTarget: 0
Filter_ExcludeTag: Flaky
Path: ${{ inputs.TestPath }}
Run_Path: ${{ steps.import-module.outputs.path }}
WorkingDirectory: ${{ inputs.WorkingDirectory }}
Prescript: | # This is to speed up module loading in Pester.
Import-Module -Name '${{ steps.import-module.outputs.name }}' -RequiredVersion 999.0.0