Skip to content

Commit 2ee759f

Browse files
Migrate workflows (#59)
* Migrate workflows * Bump version * Migrate to .net6.0, bump hotchocolate
1 parent ccc7bd1 commit 2ee759f

11 files changed

Lines changed: 45 additions & 84 deletions

File tree

.github/workflows/analysis.yaml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/package.yaml

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ on:
55
types: [created]
66

77
env:
8-
DOTNET_VERSION: 5.0.x
9-
NUGET_KEY: ${{ secrets.NUGET_API_KEY }}
10-
TAG_FORMAT: '*'
8+
DOTNET_VERSION: 6.0.100-preview.2.21155.3
119

1210
jobs:
1311
package:
@@ -16,24 +14,23 @@ jobs:
1614
timeout-minutes: 5
1715

1816
steps:
19-
- name: Package | Checkout
20-
uses: actions/checkout@v2.3.4
21-
22-
- name: Package | Release
23-
id: release
24-
uses: tenhaus/get-release-or-tag@v2
25-
26-
- name: Package | Setup
27-
uses: actions/setup-dotnet@v1.7.2
28-
with:
29-
dotnet-version: ${{ env.DOTNET_VERSION }}
30-
31-
- name: Package | Publish
32-
uses: brandedoutcast/publish-nuget@v2.5.5
33-
with:
34-
NUGET_KEY: ${{ env.NUGET_KEY }}
35-
PROJECT_FILE_PATH: src/AppAny.HotChocolate.FluentValidation.csproj
36-
VERSION_STATIC: ${{ steps.release.outputs.tag }}
37-
TAG_FORMAT: ${{ env.TAG_FORMAT }}
38-
INCLUDE_SYMBOLS: true
39-
17+
- name: Package | Checkout
18+
uses: actions/checkout@v2
19+
20+
- name: Package | Release
21+
id: release
22+
uses: tenhaus/get-release-or-tag@v2
23+
24+
- name: Package | Setup
25+
uses: actions/setup-dotnet@v1
26+
with:
27+
dotnet-version: ${{ env.DOTNET_VERSION }}
28+
29+
- name: Package | Publish
30+
uses: brandedoutcast/publish-nuget@v2
31+
with:
32+
NUGET_KEY: ${{ secrets.NUGET_API_KEY }}
33+
PROJECT_FILE_PATH: src/AppAny.HotChocolate.FluentValidation.csproj
34+
VERSION_STATIC: ${{ steps.release.outputs.tag }}
35+
TAG_FORMAT: '*'
36+
INCLUDE_SYMBOLS: true

.github/workflows/release.yaml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ on:
88
required: true
99
default: patch
1010

11-
env:
12-
RELEASE_TYPE: ${{ github.event.inputs.release }}
13-
UPDATE_WORKFLOWS_TOKEN: ${{ secrets.UPDATE_WORKFLOWS_TOKEN }}
14-
1511
jobs:
1612
release:
1713
name: Release
@@ -20,24 +16,19 @@ jobs:
2016

2117
steps:
2218
- name: Release | Checkout
23-
uses: actions/checkout@v2.3.4
24-
25-
- name: Release | Previous | Cancel
26-
uses: styfle/cancel-workflow-action@0.8.0
27-
with:
28-
access_token: ${{ env.UPDATE_WORKFLOWS_TOKEN }}
19+
uses: actions/checkout@v2
2920

3021
- name: Release | Tag
3122
id: tag
3223
uses: zwaldowski/semver-release-action@v2
3324
with:
34-
bump: ${{ env.RELEASE_TYPE }}
35-
github_token: ${{ env.UPDATE_WORKFLOWS_TOKEN }}
25+
bump: ${{ github.event.inputs.release }}
26+
github_token: ${{ secrets.GITHUB_TOKEN }}
3627
env:
3728
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
3829

3930
- name: Release
40-
uses: ncipollo/release-action@v1.8.0
31+
uses: ncipollo/release-action@v1
4132
with:
4233
tag: ${{ steps.tag.outputs.version }}
43-
token: ${{ env.UPDATE_WORKFLOWS_TOKEN }}
34+
token: ${{ secrets.CREATE_RELEASE_TOKEN }}

.github/workflows/tests.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ on:
55
branches: [ main ]
66
pull_request:
77
branches: [ main ]
8+
workflow_dispatch:
89

910
env:
10-
DOTNET_VERSION: 5.0.x
11+
DOTNET_VERSION: 6.0.100-preview.2.21155.3
12+
1113
COVERAGE_REPORT: coverage.info
1214

1315
jobs:
@@ -18,18 +20,20 @@ jobs:
1820

1921
steps:
2022
- name: Tests | Checkout
21-
uses: actions/checkout@v2.3.4
23+
uses: actions/checkout@v2
2224

2325
- name: Tests | Setup
24-
uses: actions/setup-dotnet@v1.7.2
26+
uses: actions/setup-dotnet@v1
2527
with:
2628
dotnet-version: ${{ env.DOTNET_VERSION }}
29+
env:
30+
NUGET_AUTH_TOKEN: ${{ secrets.READ_REGISTRY_TOKEN }}
2731

2832
- name: Tests
2933
run: dotnet test /p:CollectCoverage=true /p:CoverletOutput=../../ /p:CoverletOutputFormat=lcov
3034

3135
- name: Tests | Coverage
32-
uses: codecov/codecov-action@v1.2.1
36+
uses: codecov/codecov-action@v1
3337
with:
34-
flags: unittests
3538
files: ${{ env.COVERAGE_REPORT }}
39+
token: ${{ secrets.CODECOV_TOKEN }}

src/AppAny.HotChocolate.FluentValidation.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<Nullable>enable</Nullable>
6-
<Version>0.2.2</Version>
6+
<Version>0.2.3</Version>
77
<LangVersion>9</LangVersion>
88
<EmbedUntrackedSources>true</EmbedUntrackedSources>
99
<IncludeSymbols>true</IncludeSymbols>
@@ -25,7 +25,7 @@
2525

2626
<ItemGroup Label="Packages">
2727
<PackageReference Include="FluentValidation" Version="10.0.0-preview4" />
28-
<PackageReference Include="HotChocolate.Execution" Version="11.1.0-rc.4" />
28+
<PackageReference Include="HotChocolate.Execution" Version="11.1.0-rc.6" />
2929
</ItemGroup>
3030

3131
<ItemGroup Label="Assets">

src/Extensions/RequestExecutorBuilderExtensions.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using HotChocolate.Configuration;
32
using HotChocolate.Execution.Configuration;
43
using Microsoft.Extensions.DependencyInjection;
54

@@ -22,9 +21,7 @@ public static IRequestExecutorBuilder AddFluentValidation(
2221

2322
builder.OnBeforeCompleteType(ValidationDefaults.Interceptors.OnBeforeCompleteType);
2423

25-
builder.TryAddSchemaInterceptor(
26-
new DelegateSchemaInterceptor(
27-
onAfterCreate: ValidationDefaults.Interceptors.OnAfterCreate));
24+
builder.OnAfterSchemaCreate(ValidationDefaults.Interceptors.OnAfterSchemaCreate);
2825

2926
return builder;
3027
}

src/ValidationDefaults.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Threading.Tasks;
32
using System.Runtime.CompilerServices;
43
using HotChocolate;
@@ -7,7 +6,6 @@
76
using FluentValidation.Internal;
87
using HotChocolate.Configuration;
98
using HotChocolate.Resolvers;
10-
using HotChocolate.Types.Descriptors;
119
using Microsoft.Extensions.DependencyInjection;
1210

1311
namespace AppAny.HotChocolate.FluentValidation
@@ -32,15 +30,15 @@ public static class ValidationDefaults
3230
/// <summary>
3331
/// Default validation field middleware
3432
/// </summary>
35-
public static FieldMiddleware Middleware { get; } = ValidationFieldMiddleware.Use;
33+
public static FieldMiddleware Middleware { get; } = ValidationMiddlewares.Field;
3634

3735
/// <summary>
3836
/// Default HotChocolate interceptors
3937
/// </summary>
4038
public static class Interceptors
4139
{
4240
public static OnCompleteType OnBeforeCompleteType { get; } = ValidationInterceptors.OnBeforeCompleteType;
43-
public static Action<IDescriptorContext, ISchema> OnAfterCreate { get; } = ValidationInterceptors.OnAfterCreate;
41+
public static OnAfterSchemaCreate OnAfterSchemaCreate { get; } = ValidationInterceptors.OnAfterSchemaCreate;
4442
}
4543

4644
/// <summary>

src/ValidationInterceptors.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static void OnBeforeCompleteType(
4242
}
4343
}
4444

45-
public static void OnAfterCreate(IDescriptorContext context, ISchema schema)
45+
public static void OnAfterSchemaCreate(IDescriptorContext context, ISchema schema)
4646
{
4747
foreach (var objectField in schema.Types.OfType<IObjectType>().SelectMany(type => type.Fields))
4848
{
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
namespace AppAny.HotChocolate.FluentValidation
55
{
6-
internal static class ValidationFieldMiddleware
6+
internal static class ValidationMiddlewares
77
{
8-
public static FieldDelegate Use(FieldDelegate next)
8+
public static FieldDelegate Field(FieldDelegate next)
99
{
1010
return async middlewareContext =>
1111
{

tests/AppAny.HotChocolate.FluentValidation.Benchmarks/AppAny.HotChocolate.FluentValidation.Benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<DebugType>pdbonly</DebugType>
66
<DebugSymbols>true</DebugSymbols>
77
<OutputType>Exe</OutputType>

0 commit comments

Comments
 (0)