Skip to content

Commit 54b3ebb

Browse files
🔧 [CI]: Refactor job dependencies and conditions in CI workflows for improved clarity and structure
1 parent 90e0304 commit 54b3ebb

File tree

2 files changed

+79
-79
lines changed

2 files changed

+79
-79
lines changed

‎.github/workflows/CI.yml‎

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -80,49 +80,39 @@ jobs:
8080
Version: ${{ inputs.Version }}
8181
WorkingDirectory: ${{ inputs.WorkingDirectory }}
8282

83-
Test-SourceCode:
84-
if: ${{ needs.Get-Settings.outputs.SourceCodeTestSuites != '[]' }}
83+
Build-Module:
84+
if: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Module.Skip != true }}
85+
uses: ./.github/workflows/Build-Module.yml
8586
needs:
8687
- Get-Settings
87-
strategy:
88-
fail-fast: false
89-
matrix:
90-
include: ${{ fromJson(needs.Get-Settings.outputs.SourceCodeTestSuites) }}
91-
uses: ./.github/workflows/Test-SourceCode.yml
9288
with:
93-
RunsOn: ${{ matrix.RunsOn }}
94-
OS: ${{ matrix.OSName }}
9589
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
9690
Debug: ${{ inputs.Debug }}
9791
Prerelease: ${{ inputs.Prerelease }}
9892
Verbose: ${{ inputs.Verbose }}
9993
Version: ${{ inputs.Version }}
10094
WorkingDirectory: ${{ inputs.WorkingDirectory }}
10195

102-
Lint-SourceCode:
103-
if: ${{ needs.Get-Settings.outputs.SourceCodeTestSuites != '[]' }}
96+
Build-Docs:
97+
if: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Docs.Skip != true }}
10498
needs:
10599
- 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
100+
- Build-Module
101+
uses: ./.github/workflows/Build-Docs.yml
111102
with:
112-
RunsOn: ${{ matrix.RunsOn }}
113-
OS: ${{ matrix.OSName }}
114103
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
115104
Debug: ${{ inputs.Debug }}
116105
Prerelease: ${{ inputs.Prerelease }}
117106
Verbose: ${{ inputs.Verbose }}
118107
Version: ${{ inputs.Version }}
119108
WorkingDirectory: ${{ inputs.WorkingDirectory }}
120109

121-
Build-Module:
122-
if: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Module.Skip != true }}
123-
uses: ./.github/workflows/Build-Module.yml
110+
Build-Site:
111+
if: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Site.Skip != true }}
124112
needs:
125113
- Get-Settings
114+
- Build-Docs
115+
uses: ./.github/workflows/Build-Site.yml
126116
with:
127117
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
128118
Debug: ${{ inputs.Debug }}
@@ -131,27 +121,37 @@ jobs:
131121
Version: ${{ inputs.Version }}
132122
WorkingDirectory: ${{ inputs.WorkingDirectory }}
133123

134-
Build-Docs:
135-
if: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Docs.Skip != true }}
124+
Test-SourceCode:
125+
if: ${{ needs.Get-Settings.outputs.SourceCodeTestSuites != '[]' }}
136126
needs:
137127
- Get-Settings
138-
- Build-Module
139-
uses: ./.github/workflows/Build-Docs.yml
128+
strategy:
129+
fail-fast: false
130+
matrix:
131+
include: ${{ fromJson(needs.Get-Settings.outputs.SourceCodeTestSuites) }}
132+
uses: ./.github/workflows/Test-SourceCode.yml
140133
with:
134+
RunsOn: ${{ matrix.RunsOn }}
135+
OS: ${{ matrix.OSName }}
141136
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
142137
Debug: ${{ inputs.Debug }}
143138
Prerelease: ${{ inputs.Prerelease }}
144139
Verbose: ${{ inputs.Verbose }}
145140
Version: ${{ inputs.Version }}
146141
WorkingDirectory: ${{ inputs.WorkingDirectory }}
147142

