Skip to content

Commit a84e8ed

Browse files
committed
feat: Update CI configs and project target frameworks
Updated `dependabot.yml` to change directory for `nuget` package ecosystem and added new package ecosystems. Removed ignored dependencies. Updated `codeql-analysis.yml` to change branches and cron schedule, added permissions, and replaced job steps with a centralized workflow reference. Updated `dependabot-reviewer.yml` to replace job steps with a centralized workflow reference and added a secrets section. Updated `docsfx.yml` to add permissions and replace job steps with a centralized workflow reference. Updated project files to change target frameworks from `net6.0` to `net8.0` and added `net9.0` for `SQLHelper.DB.csproj`. Removed `RuntimeIdentifiers` from `SQLHelper.Tests.csproj`.
1 parent 593e1ed commit a84e8ed

File tree

14 files changed

+151
-203
lines changed

14 files changed

+151
-203
lines changed

.editorconfig

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ csharp_style_var_for_built_in_types = true
8181
csharp_style_var_when_type_is_apparent = true
8282

8383
# Expression-bodied members
84-
csharp_style_expression_bodied_accessors = true
85-
csharp_style_expression_bodied_constructors = false
86-
csharp_style_expression_bodied_indexers = true
87-
csharp_style_expression_bodied_lambdas = true
88-
csharp_style_expression_bodied_local_functions = false
89-
csharp_style_expression_bodied_methods = when_on_single_line
90-
csharp_style_expression_bodied_operators = when_on_single_line
91-
csharp_style_expression_bodied_properties = true
84+
csharp_style_expression_bodied_accessors = true:silent
85+
csharp_style_expression_bodied_constructors = false:silent
86+
csharp_style_expression_bodied_indexers = true:silent
87+
csharp_style_expression_bodied_lambdas = true:silent
88+
csharp_style_expression_bodied_local_functions = false:silent
89+
csharp_style_expression_bodied_methods = when_on_single_line:silent
90+
csharp_style_expression_bodied_operators = when_on_single_line:silent
91+
csharp_style_expression_bodied_properties = true:silent
9292

9393
# Pattern matching preferences
9494
csharp_style_pattern_matching_over_as_with_null_check = true
@@ -108,11 +108,11 @@ csharp_style_prefer_readonly_struct = true
108108
csharp_style_prefer_readonly_struct_member = true
109109

110110
# Code-block preferences
111-
csharp_prefer_braces = when_multiline
112-
csharp_prefer_simple_using_statement = true
113-
csharp_style_namespace_declarations = block_scoped
114-
csharp_style_prefer_method_group_conversion = true
115-
csharp_style_prefer_top_level_statements = true
111+
csharp_prefer_braces = when_multiline:silent
112+
csharp_prefer_simple_using_statement = true:suggestion
113+
csharp_style_namespace_declarations = block_scoped:silent
114+
csharp_style_prefer_method_group_conversion = true:silent
115+
csharp_style_prefer_top_level_statements = true:silent
116116

117117
# Expression-level preferences
118118
csharp_prefer_simple_default_expression = true
@@ -130,7 +130,7 @@ csharp_style_unused_value_assignment_preference = discard_variable
130130
csharp_style_unused_value_expression_statement_preference = discard_variable
131131

132132
# 'using' directive preferences
133-
csharp_using_directive_placement = outside_namespace
133+
csharp_using_directive_placement = outside_namespace:silent
134134

135135
# New line preferences
136136
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
@@ -274,3 +274,15 @@ dotnet_naming_style.begins_with_t.required_prefix = T
274274
dotnet_naming_style.begins_with_t.required_suffix =
275275
dotnet_naming_style.begins_with_t.word_separator =
276276
dotnet_naming_style.begins_with_t.capitalization = pascal_case
277+
csharp_style_prefer_primary_constructors = true:suggestion
278+
csharp_prefer_system_threading_lock = true:suggestion
279+
280+
[*.{cs,vb}]
281+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
282+
tab_width = 4
283+
indent_size = 4
284+
end_of_line = crlf
285+
dotnet_style_explicit_tuple_names = true:suggestion
286+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
287+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
288+
dotnet_style_namespace_match_folder = false:suggestion

