Skip to content

Commit

Permalink
devops xamarin#47.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Mar 28, 2019
1 parent ee4e502 commit c7994b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
13 changes: 7 additions & 6 deletions tests/sampletester/SampleTester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,23 +189,24 @@ protected static IEnumerable<SampleTestData> GetSampleTestData (Dictionary<strin

var platform_filter = Environment.GetEnvironmentVariable ("TEST_PLATFORM_FILTER_EXPRESSION");
var config_filter = Environment.GetEnvironmentVariable ("TEST_CONFIG_FILTER_EXPRESSION");
var name_filter = Environment.GetEnvironmentVariable ("TEST_NAME_FILTER_EXPRESSION");

IEnumerable<string> filter (string name, string proj, IEnumerable<string> input, string filter_expression)
IEnumerable<T> filter<T> (string name, string proj, IEnumerable<T> input, string filter_expression, Func<T, string> tostring)
{
if (string.IsNullOrEmpty (filter_expression))
return input;

var filtered = input.Where ((v) => Regex.IsMatch (v, filter_expression));
var filtered = input.Where ((v) => Regex.IsMatch (tostring (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)}");
Console.WriteLine ($"Filtered out {removed.Count ()} {name}s for {repo}/{proj} ({filtered.Count ()} left): {string.Join (", ", removed.Select (tostring))}");
return filtered;
}
return input;
}

// Create the test variations for each project.
foreach (var proj in executable_projects) {
foreach (var proj in filter ("name", "*", executable_projects, name_filter, (v) => Path.GetFileName (v.RelativePath))) {
if (!samples.TryGetValue (proj.RelativePath, out var sample))
samples [proj.RelativePath] = sample = new SampleTest ();
sample.Project = proj;
Expand All @@ -223,11 +224,11 @@ IEnumerable<string> filter (string name, string proj, IEnumerable<string> input,
throw new NotImplementedException (proj.Platform.ToString ());
}

foreach (var platform in filter ("platform", proj.Title, platforms, platform_filter)) {
foreach (var platform in filter ("platform", proj.Title, platforms, platform_filter, (v) => v)) {
var configs = new List<string> ();
configs.AddRange (sample.DebugConfigurations ?? defaultDebugConfigurations);
configs.AddRange (sample.ReleaseConfigurations ?? defaultReleaseConfigurations);
foreach (var config in filter ("config", proj.Title, configs, config_filter)) {
foreach (var config in filter ("config", proj.Title, configs, config_filter, (v) => v)) {
yield return new SampleTestData { SampleTest = sample, Configuration = config, Platform = platform };
}
}
Expand Down
5 changes: 1 addition & 4 deletions tools/devops/build-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ jobs:
mono --version || true
env | sort
git config -l | sort
git config --global url."https://github.com/".insteadOf git@github.com:
AUTH=$(git config -l | grep AUTHORIZATION | sed 's/.*AUTHORIZATION: //')
git config --global http.https://github.com/xamarin/maccore.extraheader "AUTHORIZATION: $AUTH"
git config --global http.https://github.com/rolfbjarne/maccore.extraheader "AUTHORIZATION: $AUTH"
git config --global http.extraheader "AUTHORIZATION: $AUTH"
git config -l | sort
displayName: System Info
Expand All @@ -73,7 +71,6 @@ jobs:
set -x
set -e
./configure --enable-xamarin
# the github auth we use only works with https, so change maccore's url to be https:// instead of git@
make reset-maccore MACCORE_MODULE=$(grep ^MACCORE_MODULE mk/xamarin.mk | sed -e 's/.*:= //' -e 's_git@github.com:_https://github.com/_' -e 's/[.]git//') V=1
../maccore/tools/install-qa-provisioning-profiles.sh
Expand Down

0 comments on commit c7994b9

Please sign in to comment.