Merge branch 'dev'
This commit is contained in:
commit
2e6d29cc44
|
@ -6,6 +6,10 @@ root=true
|
|||
# All files
|
||||
[*]
|
||||
indent_style = space
|
||||
# shell files
|
||||
[*.{cmd,sh,bat}]
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
# Code files
|
||||
[*.{cs,csx,vb,vbx}]
|
||||
indent_size = 4
|
||||
|
|
|
@ -96,6 +96,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "win", "win", "{C6F2DCA0-794
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "linux", "linux", "{FDCFC3E3-14CF-40B2-9FE5-5BC239AAC110}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
deploy-admin.sh = deploy-admin.sh
|
||||
deploy-client.sh = deploy-client.sh
|
||||
publish-admin.sh = publish-admin.sh
|
||||
publish-client.sh = publish-client.sh
|
||||
watch-run-admin.sh = watch-run-admin.sh
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<Copyright>Longbow</Copyright>
|
||||
<Authors>Argo Zhang(argo@163.com)</Authors>
|
||||
|
@ -11,9 +12,9 @@
|
|||
<Target Condition=" '$(TargetFramework)' == 'netcoreapp3.0' " Name="PostPublish" AfterTargets="Publish">
|
||||
<Message Text="Publish -> $(PublishDir)" Importance="high" />
|
||||
<Copy Condition="'$(OS)' == 'Windows_NT'" DestinationFolder="$(PublishDir)" SourceFiles="$(MSBuildThisFileDirectory)src\admin\keys\Longbow.lic" SkipUnchangedFiles="true" />
|
||||
<Copy Condition="'$(OS)' == 'UNIX'" DestinationFolder="$(PublishDir)" SourceFiles="$(MSBuildThisFileDirectory)src/admin/keys/Longbow.lic" SkipUnchangedFiles="true" />
|
||||
<Copy Condition="'$(OS)' == 'Windows_NT'" DestinationFolder="$(PublishDir)" SourceFiles="$(MSBuildThisFileDirectory)src\admin\Bootstrap.Admin\BootstrapAdmin.db" SkipUnchangedFiles="true" />
|
||||
<Copy Condition="'$(OS)' == 'Windows_NT'" DestinationFolder="$(PublishDir)" SourceFiles="$(MSBuildThisFileDirectory)src/admin/Bootstrap.Admin/BootstrapAdmin.db" SkipUnchangedFiles="true" />
|
||||
<Copy Condition="'$(OS)' == 'UNIX'" DestinationFolder="$(PublishDir)" SourceFiles="$(MSBuildThisFileDirectory)src/admin/keys/Longbow.lic" SkipUnchangedFiles="true" />
|
||||
<Copy Condition="'$(OS)' == 'UNIX'" DestinationFolder="$(PublishDir)" SourceFiles="$(MSBuildThisFileDirectory)src/admin/Bootstrap.Admin/BootstrapAdmin.db" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
|
||||
<Target Condition=" '$(TargetFramework)' == 'netcoreapp3.0' " Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
function installDB() {
|
||||
write-host "init sqlserver database..." -ForegroundColor Cyan
|
||||
$startPath = "$($env:appveyor_build_folder)\db\SqlServer"
|
||||
$sqlInstance = "(local)\SQL2014"
|
||||
$sqlInstance = "(local)\SQL2017"
|
||||
$outFile = join-path $startPath "output.log"
|
||||
$sqlFile = join-path $startPath "Install.sql"
|
||||
$initFile = join-path $startPath "InitData.sql"
|
||||
|
||||
sqlcmd -S "$sqlInstance" -U sa -P Password12! -i "$sqlFile" -i "$initFile" -o "$outFile"
|
||||
|
||||
write-host "init mysql database..." -ForegroundColor Cyan
|
||||
$env:MYSQL_PWD="Password12!"
|
||||
$mysql = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe"'
|
||||
$cmd = $mysql + ' -e "create database BootstrapAdmin;" -uroot'
|
||||
cmd.exe /c $cmd
|
||||
#write-host "init mysql database..." -ForegroundColor Cyan
|
||||
#$env:MYSQL_PWD="Password12!"
|
||||
#$mysql = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe"'
|
||||
#$cmd = $mysql + ' -e "create database BootstrapAdmin;" -uroot'
|
||||
#cmd.exe /c $cmd
|
||||
|
||||
$startPath = "$($env:appveyor_build_folder)\db\MySQL"
|
||||
$para = ' -hlocalhost -uroot -DBootstrapAdmin < '
|
||||
$sqlFile = join-path $startPath "Install.sql"
|
||||
$cmd = $mysql + $para + $sqlFile
|
||||
cmd.exe /c $cmd
|
||||
#$startPath = "$($env:appveyor_build_folder)\db\MySQL"
|
||||
#$para = ' -hlocalhost -uroot -DBootstrapAdmin < '
|
||||
#$sqlFile = join-path $startPath "Install.sql"
|
||||
#$cmd = $mysql + $para + $sqlFile
|
||||
#cmd.exe /c $cmd
|
||||
|
||||
$initFile = join-path $startPath "InitData.sql"
|
||||
$cmd = $mysql + $para + $initFile
|
||||
cmd.exe /c $cmd
|
||||
#$initFile = join-path $startPath "InitData.sql"
|
||||
#$cmd = $mysql + $para + $initFile
|
||||
#cmd.exe /c $cmd
|
||||
|
||||
write-host "init mongodb data..." -ForegroundColor Cyan
|
||||
$initFolder = "$($env:appveyor_build_folder)\db\MongoDB"
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
function runUnitTest() {
|
||||
write-host "dotnet test test\UnitTest" -ForegroundColor Cyan
|
||||
dotnet test test\UnitTest /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include="[Bootstrap*]*" /p:ExcludeByFile="..\..\src\admin\Bootstrap.Admin\Program.cs%2c..\..\src\admin\Bootstrap.Admin\Startup.cs%2c..\..\src\admin\Bootstrap.Admin\HttpHeaderOperation.cs" /p:CoverletOutput=..\..\
|
||||
dotnet test test\UnitTest --filter "(FullyQualifiedName!~MySql) & (FullyQualifiedName!~Api.SqlServer) & (FullyQualifiedName!~Api.SQLite)" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include="[Bootstrap*]*" /p:ExcludeByFile="..\..\src\admin\Bootstrap.Admin\Program.cs%2c..\..\src\admin\Bootstrap.Admin\Startup.cs%2c..\..\src\admin\Bootstrap.Admin\HttpHeaderOperation.cs" /p:CoverletOutput=..\..\
|
||||
}
|
||||
|
||||
function coverallUnitTest() {
|
||||
|
@ -67,6 +67,9 @@ function codecovUnitTest() {
|
|||
cmd.exe /c "$codecovCmd -f ""coverage.opencover.xml"""
|
||||
}
|
||||
|
||||
installDB
|
||||
coverallUnitTest
|
||||
codecovUnitTest
|
||||
$branch = $($env:APPVEYOR_REPO_BRANCH)
|
||||
if ($branch -ne "dev") {
|
||||
installDB
|
||||
coverallUnitTest
|
||||
codecovUnitTest
|
||||
}
|
||||
|
|
13
appveyor.yml
13
appveyor.yml
|
@ -1,8 +1,10 @@
|
|||
version: 1.0.{build}
|
||||
branches:
|
||||
only:
|
||||
- release
|
||||
- master
|
||||
image: Visual Studio 2017
|
||||
- dev
|
||||
image: Visual Studio 2019
|
||||
clone_depth: 1
|
||||
init:
|
||||
- ps: git version
|
||||
|
@ -18,16 +20,11 @@ environment:
|
|||
secure: +22PuAn5seq4bbCVCly8zDFuyEV3m2NjW3QuM0+2gm4c8akwicNFmv2T/ZGd0Jpd
|
||||
cache: C:\ProgramData\chocolatey\lib\codecov\tools
|
||||
services:
|
||||
- mssql2014
|
||||
- mysql
|
||||
- mssql2017
|
||||
- mongodb
|
||||
install:
|
||||
- ps: >-
|
||||
#copy my.ini into mysql folder
|
||||
|
||||
dotnet --version
|
||||
|
||||
xcopy "$($env:appveyor_build_folder)\db\MySQL\my.ini" "C:\Program Files\MySQL\MySQL Server 5.7" /y
|
||||
build_script:
|
||||
- ps: >-
|
||||
.\appveyor.build.ps1
|
||||
|
@ -73,4 +70,4 @@ notifications:
|
|||
</div>
|
||||
on_build_success: true
|
||||
on_build_failure: true
|
||||
on_build_status_changed: false
|
||||
on_build_status_changed: false
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#! /bin/bash
|
||||
|
||||
cd ~/BootstrapAdmin
|
||||
git pull
|
||||
dotnet publish src/admin/Bootstrap.Admin -c Release
|
||||
|
||||
rm -f ~/BootstrapAdmin/src/admin/Bootstrap.Admin/bin/Release/netcoreapp2.2/publish/appsettings*.json
|
||||
systemctl stop ba.admin
|
||||
\cp -fr ~/BootstrapAdmin/src/admin/Bootstrap.Admin/bin/Release/netcoreapp2.2/publish/* /usr/local/ba/admin/
|
||||
systemctl start ba.admin
|
||||
systemctl status ba.admin -l
|
|
@ -0,0 +1,11 @@
|
|||
#! /bin/bash
|
||||
|
||||
cd ~/BootstrapAdmin
|
||||
git pull
|
||||
dotnet publish src/client/Bootstrap.Client -c Release
|
||||
|
||||
rm -f ~/BootstrapAdmin/src/client/Bootstrap.Client/bin/Release/netcoreapp2.2/publish/appsettings*.json
|
||||
systemctl stop ba.client
|
||||
\cp -fr ~/BootstrapAdmin/src/client/Bootstrap.Client/bin/Release/netcoreapp2.2/publish/* /usr/local/ba/client/
|
||||
systemctl start ba.client
|
||||
systemctl status ba.client -l
|
|
@ -1,11 +1,3 @@
|
|||
#! /bin/bash
|
||||
|
||||
cd ~/BootstrapAdmin
|
||||
git pull
|
||||
dotnet publish src/admin/Bootstrap.Admin -c Release
|
||||
|
||||
rm -f ~/BootstrapAdmin/src/admin/Bootstrap.Admin/bin/Release/netcoreapp2.2/publish/appsettings*.json
|
||||
systemctl stop ba.admin
|
||||
\cp -fr ~/BootstrapAdmin/src/admin/Bootstrap.Admin/bin/Release/netcoreapp2.2/publish/* /usr/local/ba/admin/
|
||||
systemctl start ba.admin
|
||||
systemctl status ba.admin
|
||||
|
|
|
@ -1,11 +1,3 @@
|
|||
#! /bin/bash
|
||||
|
||||
cd ~/BootstrapAdmin
|
||||
git pull
|
||||
dotnet publish src/client/Bootstrap.Client -c Release
|
||||
|
||||
rm -f ~/BootstrapAdmin/src/client/Bootstrap.Client/bin/Release/netcoreapp2.2/publish/appsettings*.json
|
||||
systemctl stop ba.client
|
||||
\cp -fr ~/BootstrapAdmin/src/client/Bootstrap.Client/bin/Release/netcoreapp2.2/publish/* /usr/local/ba/client/
|
||||
systemctl start ba.client
|
||||
systemctl status ba.client
|
||||
|
|
|
@ -14,6 +14,8 @@ using Microsoft.Extensions.Hosting;
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Unicode;
|
||||
|
||||
namespace Bootstrap.Admin
|
||||
{
|
||||
|
@ -43,7 +45,7 @@ namespace Bootstrap.Admin
|
|||
/// <param name="services"></param>
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
//services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All));
|
||||
services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All));
|
||||
services.Configure<CookiePolicyOptions>(options =>
|
||||
{
|
||||
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
|
||||
|
|
|
@ -87,6 +87,16 @@
|
|||
"Roles": [ "Default" ],
|
||||
"App": "2"
|
||||
},
|
||||
"WeChatOptions": {
|
||||
"Enabled": true,
|
||||
"ClientId": "<AppId>",
|
||||
"ClientSecret": "<secret>",
|
||||
"CallbackPath": "/signin-weixin",
|
||||
"HomePath": "/Admin/Profiles",
|
||||
"Scope": [ "snsapi_login" ],
|
||||
"Roles": [ "Default" ],
|
||||
"App": "0"
|
||||
},
|
||||
"SMSOptions": {
|
||||
"CompanyCode": "<CompanyCode>",
|
||||
"MD5Key": "MD5Key",
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Condition=" '$(TargetFramework)' == 'netcoreapp3.0' " Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Message Text="Copy db file -> $(TargetDir)" Importance="high" />
|
||||
<Copy Condition="'$(OS)' == 'Windows_NT'" DestinationFolder="$(TargetDir)" SourceFiles="$(MSBuildThisFileDirectory)..\src\admin\keys\Longbow.lic" SkipUnchangedFiles="true" />
|
||||
<Copy Condition="'$(OS)' == 'UNIX'" DestinationFolder="$(TargetDir)" SourceFiles="$(MSBuildThisFileDirectory)../src/admin/keys/Longbow.lic" SkipUnchangedFiles="true" />
|
||||
<Copy Condition="'$(OS)' == 'Windows_NT'" DestinationFolder="$(TargetDir)" SourceFiles="$(MSBuildThisFileDirectory)..\src\admin\Bootstrap.Admin\BootstrapAdmin.db" SkipUnchangedFiles="true" />
|
||||
<Copy Condition="'$(OS)' == 'UNIX'" DestinationFolder="$(TargetDir)" SourceFiles="$(MSBuildThisFileDirectory)../src/admin/Bootstrap.Admin/BootstrapAdmin.db" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
|
@ -1,5 +1,4 @@
|
|||
using Bootstrap.Admin.HealthChecks;
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
@ -8,8 +7,8 @@ using Microsoft.AspNetCore.Mvc.Testing;
|
|||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using UnitTest;
|
||||
using Xunit;
|
||||
|
@ -88,18 +87,19 @@ namespace Bootstrap.Admin.Api
|
|||
services.AddDbAdapter();
|
||||
var builder = services.AddHealthChecks();
|
||||
builder.AddCheck<DBHealthCheck>("db");
|
||||
services.AddMvcCore();
|
||||
services.AddControllers();
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
app.UseRouting();
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
context.User = new System.Security.Claims.ClaimsPrincipal(new System.Security.Principal.GenericIdentity("Argo"));
|
||||
await next();
|
||||
});
|
||||
app.UseHealthChecks("/Healths", new HealthCheckOptions()
|
||||
app.UseEndpoints(builder => builder.MapHealthChecks("/Healths", new HealthCheckOptions()
|
||||
{
|
||||
ResponseWriter = (context, report) =>
|
||||
{
|
||||
|
@ -112,8 +112,7 @@ namespace Bootstrap.Admin.Api
|
|||
[HealthStatus.Degraded] = StatusCodes.Status200OK,
|
||||
[HealthStatus.Unhealthy] = StatusCodes.Status200OK
|
||||
}
|
||||
});
|
||||
app.UseMvcWithDefaultRoute();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,6 +131,6 @@ namespace Bootstrap.Admin.Api
|
|||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected override IWebHostBuilder CreateWebHostBuilder() => WebHost.CreateDefaultBuilder<TStartup>(null);
|
||||
protected override IHostBuilder CreateHostBuilder() => Host.CreateDefaultBuilder().ConfigureWebHostDefaults(builder => builder.UseStartup<TStartup>());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Bootstrap.Admin.Controllers.SQLServer
|
||||
namespace Bootstrap.Admin.Controllers.SqlServer
|
||||
{
|
||||
public class HealthCheck : ControllerTest
|
||||
{
|
||||
|
|
Binary file not shown.
|
@ -37,10 +37,6 @@ namespace UnitTest
|
|||
{
|
||||
if (providerName == DatabaseProviderType.SQLite)
|
||||
{
|
||||
var dbPath = RetrievePath($"UnitTest{Path.DirectorySeparatorChar}DB{Path.DirectorySeparatorChar}UnitTest.db");
|
||||
var dbFile = Path.Combine(AppContext.BaseDirectory, "UnitTest.db");
|
||||
File.Copy(dbPath, dbFile, true);
|
||||
|
||||
builder.ConfigureAppConfiguration(app => app.AddInMemoryCollection(new KeyValuePair<string, string>[] {
|
||||
new KeyValuePair<string, string>("DB:0:Enabled", "false"),
|
||||
new KeyValuePair<string, string>("DB:1:Enabled", "true")
|
||||
|
|
|
@ -9,7 +9,11 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.msbuild" Version="2.7.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="1.1.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="3.0.0" />
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"Enabled": false,
|
||||
"ProviderName": "Sqlite",
|
||||
"ConnectionStrings": {
|
||||
"ba": "Data Source=UnitTest.db;"
|
||||
"ba": "Data Source=BootstrapAdmin.db;"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
@echo off
|
||||
|
||||
dotnet watch --project ./src/admin/Bootstrap.Admin run
|
||||
dotnet watch --project ./src/admin/Bootstrap.Admin run
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#! /bin/bash
|
||||
|
||||
dotnet watch --project ./src/admin/Bootstrap.Admin run
|
||||
dotnet watch --project ./src/admin/Bootstrap.Admin run
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
@echo off
|
||||
|
||||
dotnet watch --project ./src/client/Bootstrap.Client run
|
||||
dotnet watch --project ./src/client/Bootstrap.Client run
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#! /bin/bash
|
||||
|
||||
dotnet watch --project ./src/client/Bootstrap.Client run
|
||||
dotnet watch --project ./src/client/Bootstrap.Client run
|
||||
|
|
Loading…
Reference in New Issue