1
+ open System.Net .Http
2
+
3
+
1
4
#r " nuget: Fake.Api.GitHub"
2
5
#r " nuget: Fake.Core.ReleaseNotes"
3
6
#r " nuget: Fake.Core.Target"
@@ -72,7 +75,7 @@ Target.create "Build" <| fun _ ->
72
75
Configuration = DotNet.BuildConfiguration.Release
73
76
MSBuildParams = { o.MSBuildParams with DisableInternalBinLog = true } })
74
77
75
- let startGraphQLServer ( project : string ) ( streamRef : DataRef < Stream >) =
78
+ let startGraphQLServer ( project : string ) port ( streamRef : DataRef < Stream >) =
76
79
DotNet.build
77
80
( fun options ->
78
81
{ options with
@@ -90,7 +93,7 @@ let startGraphQLServer (project : string) (streamRef : DataRef<Stream>) =
90
93
</> DotNetMoniker
91
94
</> ( projectName + " .dll" )
92
95
93
- CreateProcess.fromRawCommandLine " dotnet" $" {serverExe} --urls=http://localhost:8086 /"
96
+ CreateProcess.fromRawCommandLine " dotnet" $" {serverExe} --urls=http://localhost:%i {port} /"
94
97
|> CreateProcess.withStandardInput ( CreatePipe streamRef)
95
98
|> Proc.start
96
99
|> ignore
@@ -123,7 +126,7 @@ Target.create "StartStarWarsServer" <| fun _ ->
123
126
</> " star-wars-api"
124
127
</> " FSharp.Data.GraphQL.Samples.StarWarsApi.fsproj"
125
128
126
- startGraphQLServer project starWarsServerStream
129
+ startGraphQLServer project 8086 starWarsServerStream
127
130
128
131
Target.createFinal " StopStarWarsServer" <| fun _ ->
129
132
try
@@ -141,14 +144,23 @@ Target.create "StartIntegrationServer" <| fun _ ->
141
144
</> " FSharp.Data.GraphQL.IntegrationTests.Server"
142
145
</> " FSharp.Data.GraphQL.IntegrationTests.Server.fsproj"
143
146
144
- startGraphQLServer project integrationServerStream
147
+ startGraphQLServer project 8085 integrationServerStream
145
148
146
149
Target.createFinal " StopIntegrationServer" <| fun _ ->
147
150
try
148
151
integrationServerStream.Value.Write ([| 0 uy |], 0 , 1 )
149
152
with e ->
150
153
printfn " %s " e.Message
151
154
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
+
152
164
Target.create " RunUnitTests" <| fun _ ->
153
165
runTests " tests/FSharp.Data.GraphQL.Tests/FSharp.Data.GraphQL.Tests.fsproj"
154
166
@@ -249,6 +261,7 @@ Target.create "PackAll" ignore
249
261
==> " RunUnitTests"
250
262
==> " StartStarWarsServer"
251
263
==> " StartIntegrationServer"
264
+ ==> " UpdateIntrospectionFile"
252
265
==> " RunIntegrationTests"
253
266
==> " All"
254
267
=?> ( " GenerateDocs" , Environment.environVar " APPVEYOR" = " True" )
0 commit comments