Skip to content

Commit

Permalink
Update the distribution to the latest version of Dist::Setup 0.15.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkende committed May 6, 2024
1 parent b7dd52d commit 8b73532
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 29 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos , windows]
os: [ ubuntu, windows, macos, ]
perl: [ '5.26', '5.38' ]
exclude:
# MacOS runners are very expensive, so let’s run only on the latest Perl
Expand Down Expand Up @@ -51,18 +51,26 @@ jobs:
run: |
perl -v
- name: Install aspell
if: ${{ matrix.os == 'ubuntu' }}
run: |
sudo apt-get install aspell
- name: Install Modules
if: ${{ matrix.os != 'macos' }}
run: |
cpanm -V
cpanm -v --installdeps --notest --with-configure --with-recommends --with-suggests --with-all-features .
- name: Install aspell
if: ${{ matrix.os == 'ubuntu' }}
# MacOS runners are very costly, so let’s install the minimum amount of
# dependency.
- name: Install Modules on MacOS
if: ${{ matrix.os == 'macos' }}
run: |
sudo apt-get install aspell
cpanm -V
cpanm -v --installdeps --notest --with-configure --without-recommends --without-suggests .
- name: Run tests
- name: Run tests on Linux
if: ${{ matrix.os == 'ubuntu' }}
env:
AUTOMATED_TESTING: 1
Expand All @@ -76,7 +84,7 @@ jobs:
# MacOS runners are very costly, so let’s not run the EXTENDED_TESTING
# tests, to save some cost.
- name: Run tests
- name: Run tests on MacOS
if: ${{ matrix.os == 'macos' }}
env:
AUTOMATED_TESTING: 1
Expand All @@ -102,7 +110,7 @@ jobs:
gmake
gmake test
- name: Show Errors on Ubuntu
- name: Show Errors on Linux
if: ${{ failure() && matrix.os == 'ubuntu' }}
run: |
cat /home/runner/.cpanm/work/*/build.log
Expand All @@ -114,7 +122,7 @@ jobs:
ls -l C:/Users/RUNNER~1/
cat C:/Users/runneradmin/.cpanm/work/*/build.log
- name: Show Errors on OSX
- name: Show Errors on MacOS
if: ${{ failure() && matrix.os == 'macos' }}
run: |
cat /Users/runner/.cpanm/work/*/build.log
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
/cover_db/
/local/
/pm_to_blib
/pod2htmd.tmp
/pod2html/
/temp/
/vendor/
/*.tar.gz
Expand Down
4 changes: 3 additions & 1 deletion .perlcriticrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ minimum_regex_length_to_complain_about = 30
[-RegularExpressions::RequireDotMatchAnything]
[-RegularExpressions::RequireLineBoundaryMatching]

# The ',' syntax is nicer than q{,} in my opinion.
[-ValuesAndExpressions::ProhibitNoisyQuotes]

# End of the template. You can add custom content below this line.

# This is inconvenient
[-ValuesAndExpressions::ProhibitEmptyQuotes]
[-ValuesAndExpressions::ProhibitNoisyQuotes]

# 0, 1, and 2 are always allowed. We are adding 3 and 4 as they are very
# frequently used here to match spaces, with a tab-stop of 4.
Expand Down
6 changes: 3 additions & 3 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
^Makefile.old$
^MANIFEST\.bak$
^MANIFEST\.SKIP$
^README(\..*)?^
^README(\..*)?$
^blib/
^cover_db/
^cpanfile\.snapshot$
Expand All @@ -25,6 +25,8 @@
^t/001-spelling.t
^third_party/
^pm_to_blib$
^pod2htmd\.tmp$
^pod2html/
^Markdown-Perl-[\d.]+/
^Markdown-Perl-[\d.]+\.tar\.gz
.*\.bak
Expand All @@ -37,6 +39,4 @@
^nytprof/
^build/
^.*\.code-workspace$
^README\.md$
^Syntax\.md$
^pod2htmd\.tmp$
43 changes: 31 additions & 12 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ WriteMakefile(
# Goes with NO_MYMETA (which would provide the dynamic config).
dynamic_config => 0,
no_index => {
directory => [ 'local', 'vendor' ],
directory => [ 'local', 'vendor', 't' ],
},
resources => {
repository => {
Expand All @@ -53,6 +53,11 @@ sub MY::postamble {

# Solaris has a weird (?) make that does not support our `export` statements.
push @postamble, <<"MAKE_FRAGMENT" unless $^O eq 'solaris';
ALL_PM := \$(shell find lib -name "*.pm")
ALL_EXE := script/pmarkdown
.PHONY: distupload cover critic rawcritic tidy spelling alltest clean clean_coverdb pod2html exe
distupload: distcheck disttest
\t\$(MAKE) tardist
\tcpan-upload --directory Dist-Setup \$(DISTVNAME).tar\$(SUFFIX)
Expand All @@ -68,7 +73,7 @@ rawcritic:
\tperlcritic lib script
tidy:
\tperltidy -b -bext='/' \$(shell find lib -name "*.pm") script/pmarkdown
\tperltidy -b -bext='/' \$(ALL_PM) \$(ALL_EXE)
spelling: export EXTENDED_TESTING = 1
spelling:
Expand All @@ -81,6 +86,30 @@ clean:: clean_coverdb
clean_coverdb:
\trm -fr cover_db
PM_HTML := \$(patsubst %.pm, pod2html/%.html, \$(ALL_PM))
EXE_HTML := \$(patsubst %, pod2html/%.html, \$(ALL_EXE))
pod2html: \$(PM_HTML) \$(EXE_HTML)
\$(PM_HTML): pod2html/%.html: %.pm
\tmkdir -p \$(shell dirname \$@)
\tpod2html --infile \$< --outfile \$@
\$(EXE_HTML): pod2html/%.html: %
\tmkdir -p \$(shell dirname \$@)
\tpod2html --infile \$< --outfile \$@
EXE_EXE := \$(patsubst %, build/%\$(EXE_EXT), \$(ALL_EXE))
exe: export PAR_VERBATIM=1
exe: build \$(EXE_EXE)
build:
\tmkdir -p build
\$(EXE_EXE): build/%\$(EXE_EXT): %
\tpp -o \$@ -cd build/pp.cache -I lib -F "PodStrip=.*\\bMarkdown/Perl\\b(*COMMIT)(*FAIL)|.*" \$<
MAKE_FRAGMENT

return join "\n", @postamble;
Expand All @@ -104,16 +133,6 @@ clean:: clean_nytprof
clean_nytprof:
\trm -fr nytprof nytprof.out
exe: build build/pmarkdown\$(EXE_EXT)
build:
\tmkdir -p build
.PHONY: build/pmarkdown\$(EXE_EXT)
build/pmarkdown\$(EXE_EXT): export PAR_VERBATIM=1
build/pmarkdown\$(EXE_EXT):
\tpp -o build/pmarkdown\$(EXE_EXT) -cd build/pp.cache -I lib -F "PodStrip=.*\\bMarkdown/Perl\\b(*COMMIT)(*FAIL)|.*" script/pmarkdown
test: export HARNESS_OPTIONS = j8:c
fuzzing: export MAXI_TEST = 1
Expand Down
5 changes: 4 additions & 1 deletion cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on 'test' => sub {
requires 'Test2::V0';
requires 'Readonly';
recommends 'Test::Pod', '1.22';
recommends 'CPAN::Common::Index::Mux::Ordered';
suggests 'IPC::Run3'; # Only used for spell-checking which is not included in the distribution
suggests 'Test2::Tools::PerlCritic';
suggests 'Perl::Tidy', '20220613';
Expand All @@ -23,6 +24,9 @@ on 'test' => sub {
# Devel::Cover has many dependencies.
on 'develop' => sub {
recommends 'Devel::Cover';
suggests 'CPAN::Uploader';
suggests 'PAR::Packer';
suggests 'Dist::Setup';
};

# End of the template. You can add custom content below this line.
Expand All @@ -41,5 +45,4 @@ on 'test' => sub {

on 'develop' => sub {
recommends 'Devel::NYTProf';
suggests 'PAR::Packer'
};
27 changes: 25 additions & 2 deletions t/001-cpanfile.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,35 @@
use strict;
use warnings;

use English;
use Test::CPANfile;
use Test2::V0;

our $VERSION = 0.01;
our $VERSION = 0.02;

cpanfile_has_all_used_modules(perl_version => 5.026, develop => 1, suggests => 1);
BEGIN {
if ($ENV{HARNESS_ACTIVE} && !$ENV{EXTENDED_TESTING}) {
skip_all('Extended test. Run manually or set $ENV{EXTENDED_TESTING} to a true value to run.');
}
}

BEGIN {
# This module seems to have trouble installing on some platform, so it’s
# optional in the cpanfile and we skip the test if it’s not installed.
eval 'use CPAN::Common::Index::Mux::Ordered'; ## no critic (ProhibitStringyEval, RequireCheckingReturnValueOfEval)
if ($EVAL_ERROR) {
skip_all('CPAN::Common::Index::Mux::Ordered required to validate the CPAN file');
}
}

cpanfile_has_all_used_modules(
perl_version => 5.024,
develop => 1,
suggests => 1,
index => CPAN::Common::Index::Mux::Ordered->assemble(
MetaDB => {},
Mirror => {},
));

done_testing;

Expand Down
6 changes: 5 additions & 1 deletion t/001-spelling.t
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ my @base_cmd = (
# all cases, it would not handle POD content). so we are passing manually the
# options to the "context" filters underlying the perl mode.
my %lang_filter = (
html => ['--mode=sgml'],
markdown => ['--mode=markdown'],
perl => [
'--mode=none', '--add-filter=url',
Expand Down Expand Up @@ -77,14 +78,17 @@ sub interactive_check {

sub wanted {
# We should do something more generic to not recurse in Git sub-modules.
$File::Find::prune = 1 if -d && m/^ (?: blib | third_party | \..+ ) $/x;
$File::Find::prune = 1
if -d && m/^ (?: blib | third_party | pod2html | build | cover_db | nytprof | \..+ ) $/x;
return unless -f;

my $type;
if (m/\.(?:pm|pod)$/ || basename($File::Find::dir) eq 'script') {
$type = 'perl';
} elsif (m/\.md$/) {
$type = 'markdown';
} elsif (m/\.html$/) {
$type = 'html';
} else {
return;
}
Expand Down

0 comments on commit 8b73532

Please sign in to comment.