Skip to content

Commit

Permalink
feat: Update to .Net 8/9, updating workflows, and registration code
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JaCraig committed Nov 24, 2024
1 parent 314afab commit 68e0ab2
Show file tree
Hide file tree
Showing 205 changed files with 15,984 additions and 16,152 deletions.
8 changes: 5 additions & 3 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
"isRoot": true,
"tools": {
"husky": {
"version": "0.6.1",
"version": "0.7.1",
"commands": [
"husky"
]
],
"rollForward": false
},
"versionize": {
"version": "2.3.0",
"commands": [
"versionize"
]
],
"rollForward": false
}
}
}
11 changes: 8 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ csharp_style_prefer_pattern_matching = true
csharp_style_prefer_switch_expression = true

# Null-checking preferences
csharp_style_conditional_delegate_call = true
csharp_style_conditional_delegate_call = true:suggestion

# Modifier preferences
csharp_prefer_static_local_function = true
Expand Down Expand Up @@ -135,7 +135,7 @@ csharp_using_directive_placement = outside_namespace:silent
# New line preferences
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
csharp_style_allow_embedded_statements_on_same_line_experimental = true

Expand Down Expand Up @@ -274,6 +274,8 @@ dotnet_naming_style.begins_with_t.required_prefix = T
dotnet_naming_style.begins_with_t.required_suffix =
dotnet_naming_style.begins_with_t.word_separator =
dotnet_naming_style.begins_with_t.capitalization = pascal_case
csharp_style_prefer_primary_constructors = true:suggestion
csharp_prefer_system_threading_lock = true:suggestion

[*.{cs,vb}]
dotnet_style_coalesce_expression = true:suggestion
Expand All @@ -284,4 +286,7 @@ dotnet_style_object_initializer = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
end_of_line = crlf
dotnet_style_namespace_match_folder = false:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = false:silent
dotnet_style_prefer_conditional_expression_over_return = false:silent
30 changes: 13 additions & 17 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
version: 2
updates:
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
directory: "/FileCurator/" # Location of package manifests
schedule:
interval: "daily"
commit-message:
Expand All @@ -15,18 +15,20 @@ updates:
dependencies:
patterns:
- "*"
ignore:
- dependency-name: "coverlet.collector"
- dependency-name: "Mecha.xUnit"
- dependency-name: "Microsoft.NET.Test.Sdk"
- dependency-name: "xunit"
- dependency-name: "xunit.runner.visualstudio"
- dependency-name: "Microsoft.CodeAnalysis.NetAnalyzers"
- dependency-name: "husky"
- dependency-name: "BenchmarkDotNet"

- package-ecosystem: "nuget" # See documentation for possible values
directory: "/test/FileCurator.Tests/" # Location of package manifests
directory: "/FileCurator.Tests/" # Location of package manifests
schedule:
interval: "daily"
commit-message:
prefix: "chore"
groups:
dependencies:
patterns:
- "*"

- package-ecosystem: "nuget" # See documentation for possible values
directory: "/FileCurator.Example/" # Location of package manifests
schedule:
interval: "daily"
commit-message:
Expand All @@ -35,12 +37,6 @@ updates:
dependencies:
patterns:
- "*"
allow:
- dependency-name: "coverlet.collector"
- dependency-name: "Mecha.xUnit"
- dependency-name: "Microsoft.NET.Test.Sdk"
- dependency-name: "xunit"
- dependency-name: "xunit.runner.visualstudio"

- package-ecosystem: "github-actions"
directory: "/"
Expand Down
59 changes: 9 additions & 50 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,58 +13,17 @@ name: "CodeQL"

on:
push:
branches: [ master ]
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [ "master" ]
schedule:
- cron: '24 6 * * 0'
- cron: '37 18 * * 3'

permissions:
actions: read
contents: read
security-events: write

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: JaCraig/Centralized-Workflows/.github/workflows/codeql.yml@main
33 changes: 3 additions & 30 deletions .github/workflows/dependabot-reviewer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,7 @@ permissions:

