From 8b73532c7cb6918c00b1e383a5ded84425b62520 Mon Sep 17 00:00:00 2001 From: Mathias Kende Date: Mon, 6 May 2024 23:58:08 +0200 Subject: [PATCH] Update the distribution to the latest version of Dist::Setup 0.15. --- .github/workflows/ci.yml | 26 +++++++++++++++--------- .gitignore | 2 ++ .perlcriticrc | 4 +++- MANIFEST.SKIP | 6 +++--- Makefile.PL | 43 +++++++++++++++++++++++++++++----------- cpanfile | 5 ++++- t/001-cpanfile.t | 27 +++++++++++++++++++++++-- t/001-spelling.t | 6 +++++- 8 files changed, 90 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c25dc2..1430836 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.gitignore b/.gitignore index 521da0b..bdf18f1 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ /cover_db/ /local/ /pm_to_blib +/pod2htmd.tmp +/pod2html/ /temp/ /vendor/ /*.tar.gz diff --git a/.perlcriticrc b/.perlcriticrc index c633999..06a6965 100644 --- a/.perlcriticrc +++ b/.perlcriticrc @@ -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. diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP index 95927dd..c86f4f9 100644 --- a/MANIFEST.SKIP +++ b/MANIFEST.SKIP @@ -14,7 +14,7 @@ ^Makefile.old$ ^MANIFEST\.bak$ ^MANIFEST\.SKIP$ -^README(\..*)?^ +^README(\..*)?$ ^blib/ ^cover_db/ ^cpanfile\.snapshot$ @@ -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 @@ -37,6 +39,4 @@ ^nytprof/ ^build/ ^.*\.code-workspace$ -^README\.md$ ^Syntax\.md$ -^pod2htmd\.tmp$ diff --git a/Makefile.PL b/Makefile.PL index b1e3aeb..12c5e76 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -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 => { @@ -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) @@ -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: @@ -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; @@ -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 diff --git a/cpanfile b/cpanfile index abdd7b0..9143515 100644 --- a/cpanfile +++ b/cpanfile @@ -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'; @@ -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. @@ -41,5 +45,4 @@ on 'test' => sub { on 'develop' => sub { recommends 'Devel::NYTProf'; - suggests 'PAR::Packer' }; diff --git a/t/001-cpanfile.t b/t/001-cpanfile.t index d024d6c..0bed14e 100644 --- a/t/001-cpanfile.t +++ b/t/001-cpanfile.t @@ -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; diff --git a/t/001-spelling.t b/t/001-spelling.t index 6e4c0fd..18f52bc 100644 --- a/t/001-spelling.t +++ b/t/001-spelling.t @@ -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', @@ -77,7 +78,8 @@ 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; @@ -85,6 +87,8 @@ sub wanted { $type = 'perl'; } elsif (m/\.md$/) { $type = 'markdown'; + } elsif (m/\.html$/) { + $type = 'html'; } else { return; }