.github/dependabot.yml

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
version: 2
77
updates:
88
- package-ecosystem: "nuget" # See documentation for possible values
9-
directory: "/" # Location of package manifests
9+
directory: "/src/SQLHelper.DB" # Location of package manifests
1010
schedule:
1111
interval: "daily"
1212
commit-message:
@@ -15,15 +15,6 @@ updates:
1515
dependencies:
1616
patterns:
1717
- "*"
18-
ignore:
19-
- dependency-name: "coverlet.collector"
20-
- dependency-name: "Mecha.xUnit"
21-
- dependency-name: "Microsoft.NET.Test.Sdk"
22-
- dependency-name: "xunit"
23-
- dependency-name: "xunit.runner.visualstudio"
24-
- dependency-name: "Microsoft.CodeAnalysis.NetAnalyzers"
25-
- dependency-name: "husky"
26-
- dependency-name: "BenchmarkDotNet"
2718

2819
- package-ecosystem: "nuget" # See documentation for possible values
2920
directory: "/test/SQLHelper.Tests/" # Location of package manifests
@@ -35,12 +26,39 @@ updates:
3526
dependencies:
3627
patterns:
3728
- "*"
38-
allow:
39-
- dependency-name: "coverlet.collector"
40-
- dependency-name: "Mecha.xUnit"
41-
- dependency-name: "Microsoft.NET.Test.Sdk"
42-
- dependency-name: "xunit"
43-
- dependency-name: "xunit.runner.visualstudio"
29+
30+
- package-ecosystem: "nuget" # See documentation for possible values
31+
directory: "/TestApp/" # Location of package manifests
32+
schedule:
33+
interval: "daily"
34+
commit-message:
35+
prefix: "chore"
36+
groups:
37+
dependencies:
38+
patterns:
39+
- "*"
40+
41+
- package-ecosystem: "nuget" # See documentation for possible values
42+
directory: "/SQLHelper.SpeedTests/" # Location of package manifests
43+
schedule:
44+
interval: "daily"
45+
commit-message:
46+
prefix: "chore"
47+
groups:
48+
dependencies:
49+
patterns:
50+
- "*"
51+
52+
- package-ecosystem: "nuget" # See documentation for possible values
53+
directory: "/SQLHelper.Example/" # Location of package manifests
54+
schedule:
55+
interval: "daily"
56+
commit-message:
57+
prefix: "chore"
58+
groups:
59+
dependencies:
60+
patterns:
61+
- "*"
4462

4563
- package-ecosystem: "github-actions"
4664
directory: "/"

.github/workflows/codeql-analysis.yml

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,58 +13,17 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ master ]
16+
branches: [ "master" ]
1717
pull_request:
18-
# The branches below must be a subset of the branches above
19-
branches: [ master ]
18+
branches: [ "master" ]
2019
schedule:
21-
- cron: '24 6 * * 0'
20+
- cron: '37 18 * * 3'
21+
22+
permissions:
23+
actions: read
24+
contents: read
25+
security-events: write
2226

2327
jobs:
2428
analyze:
25-
name: Analyze
26-
runs-on: ubuntu-latest
27-
permissions:
28-
actions: read
29-
contents: read
30-
security-events: write
31-
32-
strategy:
33-
fail-fast: false
34-
matrix:
35-
language: [ 'csharp' ]
36-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37-
# Learn more about CodeQL language support at https://git.io/codeql-language-support
38-
39-
steps:
40-
- name: Checkout repository
41-
uses: actions/checkout@v4
42-
43-
# Initializes the CodeQL tools for scanning.
44-
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v3
46-
with:
47-
languages: ${{ matrix.language }}
48-
# If you wish to specify custom queries, you can do so here or in a config file.
49-
# By default, queries listed here will override any specified in a config file.
50-
# Prefix the list here with "+" to use these queries and those in the config file.
51-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
52-
53-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54-
# If this step fails, then you should remove it and run the build manually (see below)
55-
- name: Autobuild
56-
uses: github/codeql-action/autobuild@v3
57-
58-
# ℹ️ Command-line programs to run using the OS shell.
59-
# 📚 https://git.io/JvXDl
60-
61-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62-
# and modify them (or add more) to build your code if your project
63-
# uses a compiled language
64-
65-
#- run: |
66-
# make bootstrap
67-
# make release
68-
69-
- name: Perform CodeQL Analysis
70-
uses: github/codeql-action/analyze@v3
29+
uses: JaCraig/Centralized-Workflows/.github/workflows/codeql.yml@main

.github/workflows/dependabot-reviewer.yml

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,7 @@ permissions:
88

