Skip to content

Commit

Permalink
In preparation for 0.3 release
Browse files Browse the repository at this point in the history
- Upped dependency on "rak" to get ParaSeq features
- Handle --only-first better using .head
- Updated some brittle author tests
  • Loading branch information
lizmat committed Jul 28, 2024
1 parent cfb8a88 commit d048f60
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 38 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/test.yml → .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test
name: Linux

on:
push:
Expand All @@ -14,16 +14,15 @@ jobs:
matrix:
os:
- ubuntu-latest
- macOS-latest
raku-version:
- 'latest'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: Raku/setup-raku@v1
with:
raku-version: ${{ matrix.raku-version }}
- name: Install Dependencies
run: zef install --/test --test-depends --deps-only .
- name: Run Tests
run: raku run-tests
- name: Run Special Tests
run: raku run-tests -i
28 changes: 28 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: MacOS

on:
push:
branches:
- '*'
tags-ignore:
- '*'
pull_request:

jobs:
raku:
strategy:
matrix:
os:
- macos-latest
raku-version:
- 'latest'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: Raku/setup-raku@v1
with:
raku-version: ${{ matrix.raku-version }}
- name: Install Dependencies
run: zef install --/test --test-depends --deps-only .
- name: Run Special Tests
run: raku run-tests -i
28 changes: 28 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Windows

on:
push:
branches:
- '*'
tags-ignore:
- '*'
pull_request:

jobs:
raku:
strategy:
matrix:
os:
- windows-latest
raku-version:
- 'latest'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: Raku/setup-raku@v1
with:
raku-version: ${{ matrix.raku-version }}
- name: Install Dependencies
run: zef install --/test --test-depends --deps-only .
- name: Run Special Tests
run: raku run-tests -i
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Revision history for App-Rak

{{$NEXT}}
- Upped dependency on "rak" which uses "ParaSeq" for
better asynchronous performance.
- Add separate CI badges for each OS
- Add sponsor button

0.2.26 2024-05-14T19:25:29+02:00
- Upped dependency on "rak" for fix on hyperizing 2MB+
Expand Down
2 changes: 1 addition & 1 deletion META6.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"IO::Path::AutoDecompress:ver<0.0.2>:auth<zef:lizmat>",
"JSON::Fast::Hyper:ver<0.0.5>:auth<zef:lizmat>",
"META::constants:ver<0.0.3>:auth<zef:lizmat>",
"rak:ver<0.0.56>:auth<zef:lizmat>",
"rak:ver<0.0.57>:auth<zef:lizmat>",
"String::Utils:ver<0.0.23+>:auth<zef:lizmat>"
],
"description": "21st century grep / find / ack / ag / rg on steroids",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Actions Status](https://github.com/lizmat/App-Rak/actions/workflows/test.yml/badge.svg)](https://github.com/lizmat/App-Rak/actions)
[![Actions Status](https://github.com/lizmat/App-Rak/actions/workflows/linux.yml/badge.svg)](https://github.com/lizmat/App-Rak/actions) [![Actions Status](https://github.com/lizmat/App-Rak/actions/workflows/macos.yml/badge.svg)](https://github.com/lizmat/App-Rak/actions) [![Actions Status](https://github.com/lizmat/App-Rak/actions/workflows/windows.yml/badge.svg)](https://github.com/lizmat/App-Rak/actions)

NAME
====
Expand Down
4 changes: 3 additions & 1 deletion dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ filename = doc/App-Rak.rakudoc
; match = ^ 'xt/'

[Badges]
provider = github-actions/test.yml
provider = github-actions/linux.yml
provider = github-actions/macos.yml
provider = github-actions/windows.yml
26 changes: 22 additions & 4 deletions lib/App/Rak.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use highlighter:ver<0.0.18>:auth<zef:lizmat>; # columns highlighter matches Type
use IO::Path::AutoDecompress:ver<0.0.2>:auth<zef:lizmat>; # IOAD
use JSON::Fast::Hyper:ver<0.0.5>:auth<zef:lizmat>; # from-json to-json
use META::constants:ver<0.0.3>:auth<zef:lizmat> $?DISTRIBUTION;
use rak:ver<0.0.56>:auth<zef:lizmat>; # rak Rak
use rak:ver<0.0.57>:auth<zef:lizmat>; # rak Rak

use Backtrace::Files:ver<0.0.3>:auth<zef:lizmat> <
backtrace-files
Expand Down Expand Up @@ -826,6 +826,18 @@ TEXT
}
%rak<eager> := True if $eagerly;
if %rak<sources-only>
|| %rak<sources-without-only>
|| (%rak<max-matches-per-source>:exists) {
}
else {
%rak<max-matches-per-source> := %listing<only-first>:exists
?? %listing<only-first>
!! (%listing<human> // $writing-to-stdout)
?? 1000
!! 0;
}
if $debug-rak {
note .key ~ ': ' ~ .value.raku for %rak.sort(*.key);
}
Expand Down Expand Up @@ -1026,14 +1038,16 @@ my sub show-results(--> Nil) {
# Callable, which cannot have any
# highlighting, so don't bother
sayer "$linenr:$_" for @(.value);
++$seen;
}
else {
sayer $linenr ~ ':' ~ (.matched
?? line-post-proc stringify(.value)
!! stringify(.value)
);
++$seen if .matched;
}
last RESULT if ++$seen == $stop-after;
last RESULT if $seen == $stop-after;
$last-linenr = $linenr;
}
}
Expand All @@ -1048,6 +1062,7 @@ my sub show-results(--> Nil) {
# Callable, which cannot have any
# highlighting, so don't bother
sayer "$source:$linenr:$_" for @(.value);
++$seen;
}
else {
sayer $source
Expand All @@ -1056,8 +1071,9 @@ my sub show-results(--> Nil) {
?? line-post-proc stringify(.value)
!! stringify(.value)
);
++$seen if .matched;
}
last RESULT if ++$seen == $stop-after;
last RESULT if $seen == $stop-after;
$last-linenr = $linenr;
}
}
Expand All @@ -1072,15 +1088,17 @@ my sub show-results(--> Nil) {
# Callable, which cannot have any
# highlighting, so don't bother
sayer "$linenr:$_" for @(.value);
++$seen;
}
else {
sayer $linenr
~ ':' ~ (.matched
?? line-post-proc stringify(.value)
!! stringify(.value)
);
++$seen if .matched;
}
last RESULT if ++$seen == $stop-after;
last RESULT if $seen == $stop-after;
$last-linenr = $linenr;
}
}
Expand Down
53 changes: 32 additions & 21 deletions run-tests
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
unit sub MAIN(:a($author));
unit sub MAIN(:a($author), :i($install));

