Skip to content

Commit 323418e

Browse files
committed
feat: Update configs, workflows, and target frameworks
.editorconfig: Added new style preferences, modified existing ones. dependabot.yml: Updated directories, removed ignore list, added new ecosystem. codeql-analysis.yml: Updated branches, cron schedule, permissions, and job steps. dependabot-reviewer.yml: Centralized workflow, added secret. docsfx.yml: Added permissions, centralized workflow. dotnet-publish.yml: Centralized workflow, added user info and secrets. dotnet-test.yml: Centralized workflow. SQLParser.Example.csproj: Changed target framework to net8.0. SQLParser.Tests.csproj: Changed target frameworks to net8.0;net9.0. SQLParser.csproj: Changed target frameworks to net8.0;net9.0, updated package. docfx.json: Changed TargetFramework to net8.0. BREAKING CHANGE: Removing .Net 6/7 support as .Net 9 dependencies say they work with it in the package but then throw warnings. I don't know why this approach was taken but it breaks a bunch of automation.
1 parent 5bd5207 commit 323418e

File tree

11 files changed

+76
-241
lines changed

11 files changed

+76
-241
lines changed

.editorconfig

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ dotnet_style_null_propagation = true
5050
dotnet_style_object_initializer = true
5151
dotnet_style_operator_placement_when_wrapping = beginning_of_line
5252
dotnet_style_prefer_auto_properties = true
53+
dotnet_style_prefer_collection_expression = when_types_loosely_match
5354
dotnet_style_prefer_compound_assignment = true
5455
dotnet_style_prefer_conditional_expression_over_assignment = true
55-
dotnet_style_prefer_conditional_expression_over_return = true
56+
dotnet_style_prefer_conditional_expression_over_return = false
5657
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
5758
dotnet_style_prefer_inferred_anonymous_type_member_names = true
5859
dotnet_style_prefer_inferred_tuple_names = true
@@ -112,20 +113,21 @@ csharp_prefer_braces = when_multiline:silent
112113
csharp_prefer_simple_using_statement = true:suggestion
113114
csharp_style_namespace_declarations = block_scoped:silent
114115
csharp_style_prefer_method_group_conversion = true:silent
116+
csharp_style_prefer_primary_constructors = true:suggestion
115117
csharp_style_prefer_top_level_statements = true:silent
116118

117119
# Expression-level preferences
118-
csharp_prefer_simple_default_expression = true
120+
csharp_prefer_simple_default_expression = true:suggestion
119121
csharp_style_deconstructed_variable_declaration = true
120-
csharp_style_implicit_object_creation_when_type_is_apparent = true
122+
csharp_style_implicit_object_creation_when_type_is_apparent = false
121123
csharp_style_inlined_variable_declaration = true
122124
csharp_style_prefer_index_operator = true
123125
csharp_style_prefer_local_over_anonymous_function = true
124-
csharp_style_prefer_null_check_over_type_check = true
126+
csharp_style_prefer_null_check_over_type_check = true:suggestion
125127
csharp_style_prefer_range_operator = true
126128
csharp_style_prefer_tuple_swap = true
127129
csharp_style_prefer_utf8_string_literals = true
128-
csharp_style_throw_expression = true
130+
csharp_style_throw_expression = true:suggestion
129131
csharp_style_unused_value_assignment_preference = discard_variable
130132
csharp_style_unused_value_expression_statement_preference = discard_variable
131133

@@ -218,6 +220,10 @@ dotnet_naming_rule.local_variable_should_be_pascal_case.severity = suggestion
218220
dotnet_naming_rule.local_variable_should_be_pascal_case.symbols = local_variable
219221
dotnet_naming_rule.local_variable_should_be_pascal_case.style = pascal_case
220222

223+
dotnet_naming_rule.async_methods_should_be_ends_with_async.severity = suggestion
224+
dotnet_naming_rule.async_methods_should_be_ends_with_async.symbols = async_methods
225+
dotnet_naming_rule.async_methods_should_be_ends_with_async.style = ends_with_async
226+
221227
# Symbol specifications
222228

223229
dotnet_naming_symbols.interface.applicable_kinds = interface
@@ -248,6 +254,10 @@ dotnet_naming_symbols.local_variable.applicable_kinds = local
248254
dotnet_naming_symbols.local_variable.applicable_accessibilities = *
249255
dotnet_naming_symbols.local_variable.required_modifiers =
250256

257+
dotnet_naming_symbols.async_methods.applicable_kinds = method, local_function
258+
dotnet_naming_symbols.async_methods.applicable_accessibilities = *
259+
dotnet_naming_symbols.async_methods.required_modifiers = async
260+
251261
# Naming styles
252262

253263
dotnet_naming_style.pascal_case.required_prefix =
@@ -275,13 +285,29 @@ dotnet_naming_style.begins_with_t.required_suffix =
275285
dotnet_naming_style.begins_with_t.word_separator =
276286
dotnet_naming_style.begins_with_t.capitalization = pascal_case
277287

