-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
1,513 additions
and
345 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import sys | ||
import os | ||
from datetime import datetime, timedelta, timezone | ||
|
||
current_utc_time = datetime.utcnow() | ||
current_utc_time = current_utc_time.replace(tzinfo=timezone.utc) | ||
|
||
print("Args list: ", sys.argv) | ||
|
||
time_str = sys.argv[1] | ||
days_deference = int(sys.argv[2]) | ||
|
||
datetime_obj = datetime.fromisoformat(time_str) | ||
datetime_obj = datetime_obj.replace(tzinfo=timezone.utc) | ||
|
||
time_difference = current_utc_time - datetime_obj | ||
|
||
print("Time delta: ", time_difference) | ||
|
||
has_new_commit = time_difference > timedelta(days=days_deference) | ||
env_to_add = "HAS_NEW_COMMIT=" | ||
|
||
if time_difference > timedelta(days=days_deference): | ||
print("No new commit found. Check in env var: [env.HAS_NEW_COMMIT].") | ||
env_to_add = env_to_add + 'false' | ||
else: | ||
print("New commit found. Check in env var: [env.HAS_NEW_COMMIT].") | ||
env_to_add = env_to_add + 'true' | ||
|
||
command = "echo \"" + env_to_add + "\" >> $env:GITHUB_ENV" | ||
|
||
with open('set_env.ps1', 'w', encoding='utf-8') as file: | ||
file.write(command) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,59 @@ | ||
name: daily-build | ||
name: Daily Build | ||
|
||
on: | ||
schedule: | ||
- cron: '0 6 * * 0' | ||
- cron: "0 6 * * 0" | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: | | ||
6.0.x | ||
7.0.x | ||
include-prerelease: false | ||
|
||
- name: Build | ||
shell: pwsh | ||
run: | | ||
cd Common.BasicHelper | ||
dotnet build -c Release | ||
cd bin/Release | ||
$out = ls | ||
if ("$out" -match 'Common.BasicHelper.(\d*).(\d*).(\d*).(\d*).nupkg') { | ||
$v1 = $Matches.1 | ||
$v2 = $Matches.2 | ||
$v3 = $Matches.3 | ||
$v4 = $Matches.4 | ||
$version = "$v1.$v2.$v3.$v4" | ||
echo "version=$version" | ||
echo "version=$version" >> $env:GITHUB_ENV | ||
echo "canRelease=true" >> $env:GITHUB_ENV | ||
} else { | ||
echo "canRelease=false" >> $env:GITHUB_ENV | ||
} | ||
cd ../../.. | ||
- name: Create Release and Upload Release Asset | ||
if: ${{ env.canRelease == 'true' }} | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: v${{ env.version }} | ||
name: Weekly Release v${{ env.version }} | ||
body: Auto release by Actions. | ||
draft: false | ||
prerelease: true | ||
files: | | ||
Common.BasicHelper/bin/Release/*.nupkg | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: | | ||
8.0.x | ||
- name: Build | ||
working-directory: Common.BasicHelper | ||
shell: pwsh | ||
run: | | ||
dotnet build -c Release | ||
cd bin/Release | ||
$out = ls | ||
if ("$out" -match 'Common.BasicHelper.(\d*).(\d*).(\d*).(\d*).nupkg') { | ||
$v1 = $Matches.1 | ||
$v2 = $Matches.2 | ||
$v3 = $Matches.3 | ||
$v4 = $Matches.4 | ||
$version = "$v1.$v2.$v3.$v4" | ||
echo "version=$version" | ||
echo "version=$version" >> $env:GITHUB_ENV | ||
echo "CAN_RELEASE=true" >> $env:GITHUB_ENV | ||
} else { | ||
echo "CAN_RELEASE=false" >> $env:GITHUB_ENV | ||
} | ||
- name: Check New Commit | ||
shell: pwsh | ||
run: | | ||
$latest_commit_date=((git show --pretty=format:"%cd" --date=iso) -split '\n')[0] | ||
py ./.github/scripts/check_new_commit.py "$latest_commit_date" 7 | ||
./set_env.ps1 | ||
- name: Create Release and Upload Release Asset | ||
uses: softprops/action-gh-release@v1 | ||
if: env.CAN_RELEASE == 'true' && env.HAS_NEW_COMMIT == 'true' | ||
with: | ||
tag_name: v${{ env.version }} | ||
name: Auto Release v${{ env.version }} on ${{ env.date }} | ||
body: Auto release by Actions. | ||
draft: false | ||
prerelease: true | ||
files: | | ||
Common.BasicHelper/bin/Release/*.nupkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,6 @@ jobs: | |
dotnet-version: | | ||
6.0.x | ||
7.0.x | ||
include-prerelease: false | ||
- name: Build | ||
run: | | ||
|
26 changes: 14 additions & 12 deletions
26
Common.BasicHelper.Samples/Common.BasicHelper.Samples.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.4" /> | ||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> | ||
</ItemGroup> | ||
<PropertyGroup Condition=" '$(RunConfiguration)' == 'https' " /> | ||
<PropertyGroup Condition=" '$(RunConfiguration)' == 'http' " /> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.4" /> | ||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Common.BasicHelper\Common.BasicHelper.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Common.BasicHelper\Common.BasicHelper.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 37 additions & 39 deletions
76
Common.BasicHelper.Samples/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,39 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/launchsettings.json", | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:40529", | ||
"sslPort": 44396 | ||
} | ||
{ | ||
"$schema": "https://json.schemastore.org/launchsettings.json", | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:40529", | ||
"sslPort": 44396 | ||
} | ||
}, | ||
"profiles": { | ||
"http": { | ||
"commandName": "Project", | ||
"launchUrl": "swagger", | ||
"applicationUrl": "http://localhost:5077", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"dotnetRunMessages": true | ||
}, | ||
"https": { | ||
"commandName": "Project", | ||
"launchUrl": "swagger", | ||
"applicationUrl": "https://localhost:7219;http://localhost:5077", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"dotnetRunMessages": true | ||
}, | ||
"profiles": { | ||
"http": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": false, | ||
"launchUrl": "swagger", | ||
"applicationUrl": "http://localhost:5077", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"https": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": false, | ||
"launchUrl": "swagger", | ||
"applicationUrl": "https://localhost:7219;http://localhost:5077", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
Common.BasicHelper.Test/Core/DataStructure/LineBasedPropertyTable/LbptSerializer_Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
namespace Common.BasicHelper.Core.DataStructure.LineBasedPropertyTable; | ||
|
||
[TestClass] | ||
public class LbptSerializer_Tests | ||
{ | ||
public class TestClasses | ||
{ | ||
public class Person | ||
{ | ||
public int Id { get; set; } | ||
|
||
public string? Name { get; set; } | ||
} | ||
|
||
public class PersonGroup | ||
{ | ||
public int? PersonCount => Persons?.Count; | ||
|
||
public List<Person>? Persons { get; set; } = []; | ||
|
||
public string? GroupName { get; set; } = "Test Group"; | ||
|
||
public List<int> TestList { get; set; } = [1, 2, 3, 4, 5, 6]; | ||
} | ||
|
||
internal static PersonGroup GetOneGroup() | ||
{ | ||
var group = new PersonGroup(); | ||
group.Persons?.Add(new() | ||
{ | ||
Id = 0, | ||
Name = "张三" | ||
}); | ||
group.Persons?.Add(new() | ||
{ | ||
Id = 1, | ||
Name = "李四" | ||
}); | ||
return group; | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Test_Serialize() | ||
{ | ||
var group = TestClasses.GetOneGroup(); | ||
|
||
var result = LbptSerializer.Serialize(group, out var text); | ||
|
||
Console.WriteLine(text); | ||
|
||
Assert.AreEqual(result.SerializedText, text); | ||
} | ||
|
||
[TestMethod] | ||
public void Test_Deserialize() | ||
{ | ||
var group = TestClasses.GetOneGroup(); | ||
|
||
var result = LbptSerializer.Serialize(group, out _).SerializedText; | ||
|
||
var des = LbptSerializer.Deserialize<TestClasses.PersonGroup>(result); | ||
|
||
Console.WriteLine(LbptSerializer.Serialize(des, out _).SerializedText); | ||
} | ||
} |
Oops, something went wrong.