add publish-apps script
This commit is contained in:
parent
736b7f5042
commit
76e6d0279b
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
<Target Name="RunBrowserTests">
|
||||
<Message Text="Running TypeScript client Browser tests" Importance="high" />
|
||||
<Exec Command="npm run build" WorkingDirectory="$(RepositoryRoot)clients/ts/FunctionalTests" IgnoreStandardErrorWarningFormat="true" />
|
||||
<Exec Command="npm run ci-test -- --configuration $(Configuration)" WorkingDirectory="$(RepositoryRoot)clients/ts/FunctionalTests" IgnoreStandardErrorWarningFormat="true" />
|
||||
</Target>
|
||||
|
||||
|
|
@ -69,6 +68,8 @@
|
|||
<Target Name="BuildNPMPackages" DependsOnTargets="RestoreNpm;GetNpmArtifactInfo">
|
||||
<Message Text="Building %(NPMPackage.PackageId)..." Importance="high" />
|
||||
<Exec Command="npm run build" WorkingDirectory="%(NPMPackage.FullPath)" />
|
||||
<Message Text="Building Browser Functional Tests..." Importance="high" />
|
||||
<Exec Command="npm run build" WorkingDirectory="$(RepositoryRoot)clients/ts/FunctionalTests" IgnoreStandardErrorWarningFormat="true" />
|
||||
</Target>
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue