Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit 30389ae

Browse files
Improve build scripts (#146 closes #142, #143, #144, #145)
- Restore NuGet packages on pack - Skip build on branches with an active PR - Make AppVeyor failing builds red - Make tag builds fail on no recent tag - Upgrade to latest .NET SDK
1 parent 93f6a77 commit 30389ae

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ matrix:
44
- os: linux
55
dist: trusty
66
mono: latest
7-
dotnet: 2.1.3
7+
dotnet: 2.1.201
88
sudo: required
99
env: MONO_BASE_PATH=/usr/lib/mono/
1010
- os: osx
1111
osx_image: xcode9.2
1212
mono: latest
13-
dotnet: 2.1.3
13+
dotnet: 2.1.201
1414
sudo: required
1515
env: MONO_BASE_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/
1616
before_install:
@@ -20,13 +20,15 @@ before_install:
2020
fi
2121
DOTNET_INSTALL_DIR="$PWD/.dotnetsdk"
2222
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version "1.1.9" --install-dir "$DOTNET_INSTALL_DIR" --no-path
23-
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version "2.1.200" --install-dir "$DOTNET_INSTALL_DIR" --no-path
23+
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version "2.1.201" --install-dir "$DOTNET_INSTALL_DIR" --no-path
24+
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version "2.1.301" --install-dir "$DOTNET_INSTALL_DIR" --no-path
2425
export PATH="$DOTNET_INSTALL_DIR:$PATH"
2526
script:
2627
- |
2728
mostRecentTag=$(git describe --abbrev=0 --tags --always)
2829
if [[ $mostRecentTag != v* ]]; then
2930
mostRecentTag='v1.0.0'
31+
if [[ "${TRAVIS_TAG}" != "" ]]; then exit 1; fi
3032
fi
3133
mostRecentVersion=$(echo "$mostRecentTag" | cut -c 2-)
3234
FrameworkPathOverride=$MONO_BASE_PATH/4.5.2-api/ $(pwd)/tools/build.sh '--target=Test' "--softwareVersion=$mostRecentVersion" "--buildNumber=$TRAVIS_BUILD_NUMBER"

appveyor.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,26 @@ install:
44
- ps: |
55
$DOTNET_INSTALL_DIR = $(Join-Path (Get-Location) 'dotnetsdk')
66
powershell -NoProfile -ExecutionPolicy Unrestricted -Command "&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version 1.1.9 -InstallDir $DOTNET_INSTALL_DIR -NoPath"
7-
powershell -NoProfile -ExecutionPolicy Unrestricted -Command "&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version 2.1.200 -InstallDir $DOTNET_INSTALL_DIR -NoPath"
7+
powershell -NoProfile -ExecutionPolicy Unrestricted -Command "&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version 2.1.201 -InstallDir $DOTNET_INSTALL_DIR -NoPath"
8+
powershell -NoProfile -ExecutionPolicy Unrestricted -Command "&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version 2.1.301 -InstallDir $DOTNET_INSTALL_DIR -NoPath"
89
$env:Path = "$DOTNET_INSTALL_DIR;$env:Path"
910
before_build:
1011
- ps: |
1112
$mostRecentTag = git describe --abbrev=0 --tags --always
1213
if ($mostRecentTag.Substring(0, 1) -ne 'v') {
1314
$mostRecentTag = 'v1.0.0'
15+
if ($env:APPVEYOR_REPO_TAG -eq 'true') { exit 1 }
1416
}
1517
$mostRecentVersion = $mostRecentTag.Substring(1)
1618
$currentCommitHash = git rev-parse --short HEAD
1719
Set-AppveyorBuildVariable -Name SW_VER -Value $mostRecentVersion
1820
Update-AppveyorBuild -Version "Build $env:APPVEYOR_BUILD_NUMBER - Commit $currentCommitHash - Tag v$env:SW_VER"
21+
skip_branch_with_pr: true
1922
build_script:
2023
- ps: |
2124
$additionalArgs = if ($env:APPVEYOR_REPO_TAG -ne 'true') { "--buildNumber=$env:APPVEYOR_BUILD_NUMBER" }
2225
.\tools\build.ps1 '--target=Pack' "--softwareVersion=$env:SW_VER" $additionalArgs
26+
if ($LastExitCode -ne 0) { exit $LastExitCode }
2327
test: off
2428
artifacts:
2529
- path: tools\artifacts\*.nupkg

tools/build.cake

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,25 @@ Task("Clean")
104104
}
105105
});
106106

107+
Task("RestorePackages")
108+
.Does(() =>
109+
{
110+
var toRestoreProjects = childDirInfos
111+
.Except(toBuildDirInfo)
112+
.SelectMany(x => x.GetFiles("*.csproj"))
113+
.Select(x => x.FullName)
114+
.ToList();
115+
116+
var deleteDirectorySettings = new DeleteDirectorySettings
117+
{
118+
Recursive = true,
119+
Force = true
120+
};
121+
122+
foreach (var projectToRestore in toRestoreProjects)
123+
DotNetCoreRestore(projectToRestore);
124+
});
125+
107126
Task("Build")
108127
.IsDependentOn("MSBuildSettings")
109128
.Does(() =>
@@ -144,6 +163,7 @@ Task("Test")
144163
});
145164

146165
Task("Pack")
166+
.IsDependentOn("RestorePackages")
147167
.IsDependentOn("Test")
148168
.Does(() =>
149169
{

0 commit comments

Comments
 (0)