Skip to content

[WIP] Run Tests Against Multiple Versions of ASP.Net and EF Core #302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
30 changes: 30 additions & 0 deletions 2.0.1.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project>
<PropertyGroup>
<NetCoreAppVersion>netcoreapp2.0</NetCoreAppVersion>
<NetStandardVersion>netstandard2.0</NetStandardVersion>

<AspNetCoreVersion>2.0.1</AspNetCoreVersion>

<MicrosoftLoggingVersion>2.0.0</MicrosoftLoggingVersion>
<MicrosoftConfigurationVersion>2.0.0</MicrosoftConfigurationVersion>
<MicrosoftOptionsVersion>2.0.0</MicrosoftOptionsVersion>

<EFCoreVersion>2.0.1</EFCoreVersion>
<EFCoreToolsVersion>2.0.1</EFCoreToolsVersion>

<NpgsqlVersion>3.2.6</NpgsqlVersion>
<NpgsqlPostgreSQLVersion>2.0.0</NpgsqlPostgreSQLVersion>

<TuplesVersion>4.4.0</TuplesVersion>
</PropertyGroup>

<!-- Test Project Dependencies -->
<PropertyGroup>
<TestSdkVersion>15.3.0-preview-20170427-09</TestSdkVersion>
<TestHostVersion>1.1.2</TestHostVersion>
<XUnitVersion>2.3.0-beta3-build3705</XUnitVersion>
<BogusVersion>15.0.3</BogusVersion>
<MoqVersion>4.7.99</MoqVersion>
</PropertyGroup>

</Project>
33 changes: 33 additions & 0 deletions 2.1.0.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project>
<PropertyGroup>
<DefineConstants>DEPS_2_1_0</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<NetCoreAppVersion>netcoreapp2.0</NetCoreAppVersion>
<NetStandardVersion>netstandard2.0</NetStandardVersion>

<AspNetCoreVersion>2.1.0</AspNetCoreVersion>

<MicrosoftLoggingVersion>2.1.0</MicrosoftLoggingVersion>
<MicrosoftConfigurationVersion>2.1.0</MicrosoftConfigurationVersion>
<MicrosoftOptionsVersion>2.1.0</MicrosoftOptionsVersion>

<EFCoreVersion>2.1.0</EFCoreVersion>
<EFCoreToolsVersion>2.1.0</EFCoreToolsVersion>

<NpgsqlVersion>4.0.0</NpgsqlVersion>
<NpgsqlPostgreSQLVersion>2.1.0</NpgsqlPostgreSQLVersion>

<TuplesVersion>4.5.0</TuplesVersion>
</PropertyGroup>

<!-- Test Project Dependencies -->
<PropertyGroup>
<TestSdkVersion>15.7.2</TestSdkVersion>
<XUnitVersion>2.3.1</XUnitVersion>
<BogusVersion>22.1.2</BogusVersion>
<MoqVersion>4.8.3</MoqVersion>
</PropertyGroup>

