diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index d200751b4..d1a5381c0 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -5,7 +5,7 @@ $(MicrosoftAspNetCoreAllPackageVersion) 2.1.0-rc1-26423-06 $(MicrosoftNETCoreAppPackageVersion) - 15.7.0-preview-000169 + 15.7.177 $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) @@ -15,7 +15,7 @@ $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) - 1.0.0-rc1-62827-06 + 2.1.300-rtm-62902-01 $(MicrosoftNETSdkPackageVersion) $(MicrosoftAspNetCoreAppPackageVersion) 2.1.300-rc1-20180422-1618307 @@ -44,7 +44,7 @@ $(NuGetBuildTasksPackageVersion) $(NuGetBuildTasksPackageVersion) $(NuGetBuildTasksPackageVersion) - 15.7.0-preview-20180221-13 + 15.7.0 $(MicrosoftNETTestSdkPackageVersion) $(MicrosoftNETTestSdkPackageVersion) 0.2.0-beta-000042 diff --git a/build/Test.targets b/build/Test.targets index 52b74f97a..39cc79f83 100644 --- a/build/Test.targets +++ b/build/Test.targets @@ -42,6 +42,8 @@ Projects="@(ProjectsToTest)"> + + diff --git a/netci.groovy b/netci.groovy index 6a1cb40a9..f06ec6ed6 100644 --- a/netci.groovy +++ b/netci.groovy @@ -9,17 +9,35 @@ def project = GithubProject def branch = GithubBranchName def isPR = true -def platformList = ['Linux:x64:Release', 'Debian8.2:x64:Debug', 'Ubuntu:x64:Release', 'Ubuntu16.04:x64:Debug', 'OSX10.12:x64:Release', 'Windows_NT:x64:Release', 'Windows_NT:x86:Debug', 'Windows_NT_ES:x64:Debug', 'RHEL7.2:x64:Release', 'CentOS7.1:x64:Debug', 'RHEL6:x64:Debug', 'Linux-musl:x64:Debug', 'Linux:arm:Debug', 'Linux:arm64:Debug'] +def platformList = [ + 'CentOS7.1:x64:Debug', + 'Debian8.2:x64:Debug', + 'fedora.27:x64:Debug', + 'Linux:arm:Debug', + 'Linux:arm64:Debug', + 'Linux-musl:x64:Debug', + 'Linux:x64:Release', + 'opensuse.43.2:x64:Debug', + 'OSX10.12:x64:Release', + 'RHEL6:x64:Debug', + 'RHEL7.2:x64:Release', + 'Ubuntu:x64:Release', + 'Ubuntu16.04:x64:Debug', + 'ubuntu.18.04:x64:Debug', + 'Windows_NT:x64:Release', + 'Windows_NT:x86:Debug', + 'Windows_NT_ES:x64:Debug' +] def static getBuildJobName(def configuration, def os, def architecture) { return configuration.toLowerCase() + '_' + os.toLowerCase() + '_' + architecture.toLowerCase() } - platformList.each { platform -> // Calculate names def (os, architecture, configuration) = platform.tokenize(':') def osUsedForMachineAffinity = os; + def osVersionUsedForMachineAffinity = 'latest-or-auto'; // Calculate job name def jobName = getBuildJobName(configuration, os, architecture) @@ -59,6 +77,11 @@ set DOTNET_CLI_UI_LANGUAGE=es osUsedForMachineAffinity = 'Ubuntu16.04'; buildCommand = "./build.sh --skip-prereqs --configuration ${configuration} --runtime-id linux-musl-x64 --docker alpine.3.6 --targets Default" } + else if (os == 'ubuntu.18.04' || os == 'fedora.27' || os == 'opensuse.43.2') { + osUsedForMachineAffinity = 'Ubuntu16.04' + osVersionUsedForMachineAffinity = 'latest-docker' + buildCommand = "./build.sh --linux-portable --skip-prereqs --configuration ${configuration} --docker ${os} --targets Default" + } else { // Jenkins non-Ubuntu CI machines don't have docker buildCommand = "./build.sh --skip-prereqs --configuration ${configuration} --targets Default" @@ -78,7 +101,7 @@ set DOTNET_CLI_UI_LANGUAGE=es } } - Utilities.setMachineAffinity(newJob, osUsedForMachineAffinity, 'latest-or-auto') + Utilities.setMachineAffinity(newJob, osUsedForMachineAffinity, osVersionUsedForMachineAffinity) Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}") // ARM CI runs are build only. if ((architecture != 'arm') && (architecture != 'arm64')) { diff --git a/run-build.ps1 b/run-build.ps1 index e0e49bf4f..30e495d03 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -67,8 +67,6 @@ if (!(Test-Path $env:DOTNET_INSTALL_DIR)) mkdir $env:DOTNET_INSTALL_DIR | Out-Null } - - # Disable first run since we want to control all package sources $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 diff --git a/scripts/docker/fedora.27/Dockerfile b/scripts/docker/fedora.27/Dockerfile new file mode 100644 index 000000000..e0f6e851d --- /dev/null +++ b/scripts/docker/fedora.27/Dockerfile @@ -0,0 +1,32 @@ +# +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. +# + +# Dockerfile that creates a container suitable to build dotnet-cli +FROM microsoft/dotnet-buildtools-prereqs:fedora-27-82a3800-20180326211504 + +RUN dnf install -y findutils + +RUN dnf upgrade -y nss + +RUN dnf clean all + +# Set a different rid to publish buildtools for, until we update to a version which +# natively supports fedora.24-x64 +ENV __PUBLISH_RID=fedora.23-x64 + +# Setup User to match Host User, and give superuser permissions +ARG USER_ID=0 +RUN useradd -m code_executor -u ${USER_ID} -g wheel +RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +# With the User Change, we need to change permissions on these directories +RUN chmod -R a+rwx /usr/local +RUN chmod -R a+rwx /home + +# Set user to the one we just created +USER ${USER_ID} + +# Set working directory +WORKDIR /opt/code \ No newline at end of file diff --git a/scripts/docker/opensuse.43.2/Dockerfile b/scripts/docker/opensuse.43.2/Dockerfile new file mode 100644 index 000000000..b128f8bc9 --- /dev/null +++ b/scripts/docker/opensuse.43.2/Dockerfile @@ -0,0 +1,49 @@ +# +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. +# + +FROM microsoft/dotnet-buildtools-prereqs:opensuse-42.3-d46ee12-20180327014902 + +# Install the base toolchain we need to build anything (clang, cmake, make and the like) +# this does not include libraries that we need to compile different projects, we'd like +# them in a different layer. +RUN zypper -n install binutils \ + cmake \ + which \ + gcc \ + llvm-clang \ + tar \ + ncurses-utils \ + curl \ + git \ + sudo && \ + zypper clean -a + +# Dependencies of CoreCLR and CoreFX. + +RUN zypper -n install --force-resolution \ + libunwind \ + libicu \ + lttng-ust \ + libuuid1 \ + libopenssl1_0_0 \ + libcurl4 \ + krb5 && \ + zypper clean -a + +# Setup User to match Host User, and give superuser permissions +ARG USER_ID=0 +RUN useradd -m code_executor -u ${USER_ID} -g wheel +RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +# With the User Change, we need to change permissions on these directories +RUN chmod -R a+rwx /usr/local +RUN chmod -R a+rwx /home +RUN chmod -R 755 /usr/lib/sudo + +# Set user to the one we just created +USER ${USER_ID} + +# Set working directory +WORKDIR /opt/code \ No newline at end of file diff --git a/scripts/docker/ubuntu.18.04/Dockerfile b/scripts/docker/ubuntu.18.04/Dockerfile new file mode 100644 index 000000000..97d0578c7 --- /dev/null +++ b/scripts/docker/ubuntu.18.04/Dockerfile @@ -0,0 +1,29 @@ +# +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. +# + +# Dockerfile that creates a container suitable to build dotnet-cli +FROM microsoft/dotnet-buildtools-prereqs:ubuntu-18.04-f90bc20-20180320154721 + +RUN apt-get update && \ + apt-get -qqy install \ + sudo && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Setup User to match Host User, and give superuser permissions +ARG USER_ID=0 +RUN useradd -m code_executor -u ${USER_ID} -g sudo +RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +# With the User Change, we need to change permissions on these directories +RUN chmod -R a+rwx /usr/local +RUN chmod -R a+rwx /home +RUN chmod -R 755 /usr/lib/sudo + +# Set user to the one we just created +USER ${USER_ID} + +# Set working directory +WORKDIR /opt/code \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj index 14d2eb2c2..cddf0f8b3 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj +++ b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj @@ -25,7 +25,7 @@ - + diff --git a/test/EndToEnd/GivenDotNetLinuxInstallers.cs b/test/EndToEnd/GivenDotNetLinuxInstallers.cs new file mode 100644 index 000000000..4968f0221 --- /dev/null +++ b/test/EndToEnd/GivenDotNetLinuxInstallers.cs @@ -0,0 +1,83 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.IO; +using Microsoft.DotNet.Tools.Test.Utilities; +using Xunit; + +namespace Microsoft.DotNet.Tests.EndToEnd +{ + public class GivenDotNetLinuxInstallers + { + [Fact] + public void ItHasExpectedDependencies() + { + var installerFile = Environment.GetEnvironmentVariable("SDK_INSTALLER_FILE"); + if (string.IsNullOrEmpty(installerFile)) + { + return; + } + + var ext = Path.GetExtension(installerFile); + switch (ext) + { + case ".deb": + DebianPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(installerFile); + return; + case ".rpm": + RpmPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(installerFile); + return; + } + } + + private void DebianPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string installerFile) + { + // Example output: + + // $ dpkg --info dotnet-sdk-2.1.105-ubuntu-x64.deb + + // new debian package, version 2.0. + // size 75660448 bytes: control archive=29107 bytes. + // 717 bytes, 11 lines control + // 123707 bytes, 1004 lines md5sums + // 1710 bytes, 28 lines * postinst #!/usr/bin/env + // Package: dotnet-sdk-2.1.104 + // Version: 2.1.104-1 + // Architecture: amd64 + // Maintainer: Microsoft + // Installed-Size: 201119 + // Depends: dotnet-runtime-2.0.6, aspnetcore-store-2.0.6 + // Section: devel + // Priority: standard + // Homepage: https://dotnet.github.io/core + // Description: Microsoft .NET Core SDK - 2.1.104 + + new TestCommand("dpkg") + .ExecuteWithCapturedOutput($"--info {installerFile}") + .Should().Pass() + .And.HaveStdOutMatching(@"Depends:.*\s?dotnet-runtime-\d+(\.\d+){2}") + .And.HaveStdOutMatching(@"Depends:.*\s?aspnetcore-store-\d+(\.\d+){2}"); + } + + private void RpmPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string installerFile) + { + // Example output: + + // $ rpm -qpR dotnet-sdk-2.1.105-rhel-x64.rpm + + // dotnet-runtime-2.0.7 >= 2.0.7 + // aspnetcore-store-2.0.7 >= 2.0.7 + // /bin/sh + // /bin/sh + // rpmlib(PayloadFilesHavePrefix) <= 4.0-1 + // rpmlib(CompressedFileNames) <= 3.0.4-1 + + new TestCommand("rpm") + .ExecuteWithCapturedOutput($"-qpR {installerFile}") + .Should().Pass() + .And.HaveStdOutMatching(@"dotnet-runtime-\d+(\.\d+){2} >= \d+(\.\d+){2}") + .And.HaveStdOutMatching(@"aspnetcore-store-\d+(\.\d+){2} >= \d+(\.\d+){2}"); + } + } +} diff --git a/test/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj b/test/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj index 9847dbb6f..59b36f03c 100644 --- a/test/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj +++ b/test/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj @@ -14,4 +14,8 @@ + + + + \ No newline at end of file diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/ProjectUtils.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/ProjectUtils.cs deleted file mode 100644 index 3b812ed28..000000000 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/ProjectUtils.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; -using System.IO; -using System.Linq; - -namespace Microsoft.DotNet.Tools.Test.Utilities -{ - public class ProjectUtils - { - public static string GetProjectJson(string testRoot, string project) - { - // We assume that the project name same as the directory name with contains the project.json - // We can do better here by using ProjectReader to get the correct project name - string projectPath = Directory.GetFiles(testRoot, "project.json", SearchOption.AllDirectories) - .FirstOrDefault(pj => Directory.GetParent(pj).Name.Equals(project)); - - if (string.IsNullOrEmpty(projectPath)) - { - throw new Exception($"Cannot file project '{project}' in '{testRoot}'"); - } - - return projectPath; - } - } -} diff --git a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index 9b325256f..2cc11eb51 100644 --- a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -4,7 +4,9 @@ using System; using System.IO; using System.Diagnostics; +using System.Linq; using System.Runtime.InteropServices; +using System.Xml.Linq; using FluentAssertions; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.PlatformAbstractions; @@ -103,7 +105,19 @@ namespace Microsoft.DotNet.Cli.Publish.Tests var testInstance = TestAssets.Get(testAppName) .CreateInstance() .WithSourceFiles() - .WithRestoreFiles(); + .WithProjectChanges(project => + { + var ns = project.Root.Name.Namespace; + + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); + + // This is needed to be able to restore for RIDs that were not available in Microsoft.NetCore.App 2.0.0. + // M.NC.App 2.0.0 depends on a version of Microsoft.NetCore.Platforms that lacks the mapping for the + // latest RIDs. Given that self-contained apps are pinned to 2.0.0 in this version of the SDK, we + // need a manual roll-forward. + propertyGroup.Add( + new XElement(ns + "RuntimeFrameworkVersion", "2.0.*")); + }); var testProjectDirectory = testInstance.Root; @@ -170,7 +184,19 @@ namespace Microsoft.DotNet.Cli.Publish.Tests var testInstance = TestAssets.Get(testAppName) .CreateInstance($"PublishesSelfContained{selfContained}") .WithSourceFiles() - .WithRestoreFiles(); + .WithProjectChanges(project => + { + var ns = project.Root.Name.Namespace; + + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); + + // This is needed to be able to restore for RIDs that were not available in Microsoft.NetCore.App 2.0.0. + // M.NC.App 2.0.0 depends on a version of Microsoft.NetCore.Platforms that lacks the mapping for the + // latest RIDs. Given that self-contained apps are pinned to 2.0.0 in this version of the SDK, we + // need a manual roll-forward. + propertyGroup.Add( + new XElement(ns + "RuntimeFrameworkVersion", "2.0.*")); + }); var testProjectDirectory = testInstance.Root;