From a5f3b75dfef3fa12f8ff8acb7254eadc1c878182 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 29 Sep 2019 11:01:25 +0800 Subject: [PATCH 1/3] =?UTF-8?q?build:=20=E6=A0=BC=E5=BC=8F=E5=8C=96shell?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 4 ++++ BootstrapAdmin.sln | 2 ++ Directory.Build.props | 5 +++-- deploy-admin.sh | 11 +++++++++++ deploy-client.sh | 11 +++++++++++ publish-admin.sh | 8 -------- publish-client.sh | 8 -------- watch-run-admin.cmd | 2 +- watch-run-admin.sh | 2 +- watch-run-client.cmd | 2 +- watch-run-client.sh | 2 +- 11 files changed, 35 insertions(+), 22 deletions(-) create mode 100644 deploy-admin.sh create mode 100644 deploy-client.sh diff --git a/.editorconfig b/.editorconfig index 6cfb4760..4db563b4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/BootstrapAdmin.sln b/BootstrapAdmin.sln index 637d32d9..11a708d1 100644 --- a/BootstrapAdmin.sln +++ b/BootstrapAdmin.sln @@ -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 diff --git a/Directory.Build.props b/Directory.Build.props index d54c233a..5a6cc485 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,4 +1,5 @@  + Longbow Argo Zhang(argo@163.com) @@ -11,9 +12,9 @@ - - + + diff --git a/deploy-admin.sh b/deploy-admin.sh new file mode 100644 index 00000000..746df40a --- /dev/null +++ b/deploy-admin.sh @@ -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 diff --git a/deploy-client.sh b/deploy-client.sh new file mode 100644 index 00000000..8c6ea577 --- /dev/null +++ b/deploy-client.sh @@ -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 diff --git a/publish-admin.sh b/publish-admin.sh index 00fe27b0..08200ca8 100644 --- a/publish-admin.sh +++ b/publish-admin.sh @@ -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 diff --git a/publish-client.sh b/publish-client.sh index ad926b27..130ba9b0 100644 --- a/publish-client.sh +++ b/publish-client.sh @@ -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 diff --git a/watch-run-admin.cmd b/watch-run-admin.cmd index 782c6476..571158d4 100644 --- a/watch-run-admin.cmd +++ b/watch-run-admin.cmd @@ -1,3 +1,3 @@ @echo off -dotnet watch --project ./src/admin/Bootstrap.Admin run \ No newline at end of file +dotnet watch --project ./src/admin/Bootstrap.Admin run diff --git a/watch-run-admin.sh b/watch-run-admin.sh index fa427aef..f6aa9f20 100644 --- a/watch-run-admin.sh +++ b/watch-run-admin.sh @@ -1,3 +1,3 @@ #! /bin/bash -dotnet watch --project ./src/admin/Bootstrap.Admin run \ No newline at end of file +dotnet watch --project ./src/admin/Bootstrap.Admin run diff --git a/watch-run-client.cmd b/watch-run-client.cmd index ce983821..058db3e7 100644 --- a/watch-run-client.cmd +++ b/watch-run-client.cmd @@ -1,3 +1,3 @@ @echo off -dotnet watch --project ./src/client/Bootstrap.Client run \ No newline at end of file +dotnet watch --project ./src/client/Bootstrap.Client run diff --git a/watch-run-client.sh b/watch-run-client.sh index 87a84eec..0457f727 100644 --- a/watch-run-client.sh +++ b/watch-run-client.sh @@ -1,3 +1,3 @@ #! /bin/bash -dotnet watch --project ./src/client/Bootstrap.Client run \ No newline at end of file +dotnet watch --project ./src/client/Bootstrap.Client run From 14c2bebc3bc4d924eb1613ebf6d933259404313c Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 28 Sep 2019 21:20:47 +0800 Subject: [PATCH 2/3] =?UTF-8?q?build:=20=E6=9B=B4=E6=96=B0=20CI=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96=E8=84=9A=E6=9C=AC=E6=94=AF=E6=8C=81?= =?UTF-8?q?=20NETCore=203.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appveyor.test.ps1 | 39 +++++++++++++++++++++------------------ appveyor.yml | 11 ++++------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/appveyor.test.ps1 b/appveyor.test.ps1 index db415d0d..2937f058 100644 --- a/appveyor.test.ps1 +++ b/appveyor.test.ps1 @@ -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 /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 \ No newline at end of file +$branch = $($env:APPVEYOR_REPO_BRANCH) +if ($branch -ne "dev") { + installDB + coverallUnitTest + codecovUnitTest +} diff --git a/appveyor.yml b/appveyor.yml index 60b317a3..4c47dee9 100644 --- a/appveyor.yml +++ b/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 From 169632fb82490d62b08bb5cb6d57b35a73e9280f Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 29 Sep 2019 15:39:11 +0800 Subject: [PATCH 3/3] =?UTF-8?q?build:=20=E6=9A=82=E6=97=B6=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=AF=B9=20api=20=E7=9A=84=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #Comment json.net 反序列化不支持泛型,暂时先不运行 api 相关单元测试 --- appveyor.test.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.test.ps1 b/appveyor.test.ps1 index 2937f058..ab5353bc 100644 --- a/appveyor.test.ps1 +++ b/appveyor.test.ps1 @@ -38,7 +38,7 @@ function runUnitTest() { write-host "dotnet test test\UnitTest" -ForegroundColor Cyan - dotnet test test\UnitTest --filter FullyQualifiedName!~MySql /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() {