diff --git a/build/publish-apps.ps1 b/build/publish-apps.ps1 new file mode 100644 index 0000000000..09531e26b3 --- /dev/null +++ b/build/publish-apps.ps1 @@ -0,0 +1,48 @@ +param($RootDirectory = (Get-Location), $Framework = "netcoreapp2.1", $Runtime = "win7-x64", $CommitHash, $BranchName, $BuildNumber) + +# De-Powershell the path +$RootDirectory = (Convert-Path $RootDirectory) + +# Find dotnet.exe +$dotnet = Join-Path (Join-Path (Join-Path $env:USERPROFILE ".dotnet") "x64") "dotnet.exe" + +if(!(Test-Path $dotnet)) { + throw "Could not find dotnet at: $dotnet" +} + +# Resolve directories +$SamplesDir = Join-Path $RootDirectory "samples" +$ArtifactsDir = Join-Path $RootDirectory "artifacts" +$AppsDir = Join-Path $ArtifactsDir "apps" +$ClientsDir = Join-Path $RootDirectory "clients" +$ClientsTsDir = Join-Path $ClientsDir "ts" + +# The list of apps to publish +$Apps = @{ + "SignalRSamples"= (Join-Path $SamplesDir "SignalRSamples") + "FunctionalTests"= (Join-Path $ClientsTsDir "FunctionalTests") +} + +$BuildMetadataContent = @" +[assembly: System.Reflection.AssemblyMetadata("CommitHash", "$($CommitHash)")] +[assembly: System.Reflection.AssemblyMetadata("BranchName", "$($BranchName)")] +[assembly: System.Reflection.AssemblyMetadata("BuildNumber", "$($BuildNumber)")] +[assembly: System.Reflection.AssemblyMetadata("BuildDateUtc", "$([DateTime]::UtcNow.ToString("O"))")] +"@ + +$Apps.Keys | ForEach-Object { + $Name = $_ + $Path = $Apps[$_] + + $OutputDir = Join-Path $AppsDir $Name + + # Hacky but it works for now + $MetadataPath = Join-Path $Path "BuildMetadata.cs" + $BuildMetadataContent > $MetadataPath + try { + Write-Host -ForegroundColor Green "Publishing $Name" + & "$dotnet" publish --framework $Framework --runtime $Runtime --output $OutputDir $Path + } finally { + Remove-Item $MetadataPath + } +} \ No newline at end of file diff --git a/build/repo.targets b/build/repo.targets index 597cb3fa0f..d1a4d80700 100644 --- a/build/repo.targets +++ b/build/repo.targets @@ -33,7 +33,6 @@ - @@ -69,6 +68,8 @@ + + diff --git a/test/Microsoft.AspNetCore.SignalR.Redis.Tests/SkipIfDockerNotPresentAttribute.cs b/test/Microsoft.AspNetCore.SignalR.Redis.Tests/SkipIfDockerNotPresentAttribute.cs index 3df0d769a7..b42e3f0778 100644 --- a/test/Microsoft.AspNetCore.SignalR.Redis.Tests/SkipIfDockerNotPresentAttribute.cs +++ b/test/Microsoft.AspNetCore.SignalR.Redis.Tests/SkipIfDockerNotPresentAttribute.cs @@ -11,16 +11,31 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests { public bool IsMet => CheckDocker(); public string SkipReason { get; private set; } = "Docker is not available"; + public string RequiredOsType { get; } + + public SkipIfDockerNotPresentAttribute() : this("linux") + { + + } + + public SkipIfDockerNotPresentAttribute(string requiredOSType) + { + RequiredOsType = requiredOSType; + } private bool CheckDocker() { if(Docker.Default != null) { // Docker is present, but is it working? - if (Docker.Default.RunCommand("ps", out var output) != 0) + if (Docker.Default.RunCommand("info -f {{.OSType}}", out var output) != 0) { SkipReason = $"Failed to invoke test command 'docker ps'. Output: {output}"; } + else if (!string.Equals(output.Trim(), RequiredOsType, StringComparison.Ordinal)) + { + SkipReason = $"Docker tests do not support the OS type '{output.Trim()}', they require '{RequiredOsType}'."; + } else { // We have a docker