Add Ubuntu target to AppVeyor CI build (#1149)
* Target Ubuntu in Appveyor CI build AppVeyor has released support for targetting Ubuntu 18.04 environments. This adds Ubuntu to the list of build images for Appveyor to use. * Set clone folder to use appveyor defaults * Check if appveyor provides appveyor-retry by trying to run it * Minor syntax change * Minor syntax change * Skip using appveyor-retry (for now) * Use forward slash for paths so that it works on both windows and linux * Implement replacement for appveyor-retry * Script cleanup * Remove commented out line * Only package releases on Windows * Add the isWindows condition to the deploy stage
This commit is contained in:
committed by
Christopher F
parent
232f525b59
commit
674a0fc5dd
63
appveyor.yml
63
appveyor.yml
@@ -2,13 +2,17 @@ version: build-{build}
|
|||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- dev
|
- dev
|
||||||
image: Visual Studio 2017
|
image:
|
||||||
|
- Visual Studio 2017
|
||||||
|
- Ubuntu
|
||||||
|
|
||||||
nuget:
|
nuget:
|
||||||
disable_publish_on_pr: true
|
disable_publish_on_pr: true
|
||||||
pull_requests:
|
pull_requests:
|
||||||
do_not_increment_build_number: true
|
do_not_increment_build_number: true
|
||||||
clone_folder: C:\Projects\Discord.Net
|
# Use the default clone_folder
|
||||||
|
# Windows: C:\Projects\discord-net
|
||||||
|
# Ubuntu: /home/appveyor/projects/discord-net
|
||||||
cache: test/Discord.Net.Tests/cache.db
|
cache: test/Discord.Net.Tests/cache.db
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
@@ -20,23 +24,50 @@ init:
|
|||||||
- ps: $Env:BUILD = "$($Env:APPVEYOR_BUILD_NUMBER.PadLeft(5, "0"))"
|
- ps: $Env:BUILD = "$($Env:APPVEYOR_BUILD_NUMBER.PadLeft(5, "0"))"
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- ps: appveyor-retry dotnet restore Discord.Net.sln -v Minimal /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
- ps: >-
|
||||||
|
if ($isLinux)
|
||||||
|
{
|
||||||
|
# AppVeyor Linux images do not have appveyor-retry, which retries the commands a few times
|
||||||
|
# until the command exits with code 0.
|
||||||
|
# So, this is done with a short script.
|
||||||
|
$code = 0
|
||||||
|
$counter = 0
|
||||||
|
do
|
||||||
|
{
|
||||||
|
dotnet restore Discord.Net.sln -v Minimal /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
||||||
|
$code = $LASTEXITCODE
|
||||||
|
$counter++
|
||||||
|
if ($code -ne 0)
|
||||||
|
{
|
||||||
|
# Wait 5s before attempting to run again
|
||||||
|
Start-sleep -Seconds 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
until ($counter -eq 5 -or $code -eq 0)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
appveyor-retry dotnet restore Discord.Net.sln -v Minimal /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
||||||
|
}
|
||||||
- ps: dotnet build Discord.Net.sln -c "Release" /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
- ps: dotnet build Discord.Net.sln -c "Release" /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
||||||
after_build:
|
after_build:
|
||||||
- ps: dotnet pack "src\Discord.Net.Core\Discord.Net.Core.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.Core\Discord.Net.Core.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
|
||||||
- ps: dotnet pack "src\Discord.Net.Rest\Discord.Net.Rest.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.Rest\Discord.Net.Rest.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
|
||||||
- ps: dotnet pack "src\Discord.Net.WebSocket\Discord.Net.WebSocket.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.WebSocket\Discord.Net.WebSocket.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
|
||||||
- ps: dotnet pack "src\Discord.Net.Commands\Discord.Net.Commands.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.Commands\Discord.Net.Commands.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
|
||||||
- ps: dotnet pack "src\Discord.Net.Webhook\Discord.Net.Webhook.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.Webhook\Discord.Net.Webhook.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
|
||||||
- ps: dotnet pack "src\Discord.Net.Providers.WS4Net\Discord.Net.Providers.WS4Net.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.Providers.WS4Net\Discord.Net.Providers.WS4Net.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
|
||||||
- ps: dotnet pack "src\Discord.Net.Analyzers\Discord.Net.Analyzers.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.Analyzers\Discord.Net.Analyzers.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
|
||||||
- ps: >-
|
- ps: >-
|
||||||
if ($Env:APPVEYOR_REPO_TAG -eq "true") {
|
if ($isWindows)
|
||||||
nuget pack src\Discord.Net\Discord.Net.nuspec -OutputDirectory "artifacts" -properties suffix=""
|
{
|
||||||
} else {
|
if ($Env:APPVEYOR_REPO_TAG -eq "true") {
|
||||||
nuget pack src\Discord.Net\Discord.Net.nuspec -OutputDirectory "artifacts" -properties suffix="-$Env:BUILD"
|
nuget pack src/Discord.Net/Discord.Net.nuspec -OutputDirectory "artifacts" -properties suffix=""
|
||||||
|
} else {
|
||||||
|
nuget pack src/Discord.Net/Discord.Net.nuspec -OutputDirectory "artifacts" -properties suffix="-$Env:BUILD"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
- ps: Get-ChildItem artifacts\*.nupkg | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
|
- ps: if ($isWindows) { Get-ChildItem artifacts/*.nupkg | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } }
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- ps: >-
|
- ps: >-
|
||||||
@@ -52,6 +83,7 @@ deploy:
|
|||||||
symbol_server: https://www.myget.org/F/discord-net/symbols/api/v2/package
|
symbol_server: https://www.myget.org/F/discord-net/symbols/api/v2/package
|
||||||
on:
|
on:
|
||||||
branch: dev
|
branch: dev
|
||||||
|
isWindows: True
|
||||||
- provider: NuGet
|
- provider: NuGet
|
||||||
server: https://www.myget.org/F/rogueexception/api/v2/package
|
server: https://www.myget.org/F/rogueexception/api/v2/package
|
||||||
api_key:
|
api_key:
|
||||||
@@ -59,3 +91,4 @@ deploy:
|
|||||||
symbol_server: https://www.myget.org/F/rogueexception/symbols/api/v2/package
|
symbol_server: https://www.myget.org/F/rogueexception/symbols/api/v2/package
|
||||||
on:
|
on:
|
||||||
branch: dev
|
branch: dev
|
||||||
|
isWindows: True
|
||||||
|
|||||||
Reference in New Issue
Block a user