@@ -40,12 +40,29 @@ jobs:
4040 with :
4141 dotnet-version : ' 10.0.x'
4242
43+ - name : Cache NuGet packages
44+ uses : actions/cache@v4
45+ with :
46+ path : ~/.nuget/packages
47+ key : ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
48+ restore-keys : |
49+ ${{ runner.os }}-nuget-
50+
4351 - name : Restore dependencies
4452 run : dotnet restore src/FSH.Framework.slnx
4553
4654 - name : Build
4755 run : dotnet build src/FSH.Framework.slnx -c Release --no-restore
4856
57+ - name : Upload build artifacts
58+ uses : actions/upload-artifact@v4
59+ with :
60+ name : build-output
61+ path : |
62+ src/**/bin/Release
63+ src/**/obj/Release
64+ retention-days : 1
65+
4966 test :
5067 name : Test - ${{ matrix.test-project.name }}
5168 runs-on : ubuntu-latest
@@ -75,11 +92,19 @@ jobs:
7592 with :
7693 dotnet-version : ' 10.0.x'
7794
78- - name : Restore dependencies
79- run : dotnet restore src/FSH.Framework.slnx
95+ - name : Cache NuGet packages
96+ uses : actions/cache@v4
97+ with :
98+ path : ~/.nuget/packages
99+ key : ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
100+ restore-keys : |
101+ ${{ runner.os }}-nuget-
80102
81- - name : Build
82- run : dotnet build src/FSH.Framework.slnx -c Release --no-restore
103+ - name : Download build artifacts
104+ uses : actions/download-artifact@v4
105+ with :
106+ name : build-output
107+ path : src
83108
84109 - name : Run ${{ matrix.test-project.name }}
85110 run : dotnet test ${{ matrix.test-project.path }} -c Release --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx"
95120 coverage :
96121 name : Code Coverage
97122 runs-on : ubuntu-latest
98- needs : test
123+ needs : build
99124
100125 steps :
101126 - name : Checkout
@@ -106,11 +131,19 @@ jobs:
106131 with :
107132 dotnet-version : ' 10.0.x'
108133
109- - name : Restore dependencies
110- run : dotnet restore src/FSH.Framework.slnx
134+ - name : Cache NuGet packages
135+ uses : actions/cache@v4
136+ with :
137+ path : ~/.nuget/packages
138+ key : ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
139+ restore-keys : |
140+ ${{ runner.os }}-nuget-
111141
112- - name : Build
113- run : dotnet build src/FSH.Framework.slnx -c Release --no-restore
142+ - name : Download build artifacts
143+ uses : actions/download-artifact@v4
144+ with :
145+ name : build-output
146+ path : src
114147
115148 - name : Run tests with coverage
116149 run : |
@@ -154,6 +187,14 @@ jobs:
154187 with :
155188 dotnet-version : ' 10.0.x'
156189
190+ - name : Cache NuGet packages
191+ uses : actions/cache@v4
192+ with :
193+ path : ~/.nuget/packages
194+ key : ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
195+ restore-keys : |
196+ ${{ runner.os }}-nuget-
197+
157198 - name : Login to GHCR
158199 uses : docker/login-action@v3
159200 with :
@@ -202,6 +243,14 @@ jobs:
202243 with :
203244 dotnet-version : ' 10.0.x'
204245
246+ - name : Cache NuGet packages
247+ uses : actions/cache@v4
248+ with :
249+ path : ~/.nuget/packages
250+ key : ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
251+ restore-keys : |
252+ ${{ runner.os }}-nuget-
253+
205254 - name : Determine version
206255 id : version
207256 run : |
@@ -216,11 +265,10 @@ jobs:
216265 echo "version=$VERSION" >> $GITHUB_OUTPUT
217266 echo "Publishing version: $VERSION"
218267
219- - name : Restore dependencies
220- run : dotnet restore src/FSH.Framework.slnx
221-
222- - name : Build in Release mode
223- run : dotnet build src/FSH.Framework.slnx -c Release --no-restore -p:Version=${{ steps.version.outputs.version }}
268+ - name : Restore and Build with version
269+ run : |
270+ dotnet restore src/FSH.Framework.slnx
271+ dotnet build src/FSH.Framework.slnx -c Release --no-restore -p:Version=${{ steps.version.outputs.version }}
224272
225273 - name : Pack BuildingBlocks
226274 run : |
0 commit comments