</Project>
98 changes: 55 additions & 43 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -1,63 +1,75 @@
# Gets the version suffix from the repo tag
# example: v1.0.0-preview1-final => preview1-final
function Get-Version-Suffix-From-Tag
{
$tag=$env:APPVEYOR_REPO_TAG_NAME
$split=$tag -split "-"
$suffix=$split[1..2]
$final=$suffix -join "-"
return $final
function Get-Version-Suffix-From-Tag {
$tag = $env:APPVEYOR_REPO_TAG_NAME
$split = $tag -split "-"
$suffix = $split[1..2]
$final = $suffix -join "-"
return $final
}

function CheckLastExitCode {
param ([int[]]$SuccessCodes = @(0), [scriptblock]$CleanupScript=$null)
param ([string]$Command, [int[]]$SuccessCodes = @(0), [scriptblock]$CleanupScript = $null)

if ($SuccessCodes -notcontains $LastExitCode) {
$msg = "EXE RETURNED EXIT CODE $LastExitCode"
throw $msg
throw "$Command exited with $LastExitCode"
}
}

$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
$revision = "{0:D4}" -f [convert]::ToInt32($revision, 10)

dotnet restore

dotnet test ./test/UnitTests/UnitTests.csproj
CheckLastExitCode
function Run($exp) {
Invoke-Expression $exp
CheckLastExitCode $exp
}

dotnet test ./test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj
CheckLastExitCode
function BuildVersion($version) {
Write-Output "Testing project against ASP.Net Core $version"
$msBuildParams = "/p:TestProjectDependencyVersions=$version /p:NoWarn=NU1605 /v:minimal"

dotnet test ./test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
CheckLastExitCode
Run "dotnet restore $msBuildParams"
Run "dotnet msbuild $msBuildParams"
Run "dotnet test ./test/UnitTests/UnitTests.csproj --no-build $msBuildParams"
Run "dotnet test ./test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj --no-build $msBuildParams"
Run "dotnet test ./test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj --no-build $msBuildParams"
Run "dotnet test ./test/OperationsExampleTests/OperationsExampleTests.csproj --no-build $msBuildParams"
}

dotnet test ./test/OperationsExampleTests/OperationsExampleTests.csproj
CheckLastExitCode
function Test() {
$supportedVersions = @("2.0.1", "2.1.0")
foreach ($version in $supportedVersions) {
BuildVersion $version
}
}

dotnet build .\src\JsonApiDotNetCore -c Release
CheckLastExitCode
function Build() {
Run "dotnet restore .\src\JsonApiDotNetCore"
Run "dotnet build .\src\JsonApiDotNetCore -c Release"
}

Write-Output "APPVEYOR_REPO_TAG: $env:APPVEYOR_REPO_TAG"
function Pack() {
Write-Output "APPVEYOR_REPO_TAG: $env:APPVEYOR_REPO_TAG"

If($env:APPVEYOR_REPO_TAG -eq $true) {
$revision = Get-Version-Suffix-From-Tag
Write-Output "VERSION-SUFFIX: $revision"
$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
$revision = "{0:D4}" -f [convert]::ToInt32($revision, 10)
If ($env:APPVEYOR_REPO_TAG -eq $true) {
$revision = Get-Version-Suffix-From-Tag
Write-Output "VERSION-SUFFIX: $revision"

IF ([string]::IsNullOrWhitespace($revision)){
Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts"
dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts
CheckLastExitCode
IF ([string]::IsNullOrWhitespace($revision)) {
Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts"
Run "dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts"
}
Else {
Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$revision"
Run "dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$revision"
}
}
Else {
Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$revision"
dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$revision
CheckLastExitCode
Else {
Write-Output "VERSION-SUFFIX: alpha1-$revision"
Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=alpha1-$revision"
Run "dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=alpha1-$revision"
}
}
Else {
Write-Output "VERSION-SUFFIX: alpha1-$revision"
Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=alpha1-$revision"
dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=alpha1-$revision
CheckLastExitCode
}

Test
Build
Pack
31 changes: 2 additions & 29 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,31 +1,4 @@
<Project>

<PropertyGroup>
<NetCoreAppVersion>netcoreapp2.0</NetCoreAppVersion>
<NetStandardVersion>netstandard2.0</NetStandardVersion>

<AspNetCoreVersion>2.0.1</AspNetCoreVersion>

<MicrosoftLoggingVersion>2.0.0</MicrosoftLoggingVersion>
<MicrosoftConfigurationVersion>2.0.0</MicrosoftConfigurationVersion>
<MicrosoftOptionsVersion>2.0.0</MicrosoftOptionsVersion>

<EFCoreVersion>2.0.1</EFCoreVersion>
<EFCoreToolsVersion>2.0.1</EFCoreToolsVersion>

<NpgsqlVersion>3.2.6</NpgsqlVersion>
<NpgsqlPostgreSQLVersion>2.0.0</NpgsqlPostgreSQLVersion>

<TuplesVersion>4.4.0</TuplesVersion>
</PropertyGroup>

<!-- Test Project Dependencies -->
<PropertyGroup>
<TestSdkVersion>15.3.0-preview-20170427-09</TestSdkVersion>
<TestHostVersion>1.1.2</TestHostVersion>
<XUnitVersion>2.3.0-beta3-build3705</XUnitVersion>
<BogusVersion>15.0.3</BogusVersion>
<MoqVersion>4.7.99</MoqVersion>
</PropertyGroup>

<!-- props file for primary package -->
<Import Project="2.0.1.props" />
</Project>
2 changes: 2 additions & 0 deletions JsonApiDotnetCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
.travis.yml = .travis.yml
2.0.1.props = 2.0.1.props
2.1.0.props = 2.1.0.props
appveyor.yml = appveyor.yml
Build.ps1 = Build.ps1
build.sh = build.sh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<Import Condition="'$(TestProjectDependencyVersions)'!=''" Project="../../../$(TestProjectDependencyVersions).props" />

<PropertyGroup>
<TargetFramework>$(NetCoreAppVersion)</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
Expand Down

This file was deleted.

Loading