Skip to content

Commit

Permalink
Merge pull request #176 from WeihanLi/dev
Browse files Browse the repository at this point in the history
1.0.60
  • Loading branch information
WeihanLi authored Nov 15, 2023
2 parents d80e54e + 712e97c commit cd70206
Show file tree
Hide file tree
Showing 210 changed files with 3,773 additions and 3,401 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"husky": {
"version": "0.6.2",
"commands": [
"husky"
]
}
}
}
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0
FROM mcr.microsoft.com/dotnet/sdk:8.0
RUN dotnet tool install -g cake.tool
RUN dotnet tool install -g dotnet-httpie
RUN dotnet tool install -g dotnet-exec
RUN dotnet tool install -g dotnet-execute
17 changes: 0 additions & 17 deletions .github/stale.yml

This file was deleted.

17 changes: 13 additions & 4 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: default

on: [push, pull_request]
on:
push:
branches:
- "main"
- "dev"
pull_request:
# The branches below must be a subset of the branches above
branches:
- "main"
- "dev"

jobs:
mac-build:
Expand All @@ -13,7 +22,7 @@ jobs:
dotnet-version: |
6.0.x
7.0.x
include-prerelease: true
8.0.x
- name: build
run: bash build.sh

Expand All @@ -27,7 +36,7 @@ jobs:
dotnet-version: |
6.0.x
7.0.x
include-prerelease: true
8.0.x
- name: build
run: bash build.sh

Expand All @@ -41,7 +50,7 @@ jobs:
dotnet-version: |
6.0.x
7.0.x
include-prerelease: true
8.0.x
- name: build
shell: pwsh
run: .\build.ps1
54 changes: 18 additions & 36 deletions .github/workflows/docfx.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,33 @@
name: docfx build
name: docs
on:
push:
branches:
- main
- master
# - dev
jobs:
build:
name: Build
runs-on: windows-latest
steps:
# Check out the branch that triggered this workflow to the 'source' subdirectory
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
ref: master
path: source
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: install DocFX
run: "& choco install docfx -y"
# Run a build
run: "dotnet tool install -g docfx"
# - name: output current dir
# run: "dir"
- name: Build docs
run: "& docfx ./docfx.json"
working-directory: ./source
# Check out gh-pages branch to the 'docs' subdirectory
- name: Checkout docs
uses: actions/checkout@v2
run: "docfx ./docs/docfx.json"
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
ref: gh-pages
path: docs
# Sync the site
- name: Clear docs repo
run: Get-ChildItem -Force -Exclude .git | ForEach-Object { Remove-Item -Recurse -Verbose -Force $_ }
working-directory: ./docs
- name: Sync new content
run: Copy-Item -Recurse -Verbose -Force "$env:GITHUB_WORKSPACE/source/_site/*" "$env:GITHUB_WORKSPACE/docs"
working-directory: ./docs
# update docs
- name: Commit to gh-pages and push
run: |
$ErrorActionPreference = "Continue"
git add -A
git diff HEAD --exit-code
if ($LASTEXITCODE -eq 0) {
Write-Host "No changes to commit!"
} else {
git config --global user.name "github-actions-docfx[bot]"
git config --global user.email "[email protected]"
git commit -m "Updated docs from commit $env:GITHUB_SHA on $env:GITHUB_REF"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git push origin gh-pages
}
working-directory: ./docs
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site
5 changes: 3 additions & 2 deletions .github/workflows/dotnet-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: dotnet-format
on:
push:
branches:
- "dev"
- "main"
# - "dev"

jobs:
build:
Expand All @@ -16,7 +17,7 @@ jobs:
dotnet-version: |
6.0.x
7.0.x
include-prerelease: true
8.0.x
- name: build
run: dotnet build
- name: format
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Release
on:
push:
branches: [ master ]
branches: [ master, main ]
jobs:
build:
name: Release
Expand All @@ -14,7 +14,7 @@ jobs:
dotnet-version: |
6.0.x
7.0.x
include-prerelease: true
8.0.x
- name: Build
shell: pwsh
run: .\build.ps1 --stable=true
Expand Down
9 changes: 9 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

dotnet tool update -g dotnet-execute --prerelease
dotnet husky run --name "commit-message-linter" --args "$1"

echo
echo Great work! 🥂
echo
22 changes: 22 additions & 0 deletions .husky/post-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

## husky task runner examples -------------------
## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky'

## run all tasks
#husky run

### run all tasks with group: 'group-name'
#husky run --group group-name

## run task with name: 'task-name'
#husky run --name task-name

## pass hook arguments to task
#husky run --args "$1" "$2"

## or put your custom commands -------------------
#echo 'Husky.Net is awesome!'

dotnet husky run --group post-push
11 changes: 11 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# task-runner config https://alirezanet.github.io/Husky.Net/guide/task-runner.html

# run tasks by task name
# dotnet husky run --name "build"
# dotnet husky run --name "format-verify"

# run tasks by task group name
# dotnet husky run --group pre-commit
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

dotnet husky run --group pre-push
22 changes: 22 additions & 0 deletions .husky/scripts/commit-lint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
A simple regex commit linter
https://www.conventionalcommits.org/en/v1.0.0/
https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type
*/

const string pattern = @"^(?=.{1,90}$)(?:build|feat|ci|chore|docs|fix|perf|refactor|revert|style|sample|test)(?:\(.+\))*(?::).{4,}(?:#\d+)*(?<![\.\s])$";

