Skip to content

Commit c276f7c

Browse files
committed
inital
1 parent 561fbb1 commit c276f7c

37 files changed

+2166
-1
lines changed

.travis.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
language: csharp
2+
dotnet: 3.1
3+
mono: none
4+
solution: GraphQL.Tool.Embedded.sln
5+
branches:
6+
only:
7+
- main
8+
before_script:
9+
- dotnet restore
10+
script:
11+
- dotnet build
12+
before_deploy:
13+
- git checkout origin/main && git fetch && git remote set-url origin https://${GITHUB_OAUTH_TOKEN}@github.com/ZEXSM/GraphQL.Tool.Embedded.git
14+
- PR_TITLE=$(git log -1 --pretty='%f')
15+
- LAST_TAG=$(echo $(git describe --tags $(git rev-list --tags --max-count=1)) | cut -d'v' -f 2)
16+
- CURRENT_MAJOR=$(echo $LAST_TAG | cut -d. -f 1)
17+
- CURRENT_MINOR=$(echo $LAST_TAG | cut -d. -f 2)
18+
- CURRENT_PATCH=$(echo $(echo $LAST_TAG | cut -d. -f 3) | cut -d- -f 1)
19+
- RC=$(echo $(echo $LAST_TAG | cut -d. -f 3) | cut -d- -f 2)
20+
- MAJOR=$(([ "$RC" == "rc" ] && echo $CURRENT_MAJOR) || ([ "$(echo $PR_TITLE | grep -oP 'release')" == "release" ] && echo $(($CURRENT_MAJOR+1))) || echo $CURRENT_MAJOR)
21+
- MINOR=$(([ "$RC" == "rc" ] && echo $CURRENT_MINOR) || ([ "$(echo $PR_TITLE | grep -oP 'release')" == "release" ] && echo 0) || ([ "$(echo $PR_TITLE | grep -oP 'feature')" == "feature" ] && echo $(($CURRENT_MINOR+1))) || echo $CURRENT_MINOR)
22+
- PATCH=$(([ "$RC" == "rc" ] && echo $CURRENT_PATCH) || ([ "$(echo $PR_TITLE | grep -oP 'release')" == "release" ] && echo 0) || ([ "$(echo $PR_TITLE | grep -oP 'feature')" == "feature" ] && echo 0) || echo $(($CURRENT_PATCH+1)))
23+
- NEW_TAG=$(echo $MAJOR.$MINOR.$PATCH)
24+
- PACKAGE_VERSION=${NEW_TAG:-$DEFAULT_PACKAGE_VERSION}
25+
- git tag v$PACKAGE_VERSION && git push origin v$PACKAGE_VERSION
26+
- dotnet pack -c $CONFIGURATION -p:PackageVersion=$PACKAGE_VERSION
27+
deploy:
28+
provider: releases
29+
name: v$PACKAGE_VERSION
30+
token: $GITHUB_OAUTH_TOKEN
31+
cleanup: true
32+
repo: ZEXSM/GraphQL.Tool.Embedded
33+
on:
34+
branch: main
35+
after_deploy:
36+
- dotnet nuget push ./src/GraphQL.Tool.Embedded/bin/Release/GraphQL.Tool.Embedded.$PACKAGE_VERSION.nupkg -k $NUGET_API_KEY -s $NUGET_SOURCE

