@@ -70,18 +70,15 @@ internal class LocalConstants
7070[ PrintCIEnvironment ]
7171[ UploadLogs ]
7272[ TitleEvents ]
73+ [ ContinuousIntegrationConventions ]
7374public partial class Solution
7475{
7576 public static RocketSurgeonGitHubActionsConfiguration CiIgnoreMiddleware (
7677 RocketSurgeonGitHubActionsConfiguration configuration
7778 )
7879 {
79- foreach ( var item in configuration . DetailedTriggers . OfType < RocketSurgeonGitHubActionsVcsTrigger > ( ) )
80- {
81- item . IncludePaths = LocalConstants . PathsIgnore ;
82- }
80+ configuration . IncludeRepositoryConfigurationFiles ( ) ;
8381
84- configuration . Jobs . RemoveAt ( 1 ) ;
8582 ( ( RocketSurgeonsGithubActionsJob ) configuration . Jobs [ 0 ] ) . Steps = new List < GitHubActionsStep >
8683 {
8784 new RunStep ( "N/A" )
@@ -97,104 +94,17 @@ public static RocketSurgeonGitHubActionsConfiguration CiMiddleware(
9794 RocketSurgeonGitHubActionsConfiguration configuration
9895 )
9996 {
100- foreach ( var item in configuration . DetailedTriggers . OfType < RocketSurgeonGitHubActionsVcsTrigger > ( ) )
101- {
102- item . ExcludePaths = LocalConstants . PathsIgnore ;
103- }
104-
105- var buildJob = configuration . Jobs . OfType < RocketSurgeonsGithubActionsJob > ( ) . First ( z => z . Name == "Build" ) ;
106- buildJob . FailFast = false ;
107- var checkoutStep = buildJob . Steps . OfType < CheckoutStep > ( ) . Single ( ) ;
108- // For fetch all
109- checkoutStep . FetchDepth = 0 ;
110- buildJob . Environment [ "NUGET_PACKAGES" ] = "${{ github.workspace }}/.nuget/packages" ;
111- buildJob . Steps . InsertRange (
112- buildJob . Steps . IndexOf ( checkoutStep ) + 1 ,
113- new BaseGitHubActionsStep [ ]
114- {
115- new RunStep ( "Fetch all history for all tags and branches" )
116- {
117- Run = "git fetch --prune"
118- } ,
119- new UsingStep ( "NuGet Cache" )
120- {
121- Uses = "actions/cache@v2" ,
122- With =
123- {
124- [ "path" ] = "${{ github.workspace }}/.nuget/packages" ,
125- // keep in mind using central package versioning here
126- [ "key" ] =
127- "${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}-${{ hashFiles('**/Directory.Packages.support.props') }}" ,
128- [ "restore-keys" ] = @"|
129- ${{ runner.os }}-nuget-"
130- }
131- } ,
132- new SetupDotNetStep ( "Use .NET Core 3.1 SDK" )
133- {
134- DotNetVersion = "3.1.x"
135- } ,
136- new SetupDotNetStep ( "Use .NET Core 7.0 SDK" )
137- {
138- DotNetVersion = "7.0.x"
139- } ,
140- }
141- ) ;
142-
143- buildJob . Steps . Add (
144- new UsingStep ( "Publish Coverage" )
145- {
146- Uses = "codecov/codecov-action@v1" ,
147- With = new Dictionary < string , string >
148- {
149- [ "name" ] = "actions-${{ matrix.os }}" ,
150- }
151- }
152- ) ;
153-
154- buildJob . Steps . Add (
155- new UploadArtifactStep ( "Publish logs" )
156- {
157- Name = "logs" ,
158- Path = "artifacts/logs/" ,
159- If = "always()"
160- }
161- ) ;
162-
163- buildJob . Steps . Add (
164- new UploadArtifactStep ( "Publish coverage data" )
165- {
166- Name = "coverage" ,
167- Path = "coverage/" ,
168- If = "always()"
169- }
170- ) ;
171-
172- buildJob . Steps . Add (
173- new UploadArtifactStep ( "Publish test data" )
174- {
175- Name = "test data" ,
176- Path = "artifacts/test/" ,
177- If = "always()"
178- }
179- ) ;
180-
181- buildJob . Steps . Add (
182- new UploadArtifactStep ( "Publish NuGet Packages" )
183- {
184- Name = "nuget" ,
185- Path = "artifacts/nuget/" ,
186- If = "always()"
187- }
188- ) ;
189-
190- buildJob . Steps . Add (
191- new UploadArtifactStep ( "Publish Docs" )
192- {
193- Name = "docs" ,
194- Path = "artifacts/docs/" ,
195- If = "always()"
196- }
197- ) ;
97+ configuration
98+ . ExcludeRepositoryConfigurationFiles ( )
99+ . AddNugetPublish ( )
100+ . Jobs . OfType < RocketSurgeonsGithubActionsJob > ( )
101+ . First ( z => z . Name . Equals ( "Build" , StringComparison . OrdinalIgnoreCase ) )
102+ . ConfigureStep < CheckoutStep > ( step => step . FetchDepth = 0 )
103+ . UseDotNetSdks ( "3.1" , "7.0" )
104+ . AddNuGetCache ( )
105+ . PublishLogs < Solution > ( )
106+ . PublishArtifacts < Solution > ( )
107+ . FailFast = false ;
198108
199109 return configuration ;
200110 }
0 commit comments