Skip to content

Commit e20bbd4

Browse files
committed
Add appveyor build
1 parent 88058f7 commit e20bbd4

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

appveyor.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: '{build}'
2+
pull_requests:
3+
do_not_increment_build_number: true
4+
image: Visual Studio 2017
5+
nuget:
6+
disable_publish_on_pr: true
7+
build_script:
8+
- ps: .\Build.ps1
9+
test: off
10+
artifacts:
11+
- path: .\artifacts\*.nupkg
12+
name: NuGet
13+
deploy:
14+
- provider: NuGet
15+
server: https://www.myget.org/F/xabaril/api/v2/package
16+
api_key:
17+
secure: JCTBs2rhU7P11G6ZbxDKOuQoyIKhILGcaKtILxCDwdVlnzvvaXc92nNXQlVsR7u0
18+
skip_symbols: true
19+
on:
20+
branch: master
21+
- provider: NuGet
22+
name: production
23+
api_key:
24+
secure: 44bohP+05nCVBsZvK3tklX4yK8Rwi7vWRKTj1sMI1V26twqZJayTtRxv0fLF1t2o
25+
on:
26+
appveyor_repo_tag: true

build.ps1

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Taken from psake https://github.com/psake/psake
2+
3+
<#
4+
.SYNOPSIS
5+
This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
6+
to see if an error occcured. If an error is detected then an exception is thrown.
7+
This function allows you to run command-line programs without having to
8+
explicitly check the $lastexitcode variable.
9+
.EXAMPLE
10+
exec { svn info $repository_trunk } "Error executing SVN. Please verify SVN command-line client is installed"
11+
#>
12+
function Exec
13+
{
14+
[CmdletBinding()]
15+
param(
16+
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
17+
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
18+
)
19+
& $cmd
20+
if ($lastexitcode -ne 0) {
21+
throw ("Exec: " + $errorMessage)
22+
}
23+
}
24+
25+
if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }
26+
27+
exec { & dotnet restore }
28+
29+
$tag = $(git tag -l --points-at HEAD)
30+
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
31+
$suffix = @{ $true = ""; $false = "ci-$revision"}[$tag -ne $NULL -and $revision -ne "local"]
32+
$commitHash = $(git rev-parse --short HEAD)
33+
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
34+
35+
echo "build: Tag is $tag"
36+
echo "build: Package version suffix is $suffix"
37+
echo "build: Build version suffix is $buildSuffix"
38+
39+
exec { & dotnet build JWTSimpleServer.sln -c Release --version-suffix=$buildSuffix -v q /nologo }
40+
41+
echo "running tests"
42+
43+
try {
44+
45+
Push-Location -Path .\tests\UnitTests
46+
47+
exec { & dotnet xunit -configuration Release --fx-version 2.0.0 }
48+
} finally {
49+
Pop-Location
50+
}
51+
52+
try {
53+
54+
Push-Location -Path .\tests\FunctionalTests
55+
56+
exec { & dotnet xunit -configuration Release --fx-version 2.0.0 }
57+
} finally {
58+
Pop-Location
59+
}
60+
61+
62+
if ($suffix -eq "") {
63+
exec { & dotnet pack .\src\JWTSimpleServer\JWTSimpleServer.csproj -c Release -o ..\..\artifacts --include-symbols --no-build }
64+
exec { & dotnet pack .\src\JWTSimpleServer.EntityFrameworkCoreRefreshTokenStore\JWTSimpleServer.EntityFrameworkCoreRefreshTokenStore.csproj -c Release -o ..\..\artifacts --include-symbols --no-build }
65+
exec { & dotnet pack .\src\JWTSimpleServer.InMemoryRefreshTokenStore\JWTSimpleServer.InMemoryRefreshTokenStore.csproj -c Release -o ..\..\artifacts --include-symbols --no-build }
66+
exec { & dotnet pack .\src\JWTSimpleServer.MessagePackRefreshTokenStore\JWTSimpleServer.MessagePackRefreshTokenStore.csproj -c Release -o ..\..\artifacts --include-symbols --no-build }
67+
exec { & dotnet pack .\src\JWTSimpleServer.RedisDistributedRefreshTokenStore\JWTSimpleServer.RedisDistributedRefreshTokenStore.csproj -c Release -o ..\..\artifacts --include-symbols --no-build }
68+
} else {
69+
exec { & dotnet pack .\src\JWTSimpleServer\JWTSimpleServer.csproj -c Release -o ..\..\artifacts --include-symbols --no-build --version-suffix=$suffix }
70+
exec { & dotnet pack .\src\JWTSimpleServer.EntityFrameworkCoreRefreshTokenStore\JWTSimpleServer.EntityFrameworkCoreRefreshTokenStore.csproj -c Release -o ..\..\artifacts --include-symbols --no-build --version-suffix=$suffix }
71+
exec { & dotnet pack .\src\JWTSimpleServer.InMemoryRefreshTokenStore\JWTSimpleServer.InMemoryRefreshTokenStore.csproj -c Release -o ..\..\artifacts --include-symbols --no-build --version-suffix=$suffix }
72+
exec { & dotnet pack .\src\JWTSimpleServer.MessagePackRefreshTokenStore\JWTSimpleServer.MessagePackRefreshTokenStore.csproj -c Release -o ..\..\artifacts --include-symbols --no-build --version-suffix=$suffix }
73+
exec { & dotnet pack .\src\JWTSimpleServer.RedisDistributedRefreshTokenStore\JWTSimpleServer.RedisDistributedRefreshTokenStore.csproj -c Release -o ..\..\artifacts --include-symbols --no-build --version-suffix=$suffix }
74+
}
75+

0 commit comments

Comments
 (0)