say run(<raku --version>, :out).out.slurp.chomp;
say "Running on $*DISTRO.gist().\n";
Expand All @@ -12,36 +12,47 @@ say "Testing {
my @failed;
my $done = 0;

sub test-dir($dir) {
for $dir.IO.dir(:test(*.ends-with: '.t' | '.rakutest')).map(*.Str).sort {
say "=== $_";
my $proc := run "raku", "--ll-exception", "-I.", $_, :out,:err,:merge;
if $proc {
$proc.out.slurp;
}
else {
@failed.push($_);
if $proc.out.slurp -> $stdout {
my @lines = $stdout.lines;
with @lines.first(
*.starts-with(" from gen/moar/stage2"),:k)
-> $index {
say @lines[^$index].join("\n");
}
else {
say $stdout;
}
sub process($proc) {
if $proc {
$proc.out.slurp;
}
else {
@failed.push($_);
if $proc.out.slurp -> $stdout {
my @lines = $stdout.lines;
with @lines.first(
*.starts-with(" from gen/moar/stage2"),:k)
-> $index {
say @lines[^$index].join("\n");
}
else {
say "No output received, exit-code $proc.exitcode() ($proc.signal())";
say $stdout;
}
}
else {
say "No output received, exit-code $proc.exitcode() ($proc.signal()):\n$proc.os-error()";
}
}
}

sub install() {
my $zef := $*DISTRO.is-win ?? 'zef.bat' !! 'zef';
my $proc := run $zef, "install", ".", "--verbose", "--/test", :out,:err,:merge;
process($proc);
}

sub test-dir($dir) {
for $dir.IO.dir(:test(*.ends-with: '.t' | '.rakutest')).map(*.Str).sort {
say "=== $_";
my $proc := run "raku", "--ll-exception", "-I.", $_, :out,:err,:merge;
process($proc);
$done++;
}
}

test-dir("t");
test-dir("xt") if $author && "xt".IO.e;
install if $install;

if @failed {
say "FAILED: {+@failed} of $done:";
Expand Down
13 changes: 8 additions & 5 deletions xt/01-simple.rakutest
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ nine
8:{BON}seven{BOFF}
OK

query-ok </o$/ --find>, :add-absolute, ok => qq:to/OK/;
query-ok </o$/ --find>, :add-absolute, :!head, ok => qq:to/OK/;
{$dira}tw{BON}o{BOFF}
{$dira}zer{BON}o{BOFF}
OK
Expand Down Expand Up @@ -375,7 +375,7 @@ query-ok <eig --highlight-before=* --highlight-after=## --/show-filename>,
9:*eig##ht
OK

query-ok <seven --context=2>, :head(2), ok => qq:to/OK/;
query-ok <seven --context=2>, :head(4), ok => qq:to/OK/;
seven
6:five
7:SIX
Expand All @@ -395,7 +395,7 @@ nine
10:nine
OK

query-ok <seven --before-context=2 --/highlight>, :head(2), ok => q:to/OK/;
query-ok <seven --before-context=2 --/highlight>, :head(4), ok => q:to/OK/;
seven
6:five
7:SIX
Expand Down Expand Up @@ -455,7 +455,7 @@ my $user := ~$*USER;
my $uid := +$*USER;
for "--user=$user", qq/--user=*eq"$user"/, "--user=$user,$user",
"--uid=$uid", "--uid=*==$uid" {
query-ok '--find', $_, ok => qq:to/OK/;
query-ok '--find', $_, :!head, ok => qq:to/OK/;
eight
five
four
Expand All @@ -478,7 +478,7 @@ my $group := ~$*GROUP;
my $gid := +$*GROUP;
for "--group=$group", qq/--group=*eq"$group"/, "--group=$group,$group",
"--gid=$gid", "--gid=*==$gid" {
query-ok '--find', $_, ok => qq:to/OK/;
query-ok '--find', $_, :!head, ok => qq:to/OK/;
eight
five
four
Expand Down Expand Up @@ -634,6 +634,7 @@ OK
# This check is a little brittle
query-ok '--ecosystem', q/{ .<name> eq "eigenstates" && .<version> }/,
:!add-paths, ok => q:to/OK/;
0.0.11
0.0.10
0.0.9
0.0.8
Expand All @@ -654,6 +655,7 @@ query-ok '--ecosystem=fez', q/{ .<name> eq "eigenstates" && .<version> }/,
0.0.8
0.0.9
0.0.10
0.0.11
OK

# This check is a little brittle
Expand All @@ -670,6 +672,7 @@ https://360.zef.pm
0.0.8
0.0.9
0.0.10
0.0.11
OK

query-ok '*.substr(0,1) eq "f"', '--classify=*.substr(0,1)', :head(2),
Expand Down

0 comments on commit d048f60

Please sign in to comment.