99
jobs:
1010
review-dependabot-pr:
11-
runs-on: ubuntu-latest
1211
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
13-
steps:
14-
- name: Dependabot metadata
15-
id: dependabot-metadata
16-
uses: dependabot/fetch-metadata@v2.2.0
17-
- name: Approve patch and minor updates
18-
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor'}}
19-
run: gh pr review $PR_URL --approve -b "**Approving** this pull request because **it includes a patch or minor update**"
20-
env:
21-
PR_URL: ${{github.event.pull_request.html_url}}
22-
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
23-
- name: Approve major updates of development dependencies
24-
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:development'}}
25-
run: gh pr review $PR_URL --approve -b "**Approving** this pull request because **it includes a major update of a dependency used only in development**"
26-
env:
27-
PR_URL: ${{github.event.pull_request.html_url}}
28-
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
29-
- name: Comment on major updates of non-development dependencies
30-
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:production'}}
31-
run: |
32-
gh pr comment $PR_URL --body "**Not approving** this PR because **it includes a major update of a dependency used in production**"
33-
gh pr edit $PR_URL --add-label "requires-manual-qa"
34-
env:
35-
PR_URL: ${{github.event.pull_request.html_url}}
36-
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
37-
- name: Enable auto-merge for Dependabot PRs
38-
run: gh pr merge --auto --merge "$PR_URL"
39-
env:
40-
PR_URL: ${{github.event.pull_request.html_url}}
41-
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
12+
uses: JaCraig/Centralized-Workflows/.github/workflows/dependabot-reviewer.yml@main
13+
secrets:
14+
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

.github/workflows/docsfx.yml

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,9 @@ on:
44
push:
55
branches: [ "master" ]
66

7+
permissions:
8+
contents: write
9+
710
jobs:
811
publish-docs:
9-
env:
10-
BUILD_CONFIG: 'Release'
11-
SOLUTION: 'SQLHelper.sln'
12-
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
dotnet-version: [ '6.0.x' ]
16-
17-
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v4
20-
21-
- name: Setup .NET SDK ${{ matrix.dotnet-version }}
22-
uses: actions/setup-dotnet@v4.1.0
23-
with:
24-
dotnet-version: ${{ matrix.dotnet-version }}
25-
26-
- name: Restore dependencies
27-
run: dotnet restore
28-
29-
- run: dotnet tool update -g docfx
30-
- run: docfx docfx_project/docfx.json
31-
32-
- name: Deploy
33-
uses: peaceiris/actions-gh-pages@v4
34-
with:
35-
github_token: ${{ secrets.GITHUB_TOKEN }}
36-
publish_dir: docfx_project/_site
12+
uses: JaCraig/Centralized-Workflows/.github/workflows/docsfx.yml@main

SQLHelper.Example/SQLHelper.Example.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>

SQLHelper.SpeedTests/SQLHelper.SpeedTests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net6.0</TargetFrameworks>
5+
<TargetFrameworks>net8.0</TargetFrameworks>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
11-
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="8.0.10" />
10+
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
11+
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="9.0.0" />
1212
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
1313
<PackageReference Include="ZString" Version="2.6.0" />
1414
</ItemGroup>

SQLHelper.SpeedTests/Tests/AddQuery.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace SQLHelperDB.SpeedTests.Tests
1010
[MemoryDiagnoser]
1111
public class AddQuery
1212
{
13-
private SQLHelper Helper { get; set; }
13+
private SQLHelper? Helper { get; set; }
1414

1515
private string QueryText { get; } = "IF NOT EXISTS (SELECT TOP 1 ID_ FROM [dbo].[AllReferencesAndID_ManyToManyPropertiesWithCascade] WHERE [dbo].[AllReferencesAndID_ManyToManyPropertiesWithCascade].[AllReferencesAndID_ID_] = 6701 AND [dbo].[AllReferencesAndID_ManyToManyPropertiesWithCascade].[ManyToManyPropertiesWithCascade_ID_] = 1341) BEGIN INSERT INTO [dbo].[AllReferencesAndID_ManyToManyPropertiesWithCascade]([dbo].[AllReferencesAndID_ManyToManyPropertiesWithCascade].[AllReferencesAndID_ID_],[dbo].[AllReferencesAndID_ManyToManyPropertiesWithCascade].[ManyToManyPropertiesWithCascade_ID_]) VALUES (6701,1341) END;";
1616

@@ -20,7 +20,7 @@ public class AddQuery
2020
[GlobalSetup]
2121
public void Setup()
2222
{
23-
var Services = new ServiceCollection().AddCanisterModules(x => x.AddAssembly(typeof(Program).Assembly)
23+
ServiceProvider Services = new ServiceCollection().AddCanisterModules(x => x.AddAssembly(typeof(Program).Assembly)
2424
.RegisterSQLHelper()).BuildServiceProvider();
2525
Helper = new SQLHelper(Services.GetService<ObjectPool<StringBuilder>>(), Services.GetService<IConfiguration>(), null);
2626
}

0 commit comments

Comments
 (0)