-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
wip wip wip wip install csharpier like this? so? fmt fix coverage workflow only test 8.0 so?
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "nuget" # See documentation for possible values | ||
directory: "/ChronoJsonDiffPatch" # Location of package manifests | ||
schedule: | ||
interval: "weekly" | ||
reviewers: | ||
- "@Hochfrequenz/c-developers-review-team" | ||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [main] | ||
schedule: | ||
- cron: "20 5 * * 6" | ||
|
||
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' ] | ||
# Learn more: | ||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed | ||
|
||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Dependabot auto-approve / -merge | ||
on: pull_request | ||
|
||
jobs: | ||
dependabot: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
steps: | ||
- name: Approve a PR | ||
run: gh pr review --approve "$PR_URL" | ||
- name: Enable auto-merge for Dependabot PRs | ||
run: gh pr merge --auto --squash "$PR_URL" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: csharpier | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET 8 | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.100 | ||
- name: Restore .NET tools | ||
run: dotnet tool restore | ||
working-directory: ./JsonPatchDocumentExtensionDataAdapter | ||
- name: Run CSharpier | ||
run: dotnet csharpier . --check | ||
working-directory: ./JsonPatchDocumentExtensionDataAdapter |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Nuget Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
pushrelease: | ||
runs-on: windows-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.100 | ||
- uses: olegtarasov/get-tag@v2.1 | ||
id: tagChrono | ||
with: | ||
tagRegex: "v(\\d+\\.\\d+\\.\\d+)" | ||
- name: Build/Check for compile errors (dotnet build) | ||
working-directory: "JsonPatchDocumentExtensionDataAdapter" | ||
run: dotnet build --configuration Release | ||
- name: Run Unit Tests (dotnet test) | ||
working-directory: "JsonPatchDocumentExtensionDataAdapter" | ||
run: dotnet test --configuration Release | ||
- name: Create Package ChronoJsonDiffPatch (dotnet pack) | ||
working-directory: "JsonPatchDocumentExtensionDataAdapter/JsonPatchDocumentExtensionDataAdapter" | ||
run: dotnet pack ChronoJsonDiffPatch.csproj --configuration Release -p:PackageVersion="${{ steps.tagChrono.outputs.tag }}" | ||
- name: Setup Nuget.exe | ||
uses: warrenbuckley/Setup-Nuget@v1 | ||
- name: Nuget push ChronoJsonDiffPatch | ||
working-directory: "JsonPatchDocumentExtensionDataAdapter/JsonPatchDocumentExtensionDataAdapter" | ||
# token: https://github.com/Hochfrequenz/JsonPatchDocumentExtensionDataAdapter/settings/secrets/actions/NUGET_ORG_PUSH_TOKEN | ||
# expires 2024-02-02 | ||
run: | | ||
nuget setApiKey ${{ secrets.NUGET_ORG_PUSH_TOKEN }} | ||
nuget push .\bin\Release\*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -NoSymbols |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Unittests and Coverage | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
unittest: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
dotnet-version: [ "8.0.401" ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: ${{ matrix.dotnet-version }} | ||
- name: Run Tests | ||
working-directory: ./JsonPatchDocumentExtensionDataAdapter | ||
run: dotnet test --configuration Release | ||
coverage: | ||
needs: unittest | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.100 | ||
- name: Install dependencies | ||
working-directory: ./JsonPatchDocumentExtensionDataAdapter | ||
run: dotnet restore | ||
- name: Install coverlet.msbuild in ChronoJsonDiffPatchTests | ||
working-directory: ./JsonPatchDocumentExtensionDataAdapter/UnitTests | ||
run: dotnet add package coverlet.msbuild | ||
- name: Measure Test Coverage | ||
working-directory: ./JsonPatchDocumentExtensionDataAdapter | ||
run: dotnet test /p:Threshold=90 /p:Include=\"[*]ChronoJsonDiffPatch.*\" /p:ThresholdType=line /p:CollectCoverage=true /p:SkipAutoProps=true /p:CoverletOutputFormat=lcov --configuration Release |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
JsonPatchDocumentExtensionDataAdapter/UnitTest/obj/ | ||
JsonPatchDocumentExtensionDataAdapter/UnitTest/bin/ | ||
JsonPatchDocumentExtensionDataAdapter/UnitTest/bin/ | ||
|
||
JsonPatchDocumentExtensionDataAdapter/JsonPatchDocumentExtensionDataAdapter/obj/ | ||
JsonPatchDocumentExtensionDataAdapter/JsonPatchDocumentExtensionDataAdapter/bin/ | ||
|
||
JsonPatchDocumentExtensionDataAdapter/JsonPatchDocumentExtensionDataAdapter.sln.DotSettings.user |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"csharpier": { | ||
"version": "0.29.1", | ||
"commands": ["dotnet-csharpier"], | ||
"rollForward": false | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=5506f765_002D30e7_002D4d75_002Db90b_002D590de051b55a/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" Name="JsonPatchDocumentTest" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
 | ||
<TestAncestor>
 | ||
<TestId>MSTest::CA9CA5DA-279F-4021-96CE-13784AAD2564::net8.0::UnitTest.JsonPatchDocumentTest</TestId>
 | ||
</TestAncestor>
 | ||
</SessionState></s:String></wpf:ResourceDictionary> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JsonPatchDocumentExtensionDataAdapter", "JsonPatchDocumentExtensionDataAdapter\JsonPatchDocumentExtensionDataAdapter.csproj", "{093295C4-E041-4DD2-B97A-C2CC6958E214}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.csproj", "{CA9CA5DA-279F-4021-96CE-13784AAD2564}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{093295C4-E041-4DD2-B97A-C2CC6958E214}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{093295C4-E041-4DD2-B97A-C2CC6958E214}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{093295C4-E041-4DD2-B97A-C2CC6958E214}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{093295C4-E041-4DD2-B97A-C2CC6958E214}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{CA9CA5DA-279F-4021-96CE-13784AAD2564}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{CA9CA5DA-279F-4021-96CE-13784AAD2564}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{CA9CA5DA-279F-4021-96CE-13784AAD2564}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{CA9CA5DA-279F-4021-96CE-13784AAD2564}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using Newtonsoft.Json; | ||
|
||
namespace JsonExtensionDataPatchDocumentAdapter; | ||
|
||
/// <summary> | ||
/// an error that is raised if <see cref="System.Text.Json.Serialization.JsonPropertyNameAttribute"/> and <see cref="JsonPropertyAttribute.PropertyName"/> don't match | ||
/// </summary> | ||
/// <remarks>It's important for the models to use consistent property names because ASP.Net Core internally relies on Newtonsoft</remarks> | ||
public class InconsistentPropertyNamesException : Exception | ||
{ | ||
/// <summary> | ||
/// name of the property | ||
/// </summary> | ||
public string PropertyName { get; } | ||
|
||
/// <summary> | ||
/// json name of the property using Newtonsoft | ||
/// </summary> | ||
public string? NewtonsoftJsonPropertyName { get; } | ||
|
||
/// <summary> | ||
/// json name of the property using System.Text.Json | ||
/// </summary> | ||
public string? SystemTextPropertyName { get; } | ||
|
||
internal InconsistentPropertyNamesException( | ||
string propertyName, | ||
string? newtonsoftJsonPropertyName = null, | ||
string? systemTextPropertyName = null | ||
) | ||
: base($"The property name and the json property name don't match for {propertyName}") | ||
{ | ||
PropertyName = propertyName; | ||
NewtonsoftJsonPropertyName = newtonsoftJsonPropertyName; | ||
SystemTextPropertyName = systemTextPropertyName; | ||
} | ||
|
||
public new string ToString() | ||
{ | ||
return $"The system.text.property name {SystemTextPropertyName ?? "(unset)"} and the newtonsoft json property{NewtonsoftJsonPropertyName ?? "(unset)"} name don't match for property {PropertyName}. Because the logic of this package relies on System.Text.Json but ASP.NET Core relies on Newtonsoft internally, both have to match"; | ||
} | ||
} |