148-
Build-Site:
149-
if: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Site.Skip != true }}
143+
Lint-SourceCode:
144+
if: ${{ needs.Get-Settings.outputs.SourceCodeTestSuites != '[]' }}
150145
needs:
151146
- Get-Settings
152-
- Build-Docs
153-
uses: ./.github/workflows/Build-Site.yml
147+
strategy:
148+
fail-fast: false
149+
matrix:
150+
include: ${{ fromJson(needs.Get-Settings.outputs.SourceCodeTestSuites) }}
151+
uses: ./.github/workflows/Lint-SourceCode.yml
154152
with:
153+
RunsOn: ${{ matrix.RunsOn }}
154+
OS: ${{ matrix.OSName }}
155155
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
156156
Debug: ${{ inputs.Debug }}
157157
Prerelease: ${{ inputs.Prerelease }}

‎.github/workflows/workflow.yml‎

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -80,49 +80,39 @@ jobs:
8080
Version: ${{ inputs.Version }}
8181
WorkingDirectory: ${{ inputs.WorkingDirectory }}
8282

83-
Test-SourceCode:
84-
if: ${{ needs.Get-Settings.outputs.SourceCodeTestSuites != '[]' }}
83+
Build-Module:
84+
if: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Module.Skip != true }}
85+
uses: ./.github/workflows/Build-Module.yml
8586
needs:
8687
- Get-Settings
87-
strategy:
88-
fail-fast: false
89-
matrix:
90-
include: ${{ fromJson(needs.Get-Settings.outputs.SourceCodeTestSuites) }}
91-
uses: ./.github/workflows/Test-SourceCode.yml
9288
with:
93-
RunsOn: ${{ matrix.RunsOn }}
94-
OS: ${{ matrix.OSName }}
9589
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
9690
Debug: ${{ inputs.Debug }}
9791
Prerelease: ${{ inputs.Prerelease }}
9892
Verbose: ${{ inputs.Verbose }}
9993
Version: ${{ inputs.Version }}
10094
WorkingDirectory: ${{ inputs.WorkingDirectory }}
10195

102-
Lint-SourceCode:
103-
if: ${{ needs.Get-Settings.outputs.SourceCodeTestSuites != '[]' }}
96+
Build-Docs:
97+
if: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Docs.Skip != true }}
10498
needs:
10599
- 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
100+
- Build-Module
101+
uses: ./.github/workflows/Build-Docs.yml
111102
with:
112-
RunsOn: ${{ matrix.RunsOn }}
113-
OS: ${{ matrix.OSName }}
114103
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
115104
Debug: ${{ inputs.Debug }}
116105
Prerelease: ${{ inputs.Prerelease }}
117106
Verbose: ${{ inputs.Verbose }}
118107
Version: ${{ inputs.Version }}
119108
WorkingDirectory: ${{ inputs.WorkingDirectory }}
120109

121-
Build-Module:
122-
if: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Module.Skip != true }}
123-
uses: ./.github/workflows/Build-Module.yml
110+
Build-Site:
111+
if: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Site.Skip != true }}
124112
needs:
125113
- Get-Settings
114+
- Build-Docs
115+
uses: ./.github/workflows/Build-Site.yml
126116
with:
127117
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
128118
Debug: ${{ inputs.Debug }}
@@ -131,27 +121,37 @@ jobs:
131121
Version: ${{ inputs.Version }}
132122
WorkingDirectory: ${{ inputs.WorkingDirectory }}
133123

