Skip to content

Commit 2ea3866

Browse files
samgibsonmojryankearsley-moj
authored andcommitted
Improve run-tests.yml performance: only restore/build required projects (#33)
1 parent 658320a commit 2ea3866

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

.github/workflows/run-tests.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,22 @@ jobs:
1515
- uses: actions/checkout@v5
1616

1717
- name: Restore Dependencies (ubuntu)
18-
run: dotnet restore
18+
run: |
19+
for project in tests/**/*.csproj; do
20+
dotnet restore "$project"
21+
done
1922
2023
- name: Build (ubuntu)
21-
run: dotnet build --configuration Release --no-restore
24+
run: |
25+
for project in tests/**/*.csproj; do
26+
dotnet build "$project" --configuration Release --no-restore
27+
done
2228
2329
- name: Test (ubuntu)
24-
run: dotnet test --configuration Release --no-build
30+
run: |
31+
for project in tests/**/*.csproj; do
32+
dotnet test "$project" --configuration Release --no-build
33+
done
2534
2635
test-windows:
2736
runs-on: windows-2022
@@ -34,10 +43,19 @@ jobs:
3443
dotnet-version: 10.0.x
3544

3645
- name: Restore Dependencies (windows)
37-
run: dotnet restore
46+
run: |
47+
Get-ChildItem -Path tests -Filter *.csproj -Recurse | ForEach-Object {
48+
dotnet restore $_.FullName
49+
}
3850
3951
- name: Build (windows)
40-
run: dotnet build --configuration Release --no-restore
52+
run: |
53+
Get-ChildItem -Path tests -Filter *.csproj -Recurse | ForEach-Object {
54+
dotnet build $_.FullName --configuration Release --no-restore
55+
}
4156
4257
- name: Test (windows)
43-
run: dotnet test --configuration Release --no-build
58+
run: |
59+
Get-ChildItem -Path tests -Filter *.csproj -Recurse | ForEach-Object {
60+
dotnet test $_.FullName --configuration Release --no-build
61+
}

0 commit comments

Comments
 (0)