GraphQL.Tool.Embedded.sln

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31605.320
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{811390A2-7C82-4B98-8ADF-8D6CC71A664F}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{3E1286D4-8304-4487-8529-93ACE3B8BC01}"
9+
ProjectSection(SolutionItems) = preProject
10+
.gitignore = .gitignore
11+
.travis.yml = .travis.yml
12+
LICENSE = LICENSE
13+
README.md = README.md
14+
EndProjectSection
15+
EndProject
16+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Tool.Embedded", "src\GraphQL.Tool.Embedded\GraphQL.Tool.Embedded.csproj", "{2FD01E5E-EE7A-44EF-BC2D-E159DE0AED2F}"
17+
EndProject
18+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "example", "example", "{ADD06312-F49E-4139-A83C-084E79060BAC}"
19+
EndProject
20+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Server", "example\GraphQL.Server\GraphQL.Server.csproj", "{D4CDF859-E269-4335-A65F-EAD41250B095}"
21+
EndProject
22+
Global
23+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
24+
Debug|Any CPU = Debug|Any CPU
25+
Release|Any CPU = Release|Any CPU
26+
EndGlobalSection
27+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
28+
{2FD01E5E-EE7A-44EF-BC2D-E159DE0AED2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{2FD01E5E-EE7A-44EF-BC2D-E159DE0AED2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{2FD01E5E-EE7A-44EF-BC2D-E159DE0AED2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{2FD01E5E-EE7A-44EF-BC2D-E159DE0AED2F}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{D4CDF859-E269-4335-A65F-EAD41250B095}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{D4CDF859-E269-4335-A65F-EAD41250B095}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{D4CDF859-E269-4335-A65F-EAD41250B095}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{D4CDF859-E269-4335-A65F-EAD41250B095}.Release|Any CPU.Build.0 = Release|Any CPU
36+
EndGlobalSection
37+
GlobalSection(SolutionProperties) = preSolution
38+
HideSolutionNode = FALSE
39+
EndGlobalSection
40+
GlobalSection(NestedProjects) = preSolution
41+
{2FD01E5E-EE7A-44EF-BC2D-E159DE0AED2F} = {811390A2-7C82-4B98-8ADF-8D6CC71A664F}
42+
{D4CDF859-E269-4335-A65F-EAD41250B095} = {ADD06312-F49E-4139-A83C-084E79060BAC}
43+
EndGlobalSection
44+
GlobalSection(ExtensibilityGlobals) = postSolution
45+
SolutionGuid = {CD284B87-34C6-439F-8E23-65A2EB9DE9F2}
46+
EndGlobalSection
47+
EndGlobal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# GraphQL.Playground
1+
# GraphQL.Tool.Embedded

example/GraphQL.Server/Author.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace GraphQL.Server
2+
{
3+
public class Author
4+
{
5+
public string Name { get; set; }
6+
}
7+
}

example/GraphQL.Server/Book.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace GraphQL.Server
2+
{
3+
public class Book
4+
{
5+
public string Title { get; set; }
6+
7+
public Author Author { get; set; }
8+
}
9+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net5.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="HotChocolate.AspNetCore" Version="12.0.0-rc.9" />
9+
</ItemGroup>
10+
11+
<ItemGroup>
12+
<ProjectReference Include="..\..\src\GraphQL.Tool.Embedded\GraphQL.Tool.Embedded.csproj" />
13+
</ItemGroup>
14+
15+
</Project>

example/GraphQL.Server/Program.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using Microsoft.AspNetCore.Hosting;
2+
using Microsoft.Extensions.Configuration;
3+
using Microsoft.Extensions.Hosting;
4+
using Microsoft.Extensions.Logging;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using System.Threading.Tasks;
9+
10+
namespace GraphQL.Server
11+
{
12+
public class Program
13+
{
14+
public static void Main(string[] args)
15+
{
16+
CreateHostBuilder(args).Build().Run();
17+
}
18+
19+
public static IHostBuilder CreateHostBuilder(string[] args) =>
20+
Host.CreateDefaultBuilder(args)
21+
.ConfigureWebHostDefaults(webBuilder =>
22+
{
23+
webBuilder.UseStartup<Startup>();
24+
});
25+
}
26+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "http://json.schemastore.org/launchsettings.json",
3+
"profiles": {
4+
"GraphQL.Server": {
5+
"commandName": "Project",
6+
"dotnetRunMessages": "true",
7+
"launchBrowser": true,
8+
"launchUrl": "graphql/playground",
9+
"applicationUrl": "http://localhost:5000",
10+
"environmentVariables": {
11+
"ASPNETCORE_ENVIRONMENT": "Development"
12+
}
13+
}
14+
}
15+
}

example/GraphQL.Server/Query.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace GraphQL.Server
2+
{
3+
public class Query
4+
{
5+
public Book GetBook() =>
6+
new Book
7+
{
8+
Title = "C# in depth.",
9+
Author = new Author
10+
{
11+
Name = "Jon Skeet"
12+
}
13+
};
14+
}
15+
}

example/GraphQL.Server/Startup.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using Microsoft.AspNetCore.Builder;
2+
using Microsoft.AspNetCore.Hosting;
3+
using Microsoft.Extensions.Configuration;
4+
using Microsoft.Extensions.DependencyInjection;
5+
6+
namespace GraphQL.Server
7+
{
8+
public class Startup
9+
{
10+
public Startup(IConfiguration configuration)
11+
{
12+
Configuration = configuration;
13+
}
14+
15+
public IConfiguration Configuration { get; }
16+
17+
public void ConfigureServices(IServiceCollection services)
18+
{
19+
services
20+
.AddGraphQLServer()
21+
.AddQueryType<Query>();
22+
}
23+
24+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
25+
{
26+
app.UseRouting();
27+
app.UseEndpoints(endpoints =>
28+
{
29+
endpoints.MapGraphQLHttp();
30+
endpoints.MapGraphQLSchema();
31+
32+
endpoints.MapGraphQLPlayground();
33+
endpoints.MapGraphQLVoyager();
34+
});
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)