Skip to content

Commit 7682ff2

Browse files
đź”§ [CI]: Refactor workflow to include Lint-SourceCode job and update dependencies
1 parent da0af7f commit 7682ff2

File tree

3 files changed

+86
-20
lines changed

3 files changed

+86
-20
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Lint-SourceCode
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
RunsOn:
7+
type: string
8+
description: The type of runner to use for the job.
9+
required: true
10+
OS:
11+
type: string
12+
description: The operating system name.
13+
required: true
14+
Name:
15+
type: string
16+
description: The name of the module to process. Scripts default to the repository name if nothing is specified.
17+
required: false
18+
Debug:
19+
type: boolean
20+
description: Enable debug output.
21+
required: false
22+
default: false
23+
Verbose:
24+
type: boolean
25+
description: Enable verbose output.
26+
required: false
27+
default: false
28+
Version:
29+
type: string
30+
description: Specifies the version of the GitHub module to be installed. The value must be an exact version.
31+
required: false
32+
default: ''
33+
Prerelease:
34+
type: boolean
35+
description: Whether to use a prerelease version of the 'GitHub' module.
36+
required: false
37+
default: false
38+
WorkingDirectory:
39+
type: string
40+
description: The working directory where the script will run from.
41+
required: false
42+
default: '.'
43+
44+
permissions:
45+
contents: read # to checkout the repo and create releases on the repo
46+
47+
jobs:
48+
Lint-SourceCode:
49+
name: Lint-SourceCode (${{ inputs.RunsOn }})
50+
runs-on: ${{ inputs.RunsOn }}
51+
steps:
52+
- name: Checkout Code
53+
uses: actions/checkout@v4
54+
55+
- name: Lint-SourceCode
56+
uses: PSModule/Invoke-ScriptAnalyzer@v3
57+
with:
58+
Debug: ${{ inputs.Debug }}
59+
Prerelease: ${{ inputs.Prerelease }}
60+
Verbose: ${{ inputs.Verbose }}
61+
Version: ${{ inputs.Version }}
62+
Path: src
63+
Settings: SourceCode
64+
WorkingDirectory: ${{ inputs.WorkingDirectory }}
65+
TestResult_Enabled: true
66+
TestResult_TestSuiteName: PSModuleLint-SourceCode-${{ runner.os }}

‎.github/workflows/Test-SourceCode.yml‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,3 @@ jobs:
6161
Version: ${{ inputs.Version }}
6262
WorkingDirectory: ${{ inputs.WorkingDirectory }}
6363
Settings: SourceCode
64-
65-
Lint-SourceCode:
66-
name: Lint-SourceCode (${{ inputs.RunsOn }})
67-
runs-on: ${{ inputs.RunsOn }}
68-
steps:
69-
- name: Checkout Code
70-
uses: actions/checkout@v4
71-
72-
- name: Lint-SourceCode
73-
uses: PSModule/Invoke-ScriptAnalyzer@v3
74-
with:
75-
Debug: ${{ inputs.Debug }}
76-
Prerelease: ${{ inputs.Prerelease }}
77-
Verbose: ${{ inputs.Verbose }}
78-
Version: ${{ inputs.Version }}
79-
Path: src
80-
Settings: SourceCode
81-
WorkingDirectory: ${{ inputs.WorkingDirectory }}
82-
TestResult_Enabled: true
83-
TestResult_TestSuiteName: PSModuleLint-SourceCode-${{ runner.os }}

‎.github/workflows/workflow.yml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,25 @@ jobs:
9999
Version: ${{ inputs.Version }}
100100
WorkingDirectory: ${{ inputs.WorkingDirectory }}
101101

102+
Lint-SourceCode:
103+
if: ${{ needs.Get-Settings.outputs.SourceCodeTestSuites != '[]' }}
104+
needs:
105+
- Get-Settings
106+
strategy:
107+
fail-fast: false
108+
matrix:
109+
include: ${{ fromJson(needs.Get-Settings.outputs.SourceCodeTestSuites) }}
110+
uses: ./.github/workflows/Lint-SourceCode.yml
111+
with:
112+
RunsOn: ${{ matrix.RunsOn }}
113+
OS: ${{ matrix.OSName }}
114+
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
115+
Debug: ${{ inputs.Debug }}
116+
Prerelease: ${{ inputs.Prerelease }}
117+
Verbose: ${{ inputs.Verbose }}
118+
Version: ${{ inputs.Version }}
119+
WorkingDirectory: ${{ inputs.WorkingDirectory }}
120+
102121
Build-Module:
103122
if: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Module.Skip != true }}
104123
uses: ./.github/workflows/Build-Module.yml
@@ -175,6 +194,7 @@ jobs:
175194
needs:
176195
- Get-Settings
177196
- Test-SourceCode
197+
- Lint-SourceCode
178198
- Test-Module
179199
- Test-ModuleLocal
180200
uses: ./.github/workflows/Get-TestResults.yml

0 commit comments

Comments
 (0)