Skip to content

Commit

Permalink
Modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Aug 11, 2024
1 parent f61d243 commit f7bf860
Show file tree
Hide file tree
Showing 10 changed files with 200 additions and 24 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: ✅ CI
on: [push, pull_request]
jobs:
test:
strategy:
matrix:
os:
- { icon: 🐧, name: ubuntu }
- { icon: 🍎, name: macos }
- { icon: 🪟, name: windows }
perl: [ '5.40', '5.38', '5.36', '5.34', '5.32', '5.30', '5.28', '5.26', '5.24', '5.22', '5.20', '5.18', '5.16', '5.14', '5.12', '5.10', '5.8' ]
name: 🐪 Perl ${{ matrix.perl }} on ${{ matrix.os.icon }}
runs-on: ${{ matrix.os.name }}-latest
steps:
- uses: actions/checkout@v4
- name: Setup Perl
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl }}
- name: Install Dependencies
run: |
cpanm -v --notest --no-man-pages Module::Build
cpanm -v --notest --no-man-pages --installdeps --with-develop .
- name: Test
env:
AUTHOR_TESTING: 1
RELEASE_TESTING: 1
run: prove -lv

# Make sure we can build the distribution bundle.
- name: Test Distro
if: runner.os == 'Linux'
run: |
prove -l xt
perl Build.PL
./Build
./Build manifest
./Build disttest
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 🚀 Release
on:
push:
# tags: [v*]
jobs:
release:
name: 🚀 Release
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Setup Perl
uses: shogo82148/actions-setup-perl@v1
- name: Install Release Dependencies
run: cpanm -qn Module::Build CPAN::Uploader

# CPAN
- name: Package the Release
id: package
run: perl Build.PL && ./Build manifest && ./Build dist && echo "tarball=$(./Build tarball_name)" >> $GITHUB_OUTPUT
- name: Generate Release Changes
run: ./Build latest_changes
# - name: Release on CPAN
# env:
# CPANPASS: ${{ secrets.CPAN_PASSWORD }}
# CPANUSER: ${{ secrets.CPAN_USERNAME }}
# run: cpan-upload --user "$CPANUSER" --password "$CPANPASS" '${{ steps.package.outputs.tarball }}'

# # GitHub
# - name: Create GitHub Release
# id: release
# uses: actions/create-release@v1
# with:
# tag_name: ${{ github.ref }}
# release_name: Release ${{ github.ref }}
# body_path: latest_changes.md
# - name: Upload Release Asset
# uses: actions/upload-release-asset@v1
# with:
# upload_url: ${{ steps.release.outputs.upload_url }}
# asset_path: ./${{ steps.package.outputs.tarball }}
# asset_name: ${{ steps.package.outputs.tarball }}
# asset_content_type: application/gzip
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
/Build
/Makefile*
/pm_to_blib
/t/scripts
/t/scripts
/latest_changes.md
t/TEST
56 changes: 46 additions & 10 deletions Build.PL
Original file line number Diff line number Diff line change
@@ -1,16 +1,42 @@
use Module::Build;


my $build_pkg = eval { require Apache::TestMB }
? 'Apache::TestMB' : 'Module::Build';

