diff --git a/devops/build-samples.yml b/devops/build-samples.yml index 97b9380e206c..d3bb39c70359 100644 --- a/devops/build-samples.yml +++ b/devops/build-samples.yml @@ -6,8 +6,28 @@ trigger: jobs: - job: macOS - displayName: xamarin macios + displayName: Build samples timeoutInMinutes: 360 + strategy: + matrix: + Debug|iPhone: + TEST_PLATFORM_FILTER_EXPRESSION: '^iPhone$' + TEST_CONFIG_FILTER_EXPRESSION: '^.*Debug.*$' + Debug|iPhoneSimulator: + TEST_PLATFORM_FILTER_EXPRESSION: '^iPhoneSimulator$' + TEST_CONFIG_FILTER_EXPRESSION: '^.*Debug.*$' + Release|iPhone: + TEST_PLATFORM_FILTER_EXPRESSION: '^iPhone$' + TEST_CONFIG_FILTER_EXPRESSION: '^.*Release.*$' + Release|iPhoneSimulator: + TEST_PLATFORM_FILTER_EXPRESSION: '^iPhoneSimulator$' + TEST_CONFIG_FILTER_EXPRESSION: '^.*Release.*$' + Debug|Mac: + TEST_PLATFORM_FILTER_EXPRESSION: '^$' + TEST_CONFIG_FILTER_EXPRESSION: '^.*Debug.*$' + Release|Mac: + TEST_PLATFORM_FILTER_EXPRESSION: '^$' + TEST_CONFIG_FILTER_EXPRESSION: '^.*Release.*$' pool: vmImage: 'macOS-10.13' @@ -43,3 +63,4 @@ jobs: testResultsFiles: '**/TestResult*.xml' testRunTitle: Sample tests (build) publishRunAttachments: true + mergeTestResults: true diff --git a/tests/sampletester/SampleTester.cs b/tests/sampletester/SampleTester.cs index 5259f6bd107c..7feff2603541 100644 --- a/tests/sampletester/SampleTester.cs +++ b/tests/sampletester/SampleTester.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.IO; +using System.Text.RegularExpressions; using NUnit.Framework; @@ -186,12 +187,29 @@ protected static IEnumerable GetSampleTestData (Dictionary filter (string name, string proj, IEnumerable input, string filter_expression) + { + if (string.IsNullOrEmpty (filter_expression)) + return input; + + var filtered = input.Where ((v) => Regex.IsMatch (v, filter_expression)); + var removed = input.Where ((v) => !filtered.Contains (v)); + if (removed.Any ()) { + Console.WriteLine ($"Filtered out {removed.Count ()} {name}s for {repo}/{proj}: {string.Join (", ", removed)}"); + return filtered; + } + return input; + } + // Create the test variations for each project. foreach (var proj in executable_projects) { if (!samples.TryGetValue (proj.RelativePath, out var sample)) samples [proj.RelativePath] = sample = new SampleTest (); sample.Project = proj; - string [] platforms; + IEnumerable platforms; switch (proj.Platform) { case TestPlatform.iOS: case TestPlatform.tvOS: @@ -204,12 +222,14 @@ protected static IEnumerable GetSampleTestData (Dictionary (); configs.AddRange (sample.DebugConfigurations ?? defaultDebugConfigurations); configs.AddRange (sample.ReleaseConfigurations ?? defaultReleaseConfigurations); - foreach (var config in configs) + foreach (var config in filter ("config", proj.Title, configs, config_filter)) { yield return new SampleTestData { SampleTest = sample, Configuration = config, Platform = platform }; + } } } }