1+ open System.Net .Http
2+
3+
14#r " nuget: Fake.Api.GitHub"
25#r " nuget: Fake.Core.ReleaseNotes"
36#r " nuget: Fake.Core.Target"
@@ -72,7 +75,7 @@ Target.create "Build" <| fun _ ->
7275 Configuration = DotNet.BuildConfiguration.Release
7376 MSBuildParams = { o.MSBuildParams with DisableInternalBinLog = true } })
7477
75- let startGraphQLServer ( project : string ) ( streamRef : DataRef < Stream >) =
78+ let startGraphQLServer ( project : string ) port ( streamRef : DataRef < Stream >) =
7679 DotNet.build
7780 ( fun options ->
7881 { options with
@@ -90,7 +93,7 @@ let startGraphQLServer (project : string) (streamRef : DataRef<Stream>) =
9093 </> DotNetMoniker
9194 </> ( projectName + " .dll" )
9295
93- CreateProcess.fromRawCommandLine " dotnet" $" {serverExe} --urls=http://localhost:8086 /"
96+ CreateProcess.fromRawCommandLine " dotnet" $" {serverExe} --urls=http://localhost:%i {port} /"
9497 |> CreateProcess.withStandardInput ( CreatePipe streamRef)
9598 |> Proc.start
9699 |> ignore
@@ -123,7 +126,7 @@ Target.create "StartStarWarsServer" <| fun _ ->
123126 </> " star-wars-api"
124127 </> " FSharp.Data.GraphQL.Samples.StarWarsApi.fsproj"
125128
126- startGraphQLServer project starWarsServerStream
129+ startGraphQLServer project 8086 starWarsServerStream
127130
128131Target.createFinal " StopStarWarsServer" <| fun _ ->
129132 try
@@ -141,14 +144,23 @@ Target.create "StartIntegrationServer" <| fun _ ->
141144 </> " FSharp.Data.GraphQL.IntegrationTests.Server"
142145 </> " FSharp.Data.GraphQL.IntegrationTests.Server.fsproj"
143146
144- startGraphQLServer project integrationServerStream
147+ startGraphQLServer project 8085 integrationServerStream
145148
146149Target.createFinal " StopIntegrationServer" <| fun _ ->
147150 try
148151 integrationServerStream.Value.Write ([| 0 uy |], 0 , 1 )
149152 with e ->
150153 printfn " %s " e.Message
151154
155+ Target.create " UpdateIntrospectionFile" <| fun _ ->
156+ let client = new HttpClient ()
157+ let result = client.GetAsync( " http://localhost:8086" ) .Result
158+ let file = new FileStream( " tests/FSharp.Data.GraphQL.IntegrationTests/introspection.json" , FileMode.Create, FileAccess.Write, FileShare.None)
159+ result.Content.CopyTo( file, null , System.Threading.CancellationToken.None)
160+ file.Close()
161+ result.Dispose()
162+ client.Dispose()
163+
152164Target.create " RunUnitTests" <| fun _ ->
153165 runTests " tests/FSharp.Data.GraphQL.Tests/FSharp.Data.GraphQL.Tests.fsproj"
154166
@@ -249,6 +261,7 @@ Target.create "PackAll" ignore
249261 ==> " RunUnitTests"
250262 ==> " StartStarWarsServer"
251263 ==> " StartIntegrationServer"
264+ ==> " UpdateIntrospectionFile"
252265 ==> " RunIntegrationTests"
253266 ==> " All"
254267 =?> ( " GenerateDocs" , Environment.environVar " APPVEYOR" = " True" )
0 commit comments