build: 增加appveyor CI&CD工具
This commit is contained in:
parent
6c57170e96
commit
f899dc0a07
|
@ -13,6 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bootstrap.Admin", "Bootstra
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{792A0B12-3F41-4BC4-A768-7D8D91C213B2}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
appveyor.yml = appveyor.yml
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
version: 1.0.{build}
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
image: Visual Studio 2017
|
||||
clone_depth: 1
|
||||
clone_folder: c:\Longbow\BootstrapAdmin
|
||||
init:
|
||||
- ps: dotnet --version
|
||||
environment:
|
||||
Appveyor: true
|
||||
services:
|
||||
- mssql2014
|
||||
- mysql
|
||||
- mongodb
|
||||
install:
|
||||
- ps: >-
|
||||
$PSVersionTable
|
||||
|
||||
#copy my.ini into mysql folder
|
||||
|
||||
$iniFile = "$($env:appveyor_build_folder)\DatabaseScripts\MySQL\my.ini"
|
||||
|
||||
xcopy $iniFile "C:\Program Files\MySQL\MySQL Server 5.7" /y
|
||||
build_script:
|
||||
- ps: >-
|
||||
$startPath = "$($env:appveyor_build_folder)\DatabaseScripts"
|
||||
|
||||
$sqlInstance = "(local)\SQL2014"
|
||||
|
||||
$outFile = "$($env:appveyor_build_folder)\DatabaseScripts\output.log"
|
||||
|
||||
|
||||
# init sqlserver database
|
||||
|
||||
$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"
|
||||
|
||||
|
||||
# init mysql database
|
||||
|
||||
$env:MYSQL_PWD="Password12!"
|
||||
|
||||
$mysql = "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql"
|
||||
|
||||
$cmd = '$mysql -e "create database BootstrapAdmin;" -uroot'
|
||||
|
||||
iex "& $cmd"
|
||||
|
||||
|
||||
cd "C:\Program Files\MySQL\MySQL Server 5.7\bin\"
|
||||
|
||||
$sqlFile = join-path $startPath "MySQL\Install.sql"
|
||||
|
||||
$cmd = "mysql -hlocalhost -uroot -DBootstrapAdmin < $sqlFile"
|
||||
|
||||
cmd.exe /c $cmd
|
||||
|
||||
|
||||
$initFile = join-path $startPath "MySQL\InitData.sql"
|
||||
|
||||
$cmd = "mysql -hlocalhost -uroot -DBootstrapAdmin < $initFile"
|
||||
|
||||
cmd.exe /c $cmd
|
||||
|
||||
|
||||
cd $($env:appveyor_build_folder)
|
||||
|
||||
dotnet build
|
||||
|
||||
dotnet publish Bootstrap.Admin --configuration Release --no-restore
|
||||
test_script:
|
||||
- ps: dotnet test UnitTest --no-restore --filter "FullyQualifiedName!~MongoDB"
|
||||
artifacts:
|
||||
- path: Bootstrap.Admin\bin\release\netcoreapp2.2\publish\
|
||||
name: BootstrapAdmin
|
||||
type: WebDeployPackage
|
||||
notifications:
|
||||
- provider: Email
|
||||
to:
|
||||
- argo@163.com
|
||||
subject: 'Appveyor Build {{status}}: {{projectName}} {{buildVersion}}'
|
||||
message: >-
|
||||
<div style="font-family:'Segoe UI',Arial,Sans-Serif;font-size:10pt;">
|
||||
{{#passed}}
|
||||
<h1 style="font-size: 150%;font-weight:normal; color:#078DC7;"><a href="{{buildUrl}}" style="color:#078DC7;">Build {{projectName}} {{buildVersion}} completed</a></h1>{{/passed}}
|
||||
{{#failed}}
|
||||
<h1 style="font-size: 150%;font-weight:normal; color:#ff3228;"><a href="{{buildUrl}}" style="color:#ff3228;">Build {{projectName}} {{buildVersion}} failed</a></h1>{{/failed}}
|
||||
<p style="color: #888;">
|
||||
Commit <a href="{{commitUrl}}">{{commitId}}</a> by <a href="mailto:{{commitAuthorEmail}}">{{commitAuthor}}</a> on {{commitDate}}:
|
||||
<br />
|
||||
<span style="font-size: 110%;color:#222;">{{commitMessage}}</span>
|
||||
</p>
|
||||
<p><a href="{{notificationSettingsUrl}}" style="font-size:85%;color:#999;">Configure your notification preferences</a></p>
|
||||
</div>
|
||||
on_build_success: true
|
||||
on_build_failure: true
|
||||
on_build_status_changed: false
|
Loading…
Reference in New Issue