jobs:
review-dependabot-pr:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v2.2.0
- name: Approve patch and minor updates
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor'}}
run: gh pr review $PR_URL --approve -b "**Approving** this pull request because **it includes a patch or minor update**"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
- name: Approve major updates of development dependencies
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:development'}}
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**"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
- name: Comment on major updates of non-development dependencies
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:production'}}
run: |
gh pr comment $PR_URL --body "**Not approving** this PR because **it includes a major update of a dependency used in production**"
gh pr edit $PR_URL --add-label "requires-manual-qa"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
uses: JaCraig/Centralized-Workflows/.github/workflows/dependabot-reviewer.yml@main
secrets:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
35 changes: 4 additions & 31 deletions .github/workflows/docsfx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,9 @@ on:
push:
branches: [ "master" ]

permissions:
contents: write

jobs:
publish-docs:
env:
BUILD_CONFIG: 'Release'
SOLUTION: 'FileCurator.sln'
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [ '6.0.x' ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v4.1.0
with:
dotnet-version: ${{ matrix.dotnet-version }}

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore --configuration $BUILD_CONFIG

- run: dotnet tool update -g docfx
- run: docfx docfx_project/docfx.json

- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docfx_project/_site
uses: JaCraig/Centralized-Workflows/.github/workflows/docsfx.yml@main
83 changes: 9 additions & 74 deletions .github/workflows/dotnet-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,77 +9,12 @@ on:

jobs:
build:
env:
BUILD_CONFIG: 'Release'
SOLUTION: 'FileCurator.sln'

runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [ '6.0.x' ]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v4.1.0
with:
dotnet-version: ${{ matrix.dotnet-version }}

- name: Install Versionize
run: dotnet tool install --global Versionize

- name: Setup git
run: |
git config --local user.email "JaCraig@users.noreply.github.com"
git config --local user.name "James Craig"
- name: Versionize Release
id: versionize
run: versionize --exit-insignificant-commits
continue-on-error: true

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore --configuration $BUILD_CONFIG

- name: Test
run: dotnet test /p:Configuration=$BUILD_CONFIG --no-build --verbosity normal --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}"

- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: dotnet-results-${{ matrix.dotnet-version }}
path: TestResults-${{ matrix.dotnet-version }}
if: ${{ always() }}

- name: Upload NuGet package
uses: actions/upload-artifact@v4
with:
name: NugetPackage
path: ./**/*.nupkg
if: steps.versionize.outcome == 'success'

- name: Upload Symbol package
uses: actions/upload-artifact@v4
with:
name: SymbolPackage
path: ./**/*.snupkg
if: steps.versionize.outcome == 'success'

- name: Push changes to Github
if: steps.versionize.outcome == 'success'
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
branch: ${{ github.ref }}
force: true
tags: true

- name: Upload package to NuGet
if: steps.versionize.outcome == 'success'
run: dotnet nuget push "**/*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
uses: 'JaCraig/Centralized-Workflows/.github/workflows/dotnet-publish.yml@main'
with:
user: 'JaCraig'
user-email: 'JaCraig@users.noreply.github.com'
coveralls-upload: "./FileCurator.Tests/TestResults-9.0.x/coverage.net8.0.info"
test-filter: "FileCurator.Tests"
secrets:
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
29 changes: 1 addition & 28 deletions .github/workflows/dotnet-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,4 @@ on:

jobs:
build:

env:
BUILD_CONFIG: 'Debug'
SOLUTION: 'FileCurator.sln'

runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [ '6.0.x' ]

steps:
- uses: actions/checkout@v4
- name: Setup .NET SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v4.1.0
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration $BUILD_CONFIG
- name: Test
run: dotnet test /p:Configuration=$BUILD_CONFIG --no-build --verbosity normal --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}"
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: dotnet-results-${{ matrix.dotnet-version }}
path: TestResults-${{ matrix.dotnet-version }}
if: ${{ always() }}
uses: 'JaCraig/Centralized-Workflows/.github/workflows/dotnet-test.yml@main'
Loading

0 comments on commit 68e0ab2

Please sign in to comment.