Skip to content

Commit d66c987

Browse files
authored
Added linter for csharp (#300)
- added linter as part of ci checks.
1 parent 69de0c9 commit d66c987

File tree

2 files changed

+62
-59
lines changed

2 files changed

+62
-59
lines changed

.editorconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,4 +239,5 @@ dotnet_style_prefer_inferred_tuple_names = true:suggestion
239239
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
240240
dotnet_style_prefer_compound_assignment = true:suggestion
241241
dotnet_style_prefer_simplified_interpolation = true:suggestion
242-
dotnet_style_namespace_match_folder = true:suggestion
242+
dotnet_style_namespace_match_folder = true:suggestion
243+

.github/workflows/csharp.yml

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1-
1+
---
22
name: Csharp CI with .NET
33

44
on:
55
push:
6-
branches: [ master ]
6+
branches: [master]
77
pull_request:
8-
branches: [ master ]
8+
branches: [master]
99

1010
jobs:
11-
lint_markdown_files:
11+
lint_code_base:
1212
runs-on: ubuntu-latest
13+
name: Lint Code Base
1314
steps:
14-
- uses: actions/checkout@v3
15-
- name: Set up Ruby
16-
uses: ruby/setup-ruby@v1
17-
with:
18-
ruby-version: '2.6'
19-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
20-
- name: Install gem
21-
run: |
22-
gem install awesome_bot
23-
- name: Run tests
24-
run: find . -type f -name '*.md' -exec awesome_bot {} \;
25-
15+
- name: Checkout Code
16+
uses: actions/checkout@v3
17+
with:
18+
# Full git history is needed to get a proper list of changed files
19+
fetch-depth: 0
20+
- name: Lint Code Base
21+
uses: github/super-linter@v4
22+
env:
23+
VALIDATE_ALL_CODEBASE: false
24+
DEFAULT_BRANCH: master
25+
VALIDATE_CSHARP: true
26+
VALIDATE_MARKDOWN: true
27+
2628
integration_tests:
2729
uses: optimizely/csharp-sdk/.github/workflows/integration_test.yml@master
2830
secrets:
@@ -40,54 +42,54 @@ jobs:
4042
unit_test:
4143
runs-on: ubuntu-latest
4244
steps:
43-
- uses: actions/checkout@v3
44-
- name: Setup .NET
45-
uses: actions/setup-dotnet@v1
46-
with:
47-
dotnet-version: 5.0.x
48-
- name: Restore nuget packages
49-
run: |
50-
nuget restore OptimizelySDK.Travis.sln
51-
nuget install ./OptimizelySDK.Tests/packages.config -OutputDirectory ./packages
52-
nuget install NUnit.Runners -Version 2.6.4 -OutputDirectory ./testrunner
53-
- name: script
54-
run: |
55-
./install_mono.sh
56-
xbuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk /p:Configuration=Release ./OptimizelySDK.Travis.sln
57-
mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe ./OptimizelySDK.Tests/bin/Release/OptimizelySDK.Tests.dll
58-
- name: find and sign dll
59-
run: |
60-
sudo find . -path './OptimizelySDK*bin/Release/OptimizelySDK*.dll' -not -regex '.*Tests.*' -print0 | while IFS= read -r -d '' file; do sn -R $file ./keypair.snk; done
45+
- uses: actions/checkout@v3
46+
- name: Setup .NET
47+
uses: actions/setup-dotnet@v1
48+
with:
49+
dotnet-version: 5.0.x
50+
- name: Restore nuget packages
51+
run: |
52+
nuget restore OptimizelySDK.Travis.sln
53+
nuget install ./OptimizelySDK.Tests/packages.config -OutputDirectory ./packages
54+
nuget install NUnit.Runners -Version 2.6.4 -OutputDirectory ./testrunner
55+
- name: script
56+
run: |
57+
./install_mono.sh
58+
xbuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk /p:Configuration=Release ./OptimizelySDK.Travis.sln
59+
mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe ./OptimizelySDK.Tests/bin/Release/OptimizelySDK.Tests.dll
60+
- name: find and sign dll
61+
run: |
62+
sudo find . -path './OptimizelySDK*bin/Release/OptimizelySDK*.dll' -not -regex '.*Tests.*' -print0 | while IFS= read -r -d '' file; do sn -R $file ./keypair.snk; done
6163
6264
6365
netStandard16:
6466
runs-on: windows-2022
6567
steps:
66-
- uses: actions/checkout@v3
67-
- name: Setup .NET
68-
uses: actions/setup-dotnet@v2
69-
with:
70-
dotnet-version: 3.1.x
71-
- name: Restore dependencies
72-
run: dotnet restore OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj
73-
- name: Build
74-
run: |
75-
# strongname signing is taken care of in build step
76-
dotnet build OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=D:\a\csharp-sdk\csharp-sdk\keypair.snk -c Release
77-
# TODO: no dotnet test yet for NetStandard16
68+
- uses: actions/checkout@v3
69+
- name: Setup .NET
70+
uses: actions/setup-dotnet@v2
71+
with:
72+
dotnet-version: 3.1.x
73+
- name: Restore dependencies
74+
run: dotnet restore OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj
75+
- name: Build
76+
run: |
77+
# strongname signing is taken care of in build step
78+
dotnet build OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=D:\a\csharp-sdk\csharp-sdk\keypair.snk -c Release
79+
# TODO: no dotnet test yet for NetStandard16
7880
7981
netStandard20:
8082
runs-on: windows-2022
8183
steps:
82-
- uses: actions/checkout@v3
83-
- name: Setup .NET
84-
uses: actions/setup-dotnet@v2
85-
with:
86-
dotnet-version: 3.1.x
87-
- name: Restore dependencies
88-
run: dotnet restore OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj
89-
- name: Build
90-
run: |
91-
# strongname signing is taken care of in build step
92-
dotnet build OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=D:\a\csharp-sdk\csharp-sdk\keypair.snk -c Release
93-
# TODO: no dotnet test yet for NetStandard16
84+
- uses: actions/checkout@v3
85+
- name: Setup .NET
86+
uses: actions/setup-dotnet@v2
87+
with:
88+
dotnet-version: 3.1.x
89+
- name: Restore dependencies
90+
run: dotnet restore OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj
91+
- name: Build
92+
run: |
93+
# strongname signing is taken care of in build step
94+
dotnet build OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=D:\a\csharp-sdk\csharp-sdk\keypair.snk -c Release
95+
# TODO: no dotnet test yet for NetStandard16

0 commit comments

Comments
 (0)