diff --git a/FSharp.Data.GraphQL.Integration.sln b/FSharp.Data.GraphQL.Integration.sln index 91f7990dd..4f4517c8d 100644 --- a/FSharp.Data.GraphQL.Integration.sln +++ b/FSharp.Data.GraphQL.Integration.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33312.197 MinimumVisualStudioVersion = 15.0.26124.0 Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.GraphQL.IntegrationTests", "tests\FSharp.Data.GraphQL.IntegrationTests\FSharp.Data.GraphQL.IntegrationTests.fsproj", "{09D910E6-94EF-46AF-94DF-10A9FEC837C0}" EndProject @@ -14,6 +14,9 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{BDE03396-2ED6-4153-B94C-351BAB3F67BD}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{BA7F22E2-D411-4229-826B-F55FF171D12A}" + ProjectSection(SolutionItems) = preProject + build.fsx = build.fsx + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/FSharp.Data.GraphQL.sln b/FSharp.Data.GraphQL.sln index b2907ee78..e7fda4139 100644 --- a/FSharp.Data.GraphQL.sln +++ b/FSharp.Data.GraphQL.sln @@ -141,6 +141,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution global.json = global.json LICENSE.txt = LICENSE.txt Packages.props = Packages.props + Prepare template project for packing.ps1 = Prepare template project for packing.ps1 README.md = README.md RELEASE_NOTES.md = RELEASE_NOTES.md EndProjectSection diff --git a/build.fsx b/build.fsx index 62f4b670c..633dc6134 100644 --- a/build.fsx +++ b/build.fsx @@ -1,3 +1,6 @@ +open System.Net.Http + + #r "nuget: Fake.Api.GitHub" #r "nuget: Fake.Core.ReleaseNotes" #r "nuget: Fake.Core.Target" @@ -72,7 +75,7 @@ Target.create "Build" <| fun _ -> Configuration = DotNet.BuildConfiguration.Release MSBuildParams = { o.MSBuildParams with DisableInternalBinLog = true } }) -let startGraphQLServer (project : string) (streamRef : DataRef) = +let startGraphQLServer (project : string) port (streamRef : DataRef) = DotNet.build (fun options -> { options with @@ -90,7 +93,7 @@ let startGraphQLServer (project : string) (streamRef : DataRef) = DotNetMoniker (projectName + ".dll") - CreateProcess.fromRawCommandLine "dotnet" $"{serverExe} --urls=http://localhost:8086/" + CreateProcess.fromRawCommandLine "dotnet" $"{serverExe} --urls=http://localhost:%i{port}/" |> CreateProcess.withStandardInput (CreatePipe streamRef) |> Proc.start |> ignore @@ -123,7 +126,7 @@ Target.create "StartStarWarsServer" <| fun _ -> "star-wars-api" "FSharp.Data.GraphQL.Samples.StarWarsApi.fsproj" - startGraphQLServer project starWarsServerStream + startGraphQLServer project 8086 starWarsServerStream Target.createFinal "StopStarWarsServer" <| fun _ -> try @@ -141,7 +144,7 @@ Target.create "StartIntegrationServer" <| fun _ -> "FSharp.Data.GraphQL.IntegrationTests.Server" "FSharp.Data.GraphQL.IntegrationTests.Server.fsproj" - startGraphQLServer project integrationServerStream + startGraphQLServer project 8085 integrationServerStream Target.createFinal "StopIntegrationServer" <| fun _ -> try @@ -149,6 +152,15 @@ Target.createFinal "StopIntegrationServer" <| fun _ -> with e -> printfn "%s" e.Message +Target.create "UpdateIntrospectionFile" <| fun _ -> + let client = new HttpClient () + let result = client.GetAsync("http://localhost:8086").Result + let file = new FileStream("tests/FSharp.Data.GraphQL.IntegrationTests/introspection.json", FileMode.Create, FileAccess.Write, FileShare.None) + result.Content.CopyTo(file, null, System.Threading.CancellationToken.None) + file.Close() + result.Dispose() + client.Dispose() + Target.create "RunUnitTests" <| fun _ -> runTests "tests/FSharp.Data.GraphQL.Tests/FSharp.Data.GraphQL.Tests.fsproj" @@ -249,6 +261,7 @@ Target.create "PackAll" ignore ==> "RunUnitTests" ==> "StartStarWarsServer" ==> "StartIntegrationServer" + ==> "UpdateIntrospectionFile" ==> "RunIntegrationTests" ==> "All" =?> ("GenerateDocs", Environment.environVar "APPVEYOR" = "True") diff --git a/tests/FSharp.Data.GraphQL.IntegrationTests.Server/Program.fs b/tests/FSharp.Data.GraphQL.IntegrationTests.Server/Program.fs index 979d32584..857bbf959 100644 --- a/tests/FSharp.Data.GraphQL.IntegrationTests.Server/Program.fs +++ b/tests/FSharp.Data.GraphQL.IntegrationTests.Server/Program.fs @@ -1,4 +1,4 @@ -namespace FSharp.Data.GraphQL.IntegrationTests.Server +namespace FSharp.Data.GraphQL.IntegrationTests.Server open Microsoft.AspNetCore open Microsoft.AspNetCore.Hosting @@ -6,13 +6,10 @@ open Microsoft.AspNetCore.Hosting module Program = let exitCode = 0 - let [] BaseAddress = "localhost:8085" - let buildWebHost args = WebHost .CreateDefaultBuilder(args) .UseStartup() - .UseUrls(sprintf "http://%s" BaseAddress) [] let main args =