Skip to content

Commit 263a326

Browse files
authored
ci: Optimize GitHub Actions workflow performance (#3477)
1 parent 1799395 commit 263a326

13 files changed

Lines changed: 73 additions & 32 deletions

.github/workflows/all_solutions.yml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ jobs:
5757

5858
- name: Checkout
5959
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
60-
with:
61-
fetch-depth: 0
6260
- name: Run Shellcheck
6361
run: |
6462
find ${{ github.workspace }} -name "*.sh" -exec shellcheck --severity=error {} +
@@ -86,13 +84,21 @@ jobs:
8684
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
8785
with:
8886
fetch-depth: 0
87+
filter: blob:none
88+
89+
- name: Cache NuGet packages
90+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
91+
with:
92+
path: ~/.nuget/packages
93+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
94+
restore-keys: ${{ runner.os }}-nuget-
8995

9096
- name: Install latest .NET 10 SDK
9197
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
9298
with:
9399
dotnet-version: '10.0.x'
94100
dotnet-quality: 'ga'
95-
101+
96102
- name: Build FullAgent.sln
97103
run: |
98104
Write-Host "dotnet build --force --configuration Release -p:AllowUnsafeBlocks=true ${{ env.fullagent_solution_path }}"
@@ -182,13 +188,21 @@ jobs:
182188
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
183189
with:
184190
fetch-depth: 0
191+
filter: blob:none
192+
193+
- name: Cache NuGet packages
194+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
195+
with:
196+
path: ~/.nuget/packages
197+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
198+
restore-keys: ${{ runner.os }}-nuget-
185199

186200
- name: Install latest .NET 10 SDK
187201
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
188202
with:
189203
dotnet-version: '10.0.x'
190204
dotnet-quality: 'ga'
191-
205+
192206
- name: Add msbuild to PATH
193207
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
194208
# if needed for future .NET preview builds:
@@ -231,6 +245,14 @@ jobs:
231245
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
232246
with:
233247
fetch-depth: 0
248+
filter: blob:none
249+
250+
- name: Cache NuGet packages
251+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
252+
with:
253+
path: ~/.nuget/packages
254+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
255+
restore-keys: ${{ runner.os }}-nuget-
234256

235257
- name: Install latest .NET 10 SDK
236258
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
@@ -346,8 +368,6 @@ jobs:
346368
steps:
347369
- name: Checkout
348370
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
349-
with:
350-
fetch-depth: 0
351371

352372
- name: Disable TLS 1.3
353373
run: |
@@ -550,8 +570,6 @@ jobs:
550570
steps:
551571
- name: Checkout
552572
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
553-
with:
554-
fetch-depth: 0
555573

556574
- name: Download Agent Home Folders
557575
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
@@ -722,8 +740,6 @@ jobs:
722740

723741
- name: Checkout
724742
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
725-
with:
726-
fetch-depth: 0
727743

728744
- name: Download msi _build Artifacts
729745
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
@@ -789,8 +805,6 @@ jobs:
789805

790806
- name: Checkout
791807
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
792-
with:
793-
fetch-depth: 0
794808

795809
- name: Download Agent Home Folders
796810
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
@@ -844,6 +858,7 @@ jobs:
844858
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
845859
with:
846860
fetch-depth: 0
861+
filter: blob:none
847862

848863
- name: Download Agent Home Folders
849864
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0

.github/workflows/build_profiler.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ jobs:
5959
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6060
with:
6161
fetch-depth: 0
62+
filter: blob:none
63+
64+
- name: Cache NuGet packages
65+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
66+
with:
67+
path: ~/.nuget/packages
68+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
69+
restore-keys: ${{ runner.os }}-nuget-
6270

6371
- name: Add msbuild to PATH
6472
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
@@ -149,8 +157,6 @@ jobs:
149157

150158
- name: Checkout
151159
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
152-
with:
153-
fetch-depth: 0
154160

155161
- name: Clean out _profilerBuild directory
156162
run: |
@@ -202,8 +208,6 @@ jobs:
202208

203209
- name: Checkout
204210
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
205-
with:
206-
fetch-depth: 0
207211

208212
- name: Clean out _profilerBuild directory
209213
run: |
@@ -278,6 +282,7 @@ jobs:
278282
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
279283
with:
280284
fetch-depth: 0
285+
filter: blob:none
281286

282287
- name: Download Windows Profiler Artifacts to working Directory
283288
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
@@ -359,8 +364,6 @@ jobs:
359364
360365
- name: Checkout
361366
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
362-
with:
363-
fetch-depth: 0
364367

365368
- name: Update Profiler Package Reference to Latest Version
366369
run: |

.github/workflows/check_modified_files.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3131
with:
3232
fetch-depth: 0
33+
filter: blob:none
3334
- name: Verify which files were modified
3435
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
3536
id: filter

.github/workflows/codeql.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ jobs:
4747
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4848
with:
4949
fetch-depth: 0
50+
filter: blob:none
51+
52+
- name: Cache NuGet packages
53+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
54+
with:
55+
path: ~/.nuget/packages
56+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
57+
restore-keys: ${{ runner.os }}-nuget-
5058

5159
- name: Install latest .NET 10 SDK
5260
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
@@ -89,6 +97,7 @@ jobs:
8997
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
9098
with:
9199
fetch-depth: 0
100+
filter: blob:none
92101

93102
- name: Initialize CodeQL
94103
uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4

.github/workflows/deploy_agent.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ jobs:
7272
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7373
with:
7474
fetch-depth: 0
75+
filter: blob:none
7576

7677
- name: Get Release Version and Run ID
7778
if: ${{ inputs.get-version-automatically }}
@@ -367,8 +368,6 @@ jobs:
367368

368369
- name: Checkout
369370
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
370-
with:
371-
fetch-depth: 0
372371

373372
- name: Download Deploy Artifacts
374373
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0

.github/workflows/deploy_siteextension.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
github-token: ${{ secrets.GITHUB_TOKEN }}
3737
run-id: ${{ inputs.run_id }}
3838
name: deploy-artifacts
39-
path: ${{ github.workspace }}
39+
path: ${{ github.workspace }}\build\BuildArtifacts\AzureSiteExtension
4040
repository: ${{ github.repository }}
4141

4242
# Get a short-lived NuGet API key

.github/workflows/dotty.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5050
with:
5151
fetch-depth: 0
52+
filter: blob:none
5253

5354
- name: Add agent via nuget and then build Dotty
5455
run: |

.github/workflows/linux_container_tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ jobs:
9595

9696
- name: Checkout
9797
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
98-
with:
99-
fetch-depth: 0
10098

10199
- name: Download Agent Home Folders (Call)
102100
if: ${{ inputs.external_call }}

.github/workflows/post_deploy_agent.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jobs:
120120
- name: Checkout
121121
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
122122
with:
123-
fetch-depth: 0
123+
sparse-checkout: deploy/validation/validate-yum
124124

125125
- name: Wait for YUM to update
126126
if: ${{ inputs.wait_for_apt_and_yum }} # only wait if requested
@@ -161,7 +161,7 @@ jobs:
161161
- name: Checkout
162162
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
163163
with:
164-
fetch-depth: 0
164+
sparse-checkout: deploy/validation/validate-debian-latest
165165

166166
- name: Wait for APT to update
167167
if: ${{ inputs.wait_for_apt_and_yum }} # only wait if requested
@@ -202,7 +202,7 @@ jobs:
202202
- name: Checkout
203203
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
204204
with:
205-
fetch-depth: 0
205+
sparse-checkout: deploy/validation/validate-debian-oldest
206206

207207
- name: Wait for APT to update
208208
if: ${{ inputs.wait_for_apt_and_yum }} # only wait if requested
@@ -249,7 +249,7 @@ jobs:
249249
- name: Checkout
250250
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
251251
with:
252-
fetch-depth: 0
252+
sparse-checkout: build/S3Validator
253253

254254
- name: Build and Run S3Validator
255255
run: |
@@ -279,7 +279,7 @@ jobs:
279279
- name: Checkout
280280
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
281281
with:
282-
fetch-depth: 0
282+
sparse-checkout: build/NugetValidator
283283

284284
- name: Build and Run NugetValidator
285285
run: |
@@ -313,7 +313,7 @@ jobs:
313313
- name: Checkout
314314
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
315315
with:
316-
fetch-depth: 0
316+
sparse-checkout: build/NugetVersionDeprecator
317317

318318
- name: Build and Run NugetDeprecator
319319
run: |

.github/workflows/pr_title_checker.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ jobs:
2626
egress-policy: audit
2727
- name: Checkout
2828
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
29-
with:
30-
fetch-depth: 0
3129
- name: Check PR title
3230
uses: thehanimo/pr-title-checker@7fbfe05602bdd86f926d3fb3bccb6f3aed43bc70 # v1.4.3
3331
with:

0 commit comments

Comments
 (0)