diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d60323b418..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: csharp -os: - - linux -dist: trusty -osx_image: xcode8.3 -env: - global: - - DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - - DOTNET_CLI_TELEMETRY_OPTOUT=1 -mono: - - 5.2.0 -dotnet: 2.1.200 -script: - - sudo apt-get update - - sudo apt-get install castxml - - ./build.sh --target "CiTravis" --configuration "Release" -notifications: - email: false - webhooks: - urls: - - https://webhooks.gitter.im/e/98f653320ef2b7506c05 - on_success: change - on_failure: always - on_start: never diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 8694495e66..0000000000 --- a/appveyor.yml +++ /dev/null @@ -1,23 +0,0 @@ -os: Visual Studio 2017 -skip_branch_with_pr: true -configuration: -- Release -environment: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - NUGET_API_URL: https://www.nuget.org/api/v2/package - MYGET_API_KEY: - secure: OtVfyN3ErqQrDTnWH2HDfJDlCiu/i4/X4wFmK3ZXXP7HmCiXYPSbTjMPwwdOxRaK - MYGET_API_URL: https://www.myget.org/F/avalonia-ci/api/v2/package -init: -- ps: if (Test-Path env:nuget_address) {[System.IO.File]::AppendAllText("C:\Windows\System32\drivers\etc\hosts", "`n$($env:nuget_address)`tapi.nuget.org")} -before_build: -- git submodule update --init -build_script: -- ps: .\build.ps1 --target "CiAppVeyor" --configuration "$env:configuration" - -test: off -artifacts: - - path: artifacts\nuget\*.nupkg - - path: artifacts\zip\*.zip - - path: artifacts\inspectcode.xml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dec361affe..8c5380e65e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -22,7 +22,7 @@ jobs: export PATH="$PATH:$HOME/.dotnet/tools" dotnet --info printenv - nuke --target="CiAzureLinux" --configuration="Release" + nuke --target CiAzureLinux --configuration=Release - task: PublishTestResults@2 inputs: @@ -71,7 +71,7 @@ jobs: export PATH="$PATH:$HOME/.dotnet/tools" dotnet --info printenv - nuke --target="CiAzureOSX" --configuration="Release" + nuke --target CiAzureOSX --configuration Release - task: PublishTestResults@2 inputs: @@ -106,7 +106,7 @@ jobs: inputs: script: | set PATH=%PATH%;%USERPROFILE%\.dotnet\tools - nuke --target="CiAzureWindows" --configuration="Release" + nuke --target CiAzureWindows --configuration Release - task: PublishTestResults@2 inputs: diff --git a/nukebuild/Build.cs b/nukebuild/Build.cs index c937933493..63e889ae30 100644 --- a/nukebuild/Build.cs +++ b/nukebuild/Build.cs @@ -48,13 +48,11 @@ partial class Build : NukeBuild Information("IsLocalBuild: " + Parameters.IsLocalBuild); Information("IsRunningOnUnix: " + Parameters.IsRunningOnUnix); Information("IsRunningOnWindows: " + Parameters.IsRunningOnWindows); - Information("IsRunningOnAppVeyor: " + Parameters.IsRunningOnAppVeyor); - Information("IsRunnongOnAzure:" + Parameters.IsRunningOnAzure); + Information("IsRunningOnAzure:" + Parameters.IsRunningOnAzure); Information("IsPullRequest: " + Parameters.IsPullRequest); Information("IsMainRepo: " + Parameters.IsMainRepo); Information("IsMasterBranch: " + Parameters.IsMasterBranch); Information("IsReleaseBranch: " + Parameters.IsReleaseBranch); - Information("IsTagged: " + Parameters.IsTagged); Information("IsReleasable: " + Parameters.IsReleasable); Information("IsMyGetRelease: " + Parameters.IsMyGetRelease); Information("IsNuGetRelease: " + Parameters.IsNuGetRelease); @@ -62,29 +60,37 @@ partial class Build : NukeBuild Target Clean => _ => _.Executes(() => { - var data = Parameters; - DeleteDirectories(data.BuildDirs); - EnsureCleanDirectories(data.BuildDirs); - EnsureCleanDirectory(data.ArtifactsDir); - EnsureCleanDirectory(data.NugetRoot); - EnsureCleanDirectory(data.ZipRoot); - EnsureCleanDirectory(data.TestResultsRoot); + DeleteDirectories(Parameters.BuildDirs); + EnsureCleanDirectories(Parameters.BuildDirs); + EnsureCleanDirectory(Parameters.ArtifactsDir); + EnsureCleanDirectory(Parameters.NugetRoot); + EnsureCleanDirectory(Parameters.ZipRoot); + EnsureCleanDirectory(Parameters.TestResultsRoot); }); - + [Serializable] + class MsBuildSettingsWithRestore : MSBuildSettings + { + protected override Arguments ConfigureArguments(Arguments arguments) + { + arguments.Add("/restore"); + return base.ConfigureArguments(arguments); + } + } + Target Compile => _ => _ .DependsOn(Clean) .Executes(() => { - var data = Parameters; - if (data.IsRunningOnWindows) - MSBuild(data.MSBuildSolution, c => c - .SetConfiguration(data.Configuration) + + if (Parameters.IsRunningOnWindows) + MSBuild(Parameters.MSBuildSolution, c => new MsBuildSettingsWithRestore() + .SetConfiguration(Parameters.Configuration) .SetVerbosity(MSBuildVerbosity.Minimal) .AddProperty("PackageVersion", Parameters.Version) .AddProperty("iOSRoslynPathHackRequired", "true") .SetToolsVersion(MSBuildToolsVersion._15_0) - .AddTargets("Restore", "Build") + .AddTargets("Build") ); else @@ -126,7 +132,6 @@ partial class Build : NukeBuild .DependsOn(Compile) .Executes(() => { - RunCoreTest("./tests/Avalonia.Base.UnitTests", false); RunCoreTest("./tests/Avalonia.Controls.UnitTests", false); RunCoreTest("./tests/Avalonia.Input.UnitTests", false); @@ -138,7 +143,6 @@ partial class Build : NukeBuild RunCoreTest("./tests/Avalonia.Visuals.UnitTests", false); RunCoreTest("./tests/Avalonia.Skia.UnitTests", false); RunCoreTest("./tests/Avalonia.ReactiveUI.UnitTests", false); - }); Target RunRenderTests => _ => _ @@ -165,39 +169,6 @@ partial class Build : NukeBuild .DependsOn(Compile) .Executes(() => { - - var dotMemoryUnitPath = - ToolPathResolver.GetPackageExecutable("JetBrains.dotMemoryUnit", "dotMemoryUnit.exe"); - var xunitRunnerPath = - ToolPathResolver.GetPackageExecutable("xunit.runner.console", "xunit.console.x86.exe"); - var args = new[] - { - Path.GetFullPath(xunitRunnerPath), - "--propagate-exit-code", - "--", - "tests\\Avalonia.LeakTests\\bin\\Release\\net461\\Avalonia.LeakTests.dll" - }; - var cargs = string.Join(" ", args.Select(a => '"' + a + '"')); - - var proc = Process.Start(new ProcessStartInfo(dotMemoryUnitPath, cargs) - { - UseShellExecute = false - }); - - if (!proc.WaitForExit(120000)) - { - proc.Kill(); - throw new Exception("Leak tests timed out"); - } - - var leakTestsExitCode = proc.ExitCode; - - if (leakTestsExitCode != 0) - { - throw new Exception("Leak Tests failed"); - } - - var testAssembly = "tests\\Avalonia.LeakTests\\bin\\Release\\net461\\Avalonia.LeakTests.dll"; DotMemoryUnit( $"{XunitPath.DoubleQuoteIfNeeded()} --propagate-exit-code -- {testAssembly}", @@ -210,9 +181,7 @@ partial class Build : NukeBuild { var data = Parameters; Zip(data.ZipCoreArtifacts, data.BinRoot); - Zip(data.ZipNuGetArtifacts, data.NugetRoot); - Zip(data.ZipTargetControlCatalogDesktopDir, GlobFiles(data.ZipSourceControlCatalogDesktopDir, "*.dll").Concat( GlobFiles(data.ZipSourceControlCatalogDesktopDir, "*.config")).Concat( @@ -234,7 +203,7 @@ partial class Build : NukeBuild .AddProperty("PackageVersion", Parameters.Version) .AddProperty("iOSRoslynPathHackRequired", "true") .SetToolsVersion(MSBuildToolsVersion._15_0) - .AddTargets("Restore", "Pack")); + .AddTargets("Pack")); else DotNetPack(Parameters.MSBuildSolution, c => c.SetConfiguration(Parameters.Configuration) @@ -251,21 +220,14 @@ partial class Build : NukeBuild .DependsOn(RunTests) .DependsOn(CreateNugetPackages); - Target CiAppVeyor => _ => _ - .DependsOn(Package) - .DependsOn(ZipFiles); - - Target CiTravis => _ => _ - .DependsOn(RunTests); - - Target CiAsuzeLinux => _ => _ + Target CiAzureLinux => _ => _ .DependsOn(RunTests); - Target CiAsuzeOSX => _ => _ + Target CiAzureOSX => _ => _ .DependsOn(Package) .DependsOn(ZipFiles); - Target CiAsuzeWindows => _ => _ + Target CiAzureWindows => _ => _ .DependsOn(Package) .DependsOn(ZipFiles); diff --git a/nukebuild/BuildParameters.cs b/nukebuild/BuildParameters.cs index 322871e5db..9029aef60d 100644 --- a/nukebuild/BuildParameters.cs +++ b/nukebuild/BuildParameters.cs @@ -36,13 +36,11 @@ public partial class Build public bool IsLocalBuild { get; } public bool IsRunningOnUnix { get; } public bool IsRunningOnWindows { get; } - public bool IsRunningOnAppVeyor { get; } public bool IsRunningOnAzure { get; } public bool IsPullRequest { get; } public bool IsMainRepo { get; } public bool IsMasterBranch { get; } public bool IsReleaseBranch { get; } - public bool IsTagged { get; } public bool IsReleasable { get; } public bool IsMyGetRelease { get; } public bool IsNuGetRelease { get; } @@ -64,9 +62,6 @@ public partial class Build public BuildParameters(Build b) { - var buildSystem = Host; - - // ARGUMENTS Configuration = b.NukeArgConfiguration ?? "Release"; SkipTests = b.NukeArgSkipTests; @@ -79,77 +74,36 @@ public partial class Build MSBuildSolution = RootDirectory / "dirs.proj"; // PARAMETERS - IsLocalBuild = buildSystem == HostType.Console; + IsLocalBuild = Host == HostType.Console; IsRunningOnUnix = Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX; IsRunningOnWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); - IsRunningOnAppVeyor = buildSystem == HostType.AppVeyor; - IsRunningOnAzure = buildSystem == HostType.TeamServices || + IsRunningOnAzure = Host == HostType.TeamServices || Environment.GetEnvironmentVariable("LOGNAME") == "vsts"; - string tagName = null; - if (IsRunningOnAppVeyor) - { - IsPullRequest = AppVeyor.Instance.PullRequestNumber != 0; - RepositoryName = Environment.GetEnvironmentVariable("BUILD_REPOSITORY_URI"); - RepositoryBranch = Environment.GetEnvironmentVariable("BUILD_SOURCEBRANCH"); - - IsReleaseBranch = - (Environment.GetEnvironmentVariable("BUILD_SOURCEBRANCH") ?? "").StartsWith(ReleaseBranchPrefix, - StringComparison.OrdinalIgnoreCase); - IsTagged = AppVeyor.Instance.RepositoryTag - && !string.IsNullOrWhiteSpace(AppVeyor.Instance.RepositoryTagName); - - tagName = AppVeyor.Instance.RepositoryTagName; - } - else if (IsRunningOnAzure) + if (IsRunningOnAzure) { RepositoryName = TeamServices.Instance.RepositoryUri; RepositoryBranch = TeamServices.Instance.SourceBranch; IsPullRequest = TeamServices.Instance.PullRequestId.HasValue; IsMainRepo = StringComparer.OrdinalIgnoreCase.Equals(MainRepo, TeamServices.Instance.RepositoryUri); - - // TODO??? - IsTagged = false; - tagName = null; } IsMainRepo = StringComparer.OrdinalIgnoreCase.Equals(MainRepo, RepositoryName); IsMasterBranch = StringComparer.OrdinalIgnoreCase.Equals(MasterBranch, RepositoryBranch); + IsReleaseBranch = RepositoryBranch?.StartsWith(ReleaseBranchPrefix, StringComparison.OrdinalIgnoreCase) == + true; - IsReleasable = StringComparer.OrdinalIgnoreCase.Equals(ReleaseConfiguration, Configuration); - IsMyGetRelease = !IsTagged && IsReleasable; + IsMyGetRelease = IsReleasable; IsNuGetRelease = IsMainRepo && IsReleasable && IsReleaseBranch; // VERSION Version = b.NukeArgForceNugetVersion ?? GetVersion(); - if (IsRunningOnAppVeyor) - { - string tagVersion = null; - if (IsTagged) - { - var tag = tagName; - var nugetReleasePrefix = "nuget-release-"; - IsNuGetRelease = IsTagged && IsReleasable && tag.StartsWith(nugetReleasePrefix); - if (IsNuGetRelease) - tagVersion = tag.Substring(nugetReleasePrefix.Length); - } - - if (tagVersion != null) - { - Version = tagVersion; - } - else - { - // Use AssemblyVersion with Build as version - Version += "-build" + Environment.GetEnvironmentVariable("APPVEYOR_BUILD_NUMBER") + "-beta"; - } - } - else if (IsRunningOnAzure) + if (IsRunningOnAzure) { if (!IsNuGetRelease) { diff --git a/nukebuild/Shims.cs b/nukebuild/Shims.cs index 7f26490493..1ba72494d7 100644 --- a/nukebuild/Shims.cs +++ b/nukebuild/Shims.cs @@ -40,7 +40,6 @@ public partial class Build foreach (var path in paths) { - if (Directory.Exists(path)) { var dirInfo = new DirectoryInfo(path);