Commit 0b69b3f 1 parent 33a85bd commit 0b69b3f Copy full SHA for 0b69b3f
File tree 5 files changed +41
-11
lines changed
5 files changed +41
-11
lines changed Original file line number Diff line number Diff line change
1
+ name : Run Tests
2
+
3
+ # Controls when the workflow will run
4
+ on :
5
+ push :
6
+ branches :
7
+ - main
8
+ pull_request :
9
+ branches :
10
+ - main
11
+ workflow_dispatch :
12
+
13
+ jobs :
14
+ build :
15
+ runs-on : ubuntu-latest
16
+ steps :
17
+ - uses : actions/checkout@v4
18
+
19
+ - name : Install ModuleTools module form PSGallery
20
+ run : |
21
+ Install-PSResource -Repository PSGallery -Name ModuleTools -TrustRepository
22
+ shell : pwsh
23
+
24
+ - name : Install ModuleTools module form PSGallery
25
+ run : |
26
+ Invoke-MTTest
27
+ shell : pwsh
Original file line number Diff line number Diff line change 19
19
"LicenseUri" : " https://github.com/belibug/SecretBackup/blob/main/LICENSE"
20
20
},
21
21
"Pester" : {
22
- "TestResult" : false ,
22
+ "TestResult" : {
23
+ "Enabled" : true ,
24
+ "OutputFormat" : " NUnitXml"
25
+ },
23
26
"Output" : {
24
27
"Verbosity" : " Detailed"
25
28
}
35
38
" PSAvoidUsingConvertToSecureStringWithPlainText"
36
39
]
37
40
}
38
- }
41
+ }
Original file line number Diff line number Diff line change 1
1
BeforeAll {
2
- Import-Module - Name .\PSPacker
3
- $data = Import-ProjectData
2
+ $data = Get-MTProjectInfo
4
3
}
5
4
6
5
Describe ' General Module Control' {
Original file line number Diff line number Diff line change 1
1
BeforeAll {
2
- Import-Module - Name .\PSPacker
3
- $data = Import-ProjectData
2
+ $data = Get-MTProjectInfo
4
3
$files = Get-ChildItem $data.OutputModuleDir
5
4
}
6
5
@@ -19,8 +18,7 @@ Describe 'Module and Manifest testing' {
19
18
$status = (Get-AuthenticodeSignature - FilePath $_ ).Status
20
19
if ($status -eq ' NotSigned' ) {
21
20
Set-TestInconclusive - Message ' Not yet signed'
22
- }
23
- else {
21
+ } else {
24
22
$status | Should - Be ' Valid'
25
23
}
26
24
}
Original file line number Diff line number Diff line change @@ -2,8 +2,11 @@ BeforeDiscovery {
2
2
$files = Get-ChildItem - Path .\src - Filter ' *.ps1' - Recurse
3
3
}
4
4
BeforeAll {
5
- Import-Module - Name .\PSPacker - Force
6
- $data = Import-ProjectData
5
+ $ScriptAnalyzerSettings = @ {
6
+ IncludeDefaultRules = $true
7
+ Severity = @ (' Warning' , ' Error' )
8
+ ExcludeRules = @ (' PSAvoidUsingWriteHost' , ' PSAvoidUsingConvertToSecureStringWithPlainText' )
9
+ }
7
10
}
8
11
Describe ' File: <_.basename>' - ForEach $files {
9
12
Context ' Code Quality Check' {
@@ -14,7 +17,7 @@ Describe 'File: <_.basename>' -ForEach $files {
14
17
$errors.Count | Should - Be 0
15
18
}
16
19
It ' passess ScriptAnalyzer' {
17
- $saResults = Invoke-ScriptAnalyzer - Path $_ - Settings $data .PSScriptAnalyzer
20
+ $saResults = Invoke-ScriptAnalyzer - Path $_ - Settings $ScriptAnalyzerSettings
18
21
$saResults | Should - BeNullOrEmpty - Because $ ($saResults.Message -join ' ;' )
19
22
}
20
23
}
You can’t perform that action at this time.
0 commit comments