288+
dotnet_naming_style.ends_with_async.required_prefix =
289+
dotnet_naming_style.ends_with_async.required_suffix = Async
290+
dotnet_naming_style.ends_with_async.word_separator =
291+
dotnet_naming_style.ends_with_async.capitalization = pascal_case
292+
278293
[*.{cs,vb}]
294+
dotnet_style_coalesce_expression = true:suggestion
279295
dotnet_style_operator_placement_when_wrapping = beginning_of_line
280296
tab_width = 4
281297
indent_size = 4
282298
end_of_line = crlf
283-
dotnet_style_coalesce_expression = true:suggestion
284299
dotnet_style_null_propagation = true:suggestion
285300
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
286301
dotnet_style_prefer_auto_properties = true:silent
287-
dotnet_style_object_initializer = true:suggestion
302+
dotnet_style_object_initializer = true:suggestion
303+
dotnet_style_collection_initializer = true:suggestion
304+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
305+
dotnet_style_prefer_conditional_expression_over_assignment = false:silent
306+
dotnet_style_prefer_conditional_expression_over_return = false:silent
307+
dotnet_style_explicit_tuple_names = true:suggestion
308+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
309+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
310+
dotnet_style_prefer_compound_assignment = true:suggestion
311+
dotnet_style_prefer_simplified_interpolation = true:suggestion
312+
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
313+
dotnet_style_namespace_match_folder = true:suggestion

.github/dependabot.yml

Lines changed: 12 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: "/SQLParser/" # 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: "/SQLParser.Tests/" # Location of package manifests
@@ -35,12 +26,17 @@ 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: "/SQLParser.Example/" # Location of package manifests
32+
schedule:
33+
interval: "daily"
34+
commit-message:
35+
prefix: "chore"
36+
groups:
37+
dependencies:
38+
patterns:
39+
- "*"
4440

4541
- package-ecosystem: "github-actions"
4642
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/[email protected]
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 & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +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: 'FastActivator.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/[email protected]
23-
with:
24-
dotnet-version: ${{ matrix.dotnet-version }}
25-
26-
- name: Restore dependencies
27-
run: dotnet restore
28-
29-
- name: Build
30-
run: dotnet build --no-restore --configuration $BUILD_CONFIG
31-
32-
- run: dotnet tool update -g docfx
33-
- run: docfx docfx_project/docfx.json
34-
35-
- name: Deploy
36-
uses: peaceiris/actions-gh-pages@v4
37-
with:
38-
github_token: ${{ secrets.GITHUB_TOKEN }}
39-
publish_dir: docfx_project/_site
12+
uses: JaCraig/Centralized-Workflows/.github/workflows/docsfx.yml@main

.github/workflows/dotnet-publish.yml

Lines changed: 9 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -9,77 +9,12 @@ on:
99

1010
jobs:
1111
build:
12-
env:
13-
BUILD_CONFIG: 'Release'
14-
SOLUTION: 'FastActivator.sln'
15-
16-
runs-on: ubuntu-latest
17-
strategy:
18-
matrix:
19-
dotnet-version: [ '6.0.x' ]
20-
21-
steps:
22-
- uses: actions/checkout@v4
23-
with:
24-
fetch-depth: 0
25-
26-
- name: Setup .NET SDK ${{ matrix.dotnet-version }}
27-
uses: actions/[email protected]
28-
with:
29-
dotnet-version: ${{ matrix.dotnet-version }}
30-
31-
- name: Install Versionize
32-
run: dotnet tool install --global Versionize
33-
34-
- name: Setup git
35-
run: |
36-
git config --local user.email "[email protected]"
37-
git config --local user.name "James Craig"
38-
39-
- name: Versionize Release
40-
id: versionize
41-
run: versionize --exit-insignificant-commits
42-
continue-on-error: true
43-
44-
- name: Restore dependencies
45-
run: dotnet restore
46-
47-
- name: Build
48-
run: dotnet build --no-restore --configuration $BUILD_CONFIG
49-
50-
- name: Test
51-
run: dotnet test /p:Configuration=$BUILD_CONFIG --no-build --verbosity normal --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}"
52-
53-
- name: Upload test results
54-
uses: actions/upload-artifact@v4
55-
with:
56-
name: dotnet-results-${{ matrix.dotnet-version }}
57-
path: TestResults-${{ matrix.dotnet-version }}
58-
if: ${{ always() }}
59-
60-
- name: Upload NuGet package
61-
uses: actions/upload-artifact@v4
62-
with:
63-
name: NugetPackage
64-
path: ./**/*.nupkg
65-
if: steps.versionize.outcome == 'success'
66-
67-
- name: Upload Symbol package
68-
uses: actions/upload-artifact@v4
69-
with:
70-
name: SymbolPackage
71-
path: ./**/*.snupkg
72-
if: steps.versionize.outcome == 'success'
73-
74-
- name: Push changes to Github
75-
if: steps.versionize.outcome == 'success'
76-
uses: ad-m/[email protected]
77-
with:
78-
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
79-
branch: ${{ github.ref }}
80-
force: true
81-
tags: true
82-
83-
- name: Upload package to NuGet
84-
if: steps.versionize.outcome == 'success'
85-
run: dotnet nuget push "**/*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
12+
uses: 'JaCraig/Centralized-Workflows/.github/workflows/dotnet-publish.yml@main'
13+
with:
14+
user: 'JaCraig'
15+
user-email: '[email protected]'
16+
coveralls-upload: "./SQLParser.Tests/TestResults-9.0.x/coverage.net8.0.info"
17+
test-filter: "SQLParser.Tests"
18+
secrets:
19+
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
20+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

0 commit comments

Comments
 (0)