Skip to content

Commit

Permalink
build: Dropping Static Analysis Step ( Fixes #1085 )
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Mar 22, 2024
1 parent 20d13f3 commit db61d69
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 84 deletions.
82 changes: 0 additions & 82 deletions .github/workflows/TestAndPublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,88 +5,6 @@ on:
pull_request:
workflow_dispatch:
jobs:
PowerShellStaticAnalysis:
runs-on: ubuntu-latest
steps:
- name: InstallScriptCop
id: InstallScriptCop
shell: pwsh
run: |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name ScriptCop -Repository PSGallery -Force -Scope CurrentUser
Import-Module ScriptCop -Force -PassThru
- name: InstallPSScriptAnalyzer
id: InstallPSScriptAnalyzer
shell: pwsh
run: |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name PSScriptAnalyzer -Repository PSGallery -Force -Scope CurrentUser
Import-Module PSScriptAnalyzer -Force -PassThru
- name: InstallPSDevOps
id: InstallPSDevOps
shell: pwsh
run: |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name PSDevOps -Repository PSGallery -Force -Scope CurrentUser
Import-Module PSDevOps -Force -PassThru
- name: Check out repository
uses: actions/checkout@v2
- name: RunScriptCop
id: RunScriptCop
shell: pwsh
run: |
$Parameters = @{}
$Parameters.ModulePath = ${env:ModulePath}
foreach ($k in @($parameters.Keys)) {
if ([String]::IsNullOrEmpty($parameters[$k])) {
$parameters.Remove($k)
}
}
Write-Host "::debug:: RunScriptCop $(@(foreach ($p in $Parameters.GetEnumerator()) {'-' + $p.Key + ' ' + $p.Value}) -join ' ')"
& {param([string]$ModulePath)
Import-Module ScriptCop, PSDevOps -PassThru | Out-Host
if (-not $ModulePath) {
$orgName, $moduleName = $env:GITHUB_REPOSITORY -split "/"
$ModulePath = ".\$moduleName.psd1"
}
if ($ModulePath -like '*PSDevOps*') {
Remove-Module PSDeVOps # If running ScriptCop on PSDeVOps, we need to remove the global module first.
}
$importedModule =Import-Module $ModulePath -Force -PassThru
$importedModule | Out-Host
$importedModule |
Test-Command |
Tee-Object -Variable scriptCopIssues |
Out-Host
foreach ($issue in $scriptCopIssues) {
Write-GitHubWarning -Message "$($issue.ItemWithProblem): $($issue.Problem)"
}
} @Parameters
- name: RunPSScriptAnalyzer
id: RunPSScriptAnalyzer
shell: pwsh
run: |
Import-Module PSScriptAnalyzer, PSDevOps -PassThru | Out-Host
$invokeScriptAnalyzerSplat = @{Path='.\'}
if ($ENV:PSScriptAnalyzer_Recurse) {
$invokeScriptAnalyzerSplat.Recurse = $true
}
$result = Invoke-ScriptAnalyzer @invokeScriptAnalyzerSplat
foreach ($r in $result) {
if ('information', 'warning' -contains $r.Severity) {
Write-GitHubWarning -Message "$($r.RuleName) : $($r.Message)" -SourcePath $r.ScriptPath -LineNumber $r.Line -ColumnNumber $r.Column
}
elseif ($r.Severity -eq 'Error') {
Write-GitHubError -Message "$($r.RuleName) : $($r.Message)" -SourcePath $r.ScriptPath -LineNumber $r.Line -ColumnNumber $r.Column
}
}
TestPowerShellOnLinux:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 1 addition & 2 deletions Build/PipeScript.GitHubWorkflow.PSDevOps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ Import-BuildStep -SourcePath (
Push-Location ($PSScriptRoot | Split-Path)
New-GitHubWorkflow -Name "Analyze, Test, Tag, and Publish" -On Push,
PullRequest,
Demand -Job PowerShellStaticAnalysis,
TestPowerShellOnLinux,
Demand -Job TestPowerShellOnLinux,
TagReleaseAndPublish,
BuildPipeScript -OutputPath .\.github\workflows\TestAndPublish.yml

Expand Down

0 comments on commit db61d69

Please sign in to comment.