134-
Build-Docs:
135-
if: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Docs.Skip != true }}
124+
Test-SourceCode:
125+
if: ${{ needs.Get-Settings.outputs.SourceCodeTestSuites != '[]' }}
136126
needs:
137127
- Get-Settings
138-
- Build-Module
139-
uses: ./.github/workflows/Build-Docs.yml
128+
strategy:
129+
fail-fast: false
130+
matrix:
131+
include: ${{ fromJson(needs.Get-Settings.outputs.SourceCodeTestSuites) }}
132+
uses: ./.github/workflows/Test-SourceCode.yml
140133
with:
134+
RunsOn: ${{ matrix.RunsOn }}
135+
OS: ${{ matrix.OSName }}
141136
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
142137
Debug: ${{ inputs.Debug }}
143138
Prerelease: ${{ inputs.Prerelease }}
144139
Verbose: ${{ inputs.Verbose }}
145140
Version: ${{ inputs.Version }}
146141
WorkingDirectory: ${{ inputs.WorkingDirectory }}
147142

148-
Build-Site:
149-
if: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Site.Skip != true }}
143+
Lint-SourceCode:
144+
if: ${{ needs.Get-Settings.outputs.SourceCodeTestSuites != '[]' }}
150145
needs:
151146
- Get-Settings
152-
- Build-Docs
153-
uses: ./.github/workflows/Build-Site.yml
147+
strategy:
148+
fail-fast: false
149+
matrix:
150+
include: ${{ fromJson(needs.Get-Settings.outputs.SourceCodeTestSuites) }}
151+
uses: ./.github/workflows/Lint-SourceCode.yml
154152
with:
153+
RunsOn: ${{ matrix.RunsOn }}
154+
OS: ${{ matrix.OSName }}
155155
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
156156
Debug: ${{ inputs.Debug }}
157157
Prerelease: ${{ inputs.Prerelease }}
@@ -238,6 +238,27 @@ jobs:
238238
Verbose: ${{ inputs.Verbose }}
239239
Version: ${{ inputs.Version }}
240240

241+
Publish-Site:
242+
if: ${{ needs.Get-TestResults.result == 'success' && needs.Get-CodeCoverage.result == 'success' && needs.Build-Site.result == 'success' && !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.merged == true }}
243+
needs:
244+
- Get-Settings
245+
- Get-TestResults
246+
- Get-CodeCoverage
247+
- Build-Site
248+
permissions:
249+
pages: write # to deploy to Pages
250+
id-token: write # to verify the deployment originates from an appropriate source
251+
environment:
252+
name: github-pages
253+
url: ${{ steps.deployment.outputs.page_url }}
254+
runs-on: ubuntu-latest
255+
steps:
256+
- uses: actions/configure-pages@v5
257+
258+
- name: Deploy to GitHub Pages
259+
id: deployment
260+
uses: actions/deploy-pages@v4
261+
241262
Publish-Module:
242263
if: ${{ needs.Get-Settings.result == 'success' && needs.Get-TestResults.result == 'success' && needs.Get-CodeCoverage.result == 'success' && needs.Build-Site.result == 'success' && !cancelled() && github.event_name == 'pull_request' }}
243264
needs:
@@ -284,24 +305,3 @@ jobs:
284305
MinorLabels: ${{ fromJson(needs.Get-Settings.outputs.Settings).Publish.Module.MinorLabels }}
285306
PatchLabels: ${{ fromJson(needs.Get-Settings.outputs.Settings).Publish.Module.PatchLabels }}
286307
VersionPrefix: ${{ fromJson(needs.Get-Settings.outputs.Settings).Publish.Module.VersionPrefix }}
287-
288-
Publish-Site:
289-
if: ${{ needs.Get-TestResults.result == 'success' && needs.Get-CodeCoverage.result == 'success' && needs.Build-Site.result == 'success' && !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.merged == true }}
290-
needs:
291-
- Get-Settings
292-
- Get-TestResults
293-
- Get-CodeCoverage
294-
- Build-Site
295-
permissions:
296-
pages: write # to deploy to Pages
297-
id-token: write # to verify the deployment originates from an appropriate source
298-
environment:
299-
name: github-pages
300-
url: ${{ steps.deployment.outputs.page_url }}
301-
runs-on: ubuntu-latest
302-
steps:
303-
- uses: actions/configure-pages@v5
304-
305-
- name: Deploy to GitHub Pages
306-
id: deployment
307-
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)