Skip to content

Commit 6c59cbb

Browse files
Merge pull request #52 from notion-dotnet/ci/51-add-ci-build-step-to-enforce-consistent-coding-style
Add code style validation step in CI build ✅
2 parents 372751b + 9886b40 commit 6c59cbb

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

.github/workflows/ci_build.yml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,41 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
jobs:
1010
build:
11-
1211
runs-on: ubuntu-latest
1312

1413
steps:
15-
- uses: actions/checkout@v2
16-
- name: Setup .NET
17-
uses: actions/setup-dotnet@v1
18-
with:
19-
dotnet-version: 5.0.x
20-
- name: Restore dependencies
21-
run: dotnet restore
22-
- name: Build
23-
run: dotnet build --no-restore
24-
- name: Test
25-
run: dotnet test --no-build --verbosity normal
14+
- uses: actions/checkout@v2
15+
- name: Setup .NET
16+
uses: actions/setup-dotnet@v1
17+
with:
18+
dotnet-version: 5.0.x
19+
20+
- name: Restore dependencies
21+
run: dotnet restore
22+
23+
# Format the output of dotnet format
24+
- name: Add dotnet-format problem matcher
25+
uses: xt0rted/dotnet-format-problem-matcher@v1
26+
27+
# Install dotnet format as a global tool
28+
- name: Install dotnet format
29+
run: dotnet tool update --global dotnet-format
30+
31+
# Run dotnet format --dry-run --check
32+
# By default, the task ensure the exit code is 0
33+
# If a file needs to be edited by dotnet format, the exit code will be a non-zero value
34+
# So the task will fail
35+
- name: Run dotnet format
36+
run: dotnet format --check --verbosity diagnostic
37+
38+
- name: Build
39+
run: dotnet build --no-restore
40+
41+
- name: Test
42+
run: dotnet test --no-build --verbosity normal

Src/Notion.Client/Extensions/EnumExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Linq;
1+
using System.Linq;
22
using System.Runtime.Serialization;
33

44
namespace Notion.Client.Extensions
@@ -19,4 +19,4 @@ public static string GetEnumMemberValue<T>(this T enumValue) where T : System.En
1919
return null;
2020
}
2121
}
22-
}
22+
}

0 commit comments

Comments
 (0)