Skip to content

Commit

Permalink
CI: prepare for matrix list jobs in .azure-pipelines.yml
Browse files Browse the repository at this point in the history
In preparation for curl/curl#5468
  • Loading branch information
mback2k committed May 30, 2020
1 parent 184a518 commit 641d12a
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 9 deletions.
28 changes: 26 additions & 2 deletions CI-jobs-over-time.pl
Expand Up @@ -89,12 +89,36 @@ sub azurecount {
my ($tag)=@_;
open(G, "git show $tag:.azure-pipelines.yml 2>/dev/null|");
my $c = 0;
my $j = 0;
my $m = -1;
while(<G>) {
if($_ =~ /^ - job:/) {
$c++;
if($_ =~ /job:/) {
# commit previously counted jobs
$c += $j;
# initial value for non-matrix job
$j = 1;
}
elsif($_ =~ /matrix:/) {
# start of new matrix list(!)
$m = 0;
$j = 0;
}
elsif($m >= 0) {
if($_ =~ /name:/) {
# single matrix list entry job
$j++;
}
# azure matrix is a simple list,
# therefore no multiplier needed
elsif($_ =~ /steps:/) {
# disable matrix mode
$m = -1;
}
}
}
close(G);
# commit final counted jobs
$c += $j;
return $c;
}

Expand Down
49 changes: 42 additions & 7 deletions CI-platforms.pl
Expand Up @@ -112,20 +112,55 @@ sub azurecount {
my $linux = 0;
my $mac = 0;
my $windows = 0;
my $j = 0;
my $m = -1;
my $os = "";
while(<G>) {
if($_ =~ /vmImage: '(.*)'/) {
if($1 =~ /ubuntu/) {
$linux++;
if($_ =~ /vmImage: (.*)/) {
# commit previously counted jobs to previous os
my $n = $1;
if($os =~ /ubuntu/) {
$linux += $j;
}
elsif($1 =~ /macos/i) {
$mac++;
elsif($os =~ /macos/i) {
$mac += $j;
}
elsif($1 =~ /windows/i) {
$windows++;
elsif($os =~ /windows/i) {
$windows += $j;
}
$os = $n;
# non-matrix job
$j = 1;
}
elsif($_ =~ /matrix:/) {
# switch to matrix mode
$m = 0;
$j = 0;
}
elsif($m >= 0) {
if($_ =~ /name:/) {
# single matrix list entry job
$j++;
}
# azure matrix is a simple list,
# therefore no multiplier needed
elsif($_ =~ /steps:/) {
# disable matrix mode
$m = -1;
}
}
}
close(G);
# commit final counted jobs to last os
if($os =~ /ubuntu/) {
$linux += $j;
}
elsif($os =~ /macos/i) {
$mac += $j;
}
elsif($os =~ /windows/i) {
$windows += $j;
}
return ($mac, $linux, $windows);
}

Expand Down

0 comments on commit 641d12a

Please sign in to comment.