Skip to content

Commit

Permalink
Added Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris White committed May 29, 2019
1 parent a5e157b commit f0f8b3b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: perl
perl:
- "5.26"
- "5.26-shrplib"
- "5.20"
- "5.18-shrplib"
- "5.14"
# 5.14 is the minimum Data-Hopen supports

install:
- cpanm ExtUtils::MakeMaker
# Because EUMM v6.66 doesn't seem to generate the correct MYMETA.json,
# causing lib::relative not to be loaded as a dependency. See, e.g.,
# https://travis-ci.org/cxw42/Class-Tiny-ConstrainedAccessor/jobs/535823908
- cpanm --with-recommends --verbose --installdeps --notest .
4 changes: 2 additions & 2 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ testhere: # Run the tests from lib rather than blib
\tprove -lj4
README.md: @{[$VERSION_FROM]} Makefile.PL $make_readme_md
\t"$secure_perl_path" "$make_readme_md" -i "\$<" -o "\$@" -f md --appveyor cxw42/data-hopen --avbadge hopenbuild/data-hopen
\t"$secure_perl_path" "$make_readme_md" -i "\$<" -o "\$@" -f md --appveyor cxw42/data-hopen --travis hopenbuild/Data-Hopen
README: @{[$VERSION_FROM]} Makefile.PL $make_readme_md
\t"$secure_perl_path" "$make_readme_md" -i "\$<" -o "\$@" -f text --appveyor hopenbuild/Data-Hopen --avbadge hopenbuild/data-hopen
\t"$secure_perl_path" "$make_readme_md" -i "\$<" -o "\$@" -f text --appveyor hopenbuild/Data-Hopen --travis hopenbuild/Data-Hopen
all :: README.md README
dist :: README.md README
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Data::Hopen - A dataflow library with first-class edges

[![Appveyor Badge](https://ci.appveyor.com/api/projects/status/github/hopenbuild/data-hopen?svg=true)](https://ci.appveyor.com/project/cxw42/data-hopen)
[![Appveyor Status](https://img.shields.io/appveyor/ci/cxw42/data-hopen.svg?logo=appveyor)](https://ci.appveyor.com/project/cxw42/data-hopen) [![Travis Status](https://img.shields.io/travis/hopenbuild/Data-Hopen.svg?logo=travis)](https://travis-ci.org/hopenbuild/Data-Hopen)



Expand Down
19 changes: 15 additions & 4 deletions support/readme.pl
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,29 @@
use Path::Class;

# Parse command-line options
my ($source_fn, $dest_fn, $appveyor, $appveyor_badge);
my ($source_fn, $dest_fn, $appveyor, $appveyor_badge, $travis, $travis_badge);
my $format = 'md';
GetOptions( "i|input=s" => \$source_fn,
"o|output=s" => \$dest_fn,
"f|format=s" => \$format,
"appveyor=s" => \$appveyor, # username/repo
"avbadge=s" => \$appveyor_badge) # default $appveyor
"avbadge=s" => \$appveyor_badge, # default $appveyor
"travis=s" => \$travis, # username/repo
"trbadge=s" => \$travis_badge, # default $travis
)
or die "Error in arguments. Usage:\nreadme_md.pl -i input -o output [-f format]\nFormat = md (default) or text.";

die "Need an input file" unless $source_fn;
die "Need an output file" unless $dest_fn;

$appveyor =~ m{^[A-Za-z0-9-]+/[A-Za-z0-9-]+} or die '--appveyor <GH username>/<GH repo>' if $appveyor;
$appveyor_badge //= $appveyor;
$appveyor_badge =~ m{^[A-Za-z0-9-]+/[A-Za-z0-9-]+} or die '--appveyor <GH username>/<GH repo>' if $appveyor_badge;
$appveyor_badge =~ m{^[A-Za-z0-9-]+/[A-Za-z0-9-]+} or die '--avbadge <GH username>/<GH repo>' if $appveyor_badge;

$travis =~ m{^[A-Za-z0-9-]+/[A-Za-z0-9-]+} or die '--travis <GH username>/<GH repo>' if $travis;
$travis_badge //= $travis;
$travis_badge =~ m{^[A-Za-z0-9-]+/[A-Za-z0-9-]+} or die '--trbadge <GH username>/<GH repo>' if $travis_badge;


# Load the right parser
my $parser;
Expand Down Expand Up @@ -61,7 +69,10 @@
next;
} elsif($tweak_name && $saw_name && $line =~ m{\H\h*$/}) {
$output .= ($format eq 'md' ? '# ' : '') . "$line\n";
$output .= "[![Appveyor Badge](https://ci.appveyor.com/api/projects/status/github/${appveyor_badge}?svg=true)](https://ci.appveyor.com/project/${appveyor})\n\n" if $appveyor;
$output .= "[![Appveyor Status](https://img.shields.io/appveyor/ci/${appveyor_badge}.svg?logo=appveyor)](https://ci.appveyor.com/project/${appveyor}) " if $appveyor;
$output .= "[![Travis Status](https://img.shields.io/travis/${travis_badge}.svg?logo=travis)](https://travis-ci.org/${travis}) " if $travis;

$output .= "\n\n" if $appveyor || $travis;
$saw_name = 0;
next;
} elsif($tweak_name && $saw_name) {
Expand Down

0 comments on commit f0f8b3b

Please sign in to comment.