var msg = File.ReadAllLines(args[0])[0];
Console.WriteLine("Your commit headline message is:\n> {0}", msg);
if (System.Text.RegularExpressions.Regex.IsMatch(msg, pattern))
return 0;

Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Invalid commit message");
Console.ResetColor();
Console.WriteLine("e.g: 'feat(scope): subject' or 'fix: subject'");
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("more info: https://www.conventionalcommits.org/en/v1.0.0/");
Console.ResetColor();

return 1;
30 changes: 30 additions & 0 deletions .husky/task-runner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"tasks":
[
{
"name": "commit-message-linter",
"group": "commit-msg",
"command": "dotnet-exec",
"args": [".husky/scripts/commit-lint.cs", "--args", "${args}"]
},
{
"name": "test",
"group": "pre-push",
"command": "dotnet",
"args": [ "test" ],
"exclude": [
"**/*.md",
"docs/**/*"
]
},
{
"name": "dotnet-format",
"group": "post-push",
"command": "dotnet",
"args": [ "format" ],
"include": [
"**/*.cs"
]
}
]
}
8 changes: 3 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
<RepositoryType>git</RepositoryType>
<Authors>WeihanLi</Authors>
<Copyright>Copyright 2017-$([System.DateTime]::Now.Year) (c) WeihanLi</Copyright>
<NoWarn>$(NoWarn);NU5048;CS1591</NoWarn>
<NoWarn>$(NoWarn);NU5048;CS1591;NETSDK1057</NoWarn>
<ArtifactsPath>$(MSBuildThisFileDirectory)artifacts</ArtifactsPath>
<ContinuousIntegrationBuild Condition="'$(TF_BUILD)' == 'true' or '$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="PolySharp" Version="1.8.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<InternalsVisibleTo Condition="'$(Configuration)'=='Debug'" Include="WeihanLi.Common.Test" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Project>
</Project>
46 changes: 46 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<Project>
<PropertyGroup>
<!-- Enable central package management -->
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<ExtensionPackageVersion Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'net6.0'">6.0.0</ExtensionPackageVersion>
<ExtensionPackageVersion Condition="'$(TargetFramework)' == 'net7.0'">7.0.0</ExtensionPackageVersion>
<ExtensionPackageVersion Condition="'$(TargetFramework)' == 'net8.0'">8.0.0</ExtensionPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="$(ExtensionPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="$(ExtensionPackageVersion)" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="System.Reflection.Emit" Version="4.7.0" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="AspectCore.Core" Version="2.4.0" />
<PackageVersion Include="Castle.Core" Version="5.1.1" />
<PackageVersion Include="Serilog" Version="3.1.1" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.2" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="FluentAssertions" Version="6.6.0" />
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="xunit" Version="2.6.1" />
<PackageVersion Include="Xunit.DependencyInjection" Version="8.7.1" />
<PackageVersion Include="Xunit.DependencyInjection.Logging" Version="8.1.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.10" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version=" 8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="5.0.0" />
<PackageVersion Include="System.Data.SqlClient" Version="4.8.5" />
<PackageVersion Include="Dapper" Version="2.1.21" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="PolySharp" Version="1.13.2" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
</ItemGroup>
</Project>
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

## Intro

基于 .netstandard2.0 的 .NET 常用帮助类,扩展方法等,基础类库
.NET 常用帮助类,扩展方法等,基础类库

## Packages

Expand All @@ -22,7 +22,6 @@
- [WeihanLi.Common.Aspect.Castle](https://www.nuget.org/packages/WeihanLi.Common.Aspect.Castle/) 基于 Castle 的 AOP 扩展
- [WeihanLi.Common.Aspect.AspectCore](https://www.nuget.org/packages/WeihanLi.Common.Aspect.Castle/) 基于 AspectCore 的 AOP 扩展(`CreateProxyWithTarget` 不支持 class)
- [WeihanLi.Data](https://www.nuget.org/packages/WeihanLi.Data) 数据库扩展
- [WeihanLi.Common.Logging.Log4Net](https://www.nuget.org/packages/WeihanLi.Common.Logging.Log4Net) 日志 log4net 扩展
- [WeihanLi.Common.Logging.Serilog](https://www.nuget.org/packages/WeihanLi.Common.Logging.Serilog) 日志 serilog 扩展

## Extensions
Expand All @@ -37,14 +36,14 @@
- Dependence Injection(类比微软依赖注入框架自定义实现的依赖注入框架)
- Fluent Aspects -- AOP implemented(基于动态代理实现的 AOP 框架)
- Event Related(EventBus/EventQueue/EventStore)
- Logging Framework(结合log4net/serilog/微软日志框架实现的日志框架)
- Logging Framework(结合serilog/微软日志框架实现的日志框架)
- Dapper-like Ado.Net extensions(类似 Dapper 的 Ado.Net 扩展)
- TOTP implement(TOTP算法实现)
- and more ...

## Release Notes

you can see a summary of package release notes [here](./docs/ReleaseNotes.md).
See pull requests list for changes <https://github.com/WeihanLi/WeihanLi.Common/pulls?q=is%3Apr+is%3Amerged+base%3Amaster>

## Contact

Expand Down
Loading

0 comments on commit cd70206

Please sign in to comment.