Skip to content

Commit

Permalink
Use sub MAIN for configurability and --help
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDaniel committed Oct 22, 2018
1 parent 953c12d commit efff604
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
2 changes: 1 addition & 1 deletion META6.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"perl" : "6.c",
"name" : "Blin",
"version" : "1.0.0",
"version" : "1.0.1",
"description" : "Project Blin – Toasting Reinvented",
"authors" : [
"Aleks-Daniel Jakimenko-Aleksejev <alex.jakimenko@gmail.com>"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ PERL6LIB=lib bin/blin.p6 SomeModuleHere AnotherModuleHere
Here is a more practical example:

```bash
time PERL6LIB=lib START_POINT=2018.06 END_POINT=2018.09 bin/blin.p6 Foo::Regressed Foo::Regressed::Very Foo::Dependencies::B-on-A
time PERL6LIB=lib bin/blin.p6 --old=2018.06 --new=2018.09 Foo::Regressed Foo::Regressed::Very Foo::Dependencies::B-on-A
```

If you want to test the whole ecosystem:
Expand Down
47 changes: 27 additions & 20 deletions bin/blin.p6
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,30 @@ use Whateverable::Builds;
use Whateverable::Config;
use Whateverable::Running;


#| Use this to test some specific modules
#| Leave empty to test the whole ecosystem
my @specified-modules = @*ARGS;
unit sub MAIN(
#| Old revision (initialized to the last release if unset)
Str :old($start-point) is copy,
#| New revision (default: HEAD)
Str :new($end-point) = β€˜HEAD’,
#| Number of threads to use (initialized to the output of `nproc` if unset)
Int :$nproc is copy,
#| Thread number multiplier (default: 1.0)
Rat :$nproc-multiplier = 1.0,
#| Number of extra runs for regressed modules (default: 4)
Int :$deflap = 4, # Can be really high because generally we are
# not expecting a large fallout with many
# now-failing modules.
#| Number of seconds between printing the current status (default: 60.0)
Rat :$heartbeat = 60.0,
#| Use this to test some specific modules (empty = whole ecosystem)
*@specified-modules,
);

#| Where to pull source info from
my @sources = <
https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/cpan.json
http://ecosystem-api.p6c.org/projects.json
>;
https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/cpan.json
http://ecosystem-api.p6c.org/projects.json
>; # TODO steal that from zef automatically

#| Core modules that are ignored as dependencies
my $ignored-deps = <Test NativeCall Pod::To::Text Telemetry snapper>.Set;
Expand All @@ -45,24 +59,12 @@ my $skip-tests = (
).Set;


#| Old revision
my $start-point = %*ENV<START_POINT>; # later initialized to the last release if unset
#| New revision
my $end-point = %*ENV<END_POINT> // β€˜HEAD’;

#| Where to install zef
my $zef-path = β€˜data/zef’.IO;
#| Some kind of a timeout πŸ˜‚
my $timeout = 60 Γ— 10;
#| Number of extra runs. Can be really high because generally we
#| are not expecting a large fallout with many now-failing modules.
my $deflap = 4;
#| Number of seconds between printing the progress
my $heartbeat = 60;

my $nproc-mult = 1.0;
my $nproc = $nproc-mult Γ— +run(:out, β€˜nproc’).out.slurp;
my $semaphore = Semaphore.new: $nproc.Int;
my $semaphore;

my $output-path = β€˜output’.IO;
my $overview-path = $output-path.add: β€˜overview’;
Expand Down Expand Up @@ -97,6 +99,11 @@ my $save-lock = Lock.new; # to eliminate miniscule chance of racing when saving

note β€˜πŸ₯ž Prep’;

$nproc //= ($nproc-multiplier Γ— +run(:out, β€˜nproc’).out.slurp).Int;
$semaphore = Semaphore.new: $nproc.Int;

note β€œπŸ₯ž Will use up to $nproc threads for testing modules”;

ensure-config β€˜./config-default.json’;
pull-cloned-repos; # pull rakudo and other stuff

Expand Down

0 comments on commit efff604

Please sign in to comment.