$build_pkg->new(
my $class = $build_pkg->subclass(
class => 'My::Builder',
code => q{
sub ACTION_tarball_name { print shift->dist_dir . ".tar.gz\n" }
sub ACTION_latest_changes {
my $self = shift;
(my $dv = $self->dist_version) =~ s/^v//;
open my $in, '<:raw', 'Changes' or die "Cannot open Changes: $!\n";
open my $out, '>:raw', 'latest_changes.md' or die "Cannot open latest_changes.md: $!\n";
while (<$in>) { last if /^\Q$dv\E\b/ }
print {$out} "Changes for v$dv\n";
while (<$in>) {
last if /^\s*$/;
chomp;
if (s/^\s+-/- /) {
print {$out} "\n";
} else {
s/^\s+/ /;
}
print {$out} $_;
}
$self->add_to_cleanup('latest_changes.md');
}
},
);

$class->new(
module_name => 'MasonX::Interp::WithCallbacks',
license => 'perl',
configure_requires => { 'Module::Build' => '0.2701' },
build_requires => {
'Module::Build' => '0.2701',
'Test::More' => '0.17',
},
create_makefile_pl => 'traditional',
configure_requires => { 'Module::Build' => '0.4209' },
build_requires => { 'Module::Build' => '0.4209' },
test_requires => { 'Test::More' => '0.17' },
recommends => {
'Test::Pod' => '1.20',
'Apache::TestMB' => 0
Expand All @@ -23,10 +49,20 @@ $build_pkg->new(
},
add_to_cleanup => ['t/mason'],
meta_merge => {
"meta-spec" => { version => 2 },
resources => {
homepage => 'http://search.cpan.org/dist/MasonX-Interp-WithCallbacks/',
bugtracker => 'http://github.com/theory/masonx-interp-withcallbacks/issues/',
repository => 'http://github.com/theory/masonx-interp-withcallbacks/',
}
homepage => 'https://metacpan.org/pod/MasonX::Interp::WithCallbacks',
bugtracker => 'https://github.com/theory/masonx-interp-withcallbacks/issues/',
repository => 'https://github.com/theory/masonx-interp-withcallbacks',
},
prereqs => {
develop => {
requires => {
'Test::Pod' => '1.41',
'Test::Pod::Coverage' => '1.06',
'Test::Spelling' => '0.25',
},
},
},
},
)->create_build_script;
38 changes: 32 additions & 6 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
^_build
^Build$
^blib
# Avoid version control files.
\bRCS\b
\bCVS\b
,v$
\B\.svn\b
\B\.git

# Avoid Makemaker generated and utility files.
\bMakefile$
\bblib
\bMakeMaker-\d
\bpm_to_blib$
\bblibdirs$
^MANIFEST\.SKIP$

# Avoid Module::Build generated and utility files.
\bBuild$
\b_build

# Avoid temp and backup files.
~$
\.tmp$
\.old$
\.bak$
^MANIFEST\.SKIP$
\#$
\b\.#

# Avoid build files.
^MasonX-Interp-WithCallbacks
\.git
^[.]travis.yml
^t.TEST$
^MYMETA\.yml$

# Avoid extra tests.
^xt/

^MYMETA.yml$
^MYMETA\.json$
8 changes: 8 additions & 0 deletions lib/MasonX/Interp/WithCallbacks.pm
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,14 @@ In this example, we have overridden the component path determined by the
Mason resolver in favor of an alternate component, which will be executed,
instead.
=head3 make_request
Overrides and re-dispatches to L<HTML::Mason::Interp/"make_request">.
=head3 purge_code_cache
Overrides and re-dispatches to L<HTML::Mason::Interp/"purge_code_cache">.
=head2 Requester
The MasonX::Interp::WithCallbacks object is available in all callback methods
Expand Down
7 changes: 0 additions & 7 deletions t/10pod.t

This file was deleted.

6 changes: 6 additions & 0 deletions xt/pod-coverage.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use Test::More;
eval "use Test::Pod::Coverage 0.08";
plan skip_all => "Test::Pod::Coverage 0.08 required for testing POD coverage" if $@;
all_pod_coverage_ok({
also_private => [ 'parser' ]
});
15 changes: 15 additions & 0 deletions xt/pod-spelling.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env perl

use strict;
use Test::More;
eval "use Test::Spelling";
plan skip_all => "Test::Spelling required for testing POD spelling" if $@;

add_stopwords(<DATA>);
all_pod_files_spelling_ok();

__DATA__
Bricolage
Widgitization
preloaded
preprocess
7 changes: 7 additions & 0 deletions xt/pod.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env perl

use strict;
use Test::More;
eval "use Test::Pod 1.41";
plan skip_all => "Test::Pod 1.41 required for testing POD" if $@;
all_pod_files_ok();

0 comments on commit f7bf860

Please sign in to comment.