Skip to content

Commit

Permalink
Add workflows and prep for release
Browse files Browse the repository at this point in the history
Add a CI GitHub workflow to test on all supported versions of Perl, and
drop the old Travis config.

Also add a release workflow and the Build.PL stuff to support GitHub
releases.

Require PGXN::API::Searcher v0.11.1 to ensure #23 and #26 stay fixed,
and fix the CPAN meta merging to properly generate a v2 `MYMETA.json`
file.

Increment version to v0.20.0 and update the copyright year.

Drop support for Perl 5.10 and 5.12.

Flesh out the README a bit.
  • Loading branch information
theory committed Feb 9, 2024
1 parent 3e6d1c9 commit 638ae86
Show file tree
Hide file tree
Showing 15 changed files with 169 additions and 40 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 🧪 CI
on:
push:
branches: ['*']
jobs:
build:
strategy:
matrix:
os: [[🐧, ubuntu], [🍎, macos]] # [🪟, windows]
perl: [ '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' ]
name: 🧅 Perl ${{ matrix.perl }} on ${{ matrix.os[0] }} ${{ matrix.os[1] }}
runs-on: ${{ matrix.os[1] }}-latest
steps:
- uses: actions/checkout@v4
- name: Setup Perl ${{ matrix.perl }}
uses: shogo82148/actions-setup-perl@v1
with: { perl-version: "${{ matrix.perl }}" }

- name: Brew CommonMark
if: runner.os == 'macOS'
run: |
brew install cmark
cpanm -v --notest --no-man-pages CommonMark --configure-args="INC=-I'$(brew --prefix)/include' LIBS=-L'$(brew --prefix)/lib -lcmark'"
- name: Apt CommonMark
if: runner.os == 'Linux'
run: |
sudo apt-get install libcmark-dev
cpanm -v --notest --no-man-pages CommonMark
- name: Install Dependencies
run: cpanm -vn Module::Build && cpanm -vn --installdeps --with-recommends --with-develop .
- name: Run Tests
run: perl Build.PL ./Build && ./Build test
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 🚀 Release
on:
push:
tags: [v*]
jobs:
release:
name: Release on CPAN and GitHub
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
- 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:
CPANUSER: ${{ secrets.CPAN_USERNAME }}
CPANPASS: ${{ secrets.CPAN_PASSWORD }}
run: cpan-upload --user "$CPANUSER" --password "$CPANPASS" '${{ steps.package.outputs.tarball }}'
- 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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
/*META.*
/Build
/www

.vscode/
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

27 changes: 24 additions & 3 deletions Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ my $class = Module::Build->subclass(
class => 'PGXN::Build',
code => q{
sub valid_licenses { { postgresql => 'PostgreSQL' } }
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');
}
},
);

Expand All @@ -14,7 +34,7 @@ my $build = $class->new(
license => 'postgresql',
script_files => 'bin',
configure_requires => { 'Module::Build' => '0.4209' },
test_requires => {
test_requires => {
'Test::Exception' => '0.31',
'Test::File' => '1.29',
'Test::File::Contents' => '0.20',
Expand Down Expand Up @@ -42,8 +62,8 @@ my $build = $class->new(
'Moose::Util::TypeConstraints' => '1.15',
'MooseX::Singleton' => '0.25',
'namespace::autoclean' => '0.11',
'perl' => 5.010,
'PGXN::API::Searcher' => '0.9.4',
'perl' => 5.014,
'PGXN::API::Searcher' => '0.11.1',
'Plack' => '0.9977',
'Plack::App::Directory' => 0,
'Plack::App::File' => 0,
Expand All @@ -54,6 +74,7 @@ my $build = $class->new(
'XML::LibXML' => '1.70',
},
meta_merge => {
'meta-spec' => { version => 2 },
resources => {
homepage => 'http://api.pgxn.org/',
bugtracker => 'http://github.com/pgxn/pgxn-api/issues/',
Expand Down
3 changes: 2 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Revision history for Perl extension PGXN::API

0.16.6
0.20.0
- Removed the `Capfile` and `eg` directory. Examples for managing PGXN
can now be found in the pgxn/pgxn-ops GitHub repository.
- Switched from Text::Markdown to CommonMark for parsing and formatting
Expand All @@ -20,6 +20,7 @@ Revision history for Perl extension PGXN::API
- Fix unzipping of distributions to ensure that all directories are
readable and executable but not writeable by all, and that files are
only readable by all (#15).
- Dropped support for Perl 5.10 and 5.12.

0.16.5 2016-06-22T18:03:05Z
- Fixed a test failure on systems with a non-English locale, thanks to
Expand Down
4 changes: 1 addition & 3 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
,v$
\B\.svn\b
\B\.git
\.vscode

# Avoid Makemaker generated and utility files.
\bMakefile$
Expand Down Expand Up @@ -33,6 +34,3 @@

# Avoid Pod tests.
t/pod.+

^MYMETA.yml$
^MYMETA\.json$
56 changes: 50 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,58 @@
PGXN/API version 0.16.6
=======================
PGXN/API
========

This application provides a REST API for flexible searching of PGXN
distribution metadata and documentation. It is currently in development. Watch
this space and the [PGXN Blog](http://blog.pgxn.org/) as things develop!
This application provides a REST API for flexible searching of PGXN distribution
metadata and documentation. See [the docs](https://github.com/pgxn/pgxn-api/wiki)
for details on using the API.

Installation
------------

To install this module, type the following:

perl Build.PL
./Build
./Build test
./Build install

Dependencies
------------

PGXN-API requires Perl 5.14 and the following modules:

* Archive::Zip
* Cwd
* CommonMark
* Data::Dump
* Digest::SHA1
* Email::MIME::Creator
* Email::Sender::Simple
* File::Path
* File::Copy::Recursive
* File::Spec
* JSON
* JSON::XS
* List::Util
* List::MoreUtils
* Lucy
* Moose
* Moose::Util::TypeConstraints
* MooseX::Singleton
* namespace::autoclean
* PGXN::API::Searcher
* Plack
* Plack::App::Directory
* Plack::App::File
* Plack::Middleware::JSONP
* Plack::Builder
* Text::Markup
* URI::Template
* XML::LibXML

Copyright and License
---------------------

Copyright (c) 2011-2013 David E. Wheeler.
Copyright (c) 2011-2024 David E. Wheeler.

This module is free software; you can redistribute it and/or modify it under
the [PostgreSQL License](http://www.opensource.org/licenses/postgresql).
Expand Down
4 changes: 2 additions & 2 deletions bin/pgxn_api_server
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/local/bin/perl -w

use 5.10.0;
use v5.14;
use utf8;
use PGXN::API::Router;
use Plack::Runner;
Expand Down Expand Up @@ -233,7 +233,7 @@ David E. Wheeler <david.wheeler@pgexperts.com>
=head1 Copyright and License
Copyright (c) 2011-2013 David E. Wheeler.
Copyright (c) 2011-2024 David E. Wheeler.
This module is free software; you can redistribute it and/or modify it under
the L<PostgreSQL License|http://www.opensource.org/licenses/postgresql>.
Expand Down
4 changes: 2 additions & 2 deletions bin/pgxn_api_sync
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/local/bin/perl -w

use 5.10.0;
use v5.14;
use utf8;
use PGXN::API::Sync;
use Getopt::Long;
Expand Down Expand Up @@ -87,7 +87,7 @@ David E. Wheeler <david.wheeler@pgexperts.com>
=head1 Copyright and License
Copyright (c) 2011-2013 David E. Wheeler.
Copyright (c) 2011-2024 David E. Wheeler.
This module is free software; you can redistribute it and/or modify it under
the L<PostgreSQL License|http://www.opensource.org/licenses/postgresql>.
Expand Down
6 changes: 3 additions & 3 deletions lib/PGXN/API.pm
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package PGXN::API;

use 5.10.0;
use v5.14;
use utf8;
use MooseX::Singleton;
use File::Spec::Functions qw(catfile catdir);
use URI::Template;
use JSON;
use namespace::autoclean;
our $VERSION = v0.16.6;
our $VERSION = v0.20.0;

=head1 Name
Expand Down Expand Up @@ -308,7 +308,7 @@ David E. Wheeler <david.wheeler@pgexperts.com>
=head1 Copyright and License
Copyright (c) 2011-2013 David E. Wheeler.
Copyright (c) 2011-2024 David E. Wheeler.
This module is free software; you can redistribute it and/or modify it under
the L<PostgreSQL License|http://www.opensource.org/licenses/postgresql>.
Expand Down
6 changes: 3 additions & 3 deletions lib/PGXN/API/Indexer.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package PGXN::API::Indexer;

use 5.10.0;
use v5.14;
use utf8;
use Moose;
use PGXN::API;
Expand All @@ -20,7 +20,7 @@ use Lucy::Index::Indexer;
use Try::Tiny;
use Archive::Zip qw(AZ_OK);
use namespace::autoclean;
our $VERSION = v0.16.6;
our $VERSION = v0.20.0;

has verbose => (is => 'rw', isa => 'Int', default => 0);
has _index_it => (is => 'rw', isa => 'Bool', default => 1);
Expand Down Expand Up @@ -1515,7 +1515,7 @@ David E. Wheeler <david.wheeler@pgexperts.com>
=head1 Copyright and License
Copyright (c) 2011-2013 David E. Wheeler.
Copyright (c) 2011-2024 David E. Wheeler.
This module is free software; you can redistribute it and/or modify it under
the L<PostgreSQL License|http://www.opensource.org/licenses/postgresql>.
Expand Down
6 changes: 3 additions & 3 deletions lib/PGXN/API/Router.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package PGXN::API::Router;

use 5.10.0;
use v5.14;
use utf8;
use PGXN::API;
use Plack::Builder;
Expand All @@ -13,7 +13,7 @@ use Plack::Request;
use Encode;
use File::Spec::Functions qw(catdir);
use namespace::autoclean;
our $VERSION = v0.16.6;
our $VERSION = v0.20.0;

sub app {
my ($class, %params) = @_;
Expand Down Expand Up @@ -226,7 +226,7 @@ David E. Wheeler <david.wheeler@pgexperts.com>
=head1 Copyright and License
Copyright (c) 2011-2013 David E. Wheeler.
Copyright (c) 2011-2024 David E. Wheeler.
This module is free software; you can redistribute it and/or modify it under
the L<PostgreSQL License|http://www.opensource.org/licenses/postgresql>.
Expand Down
6 changes: 3 additions & 3 deletions lib/PGXN/API/Sync.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package PGXN::API::Sync;

use 5.10.0;
use v5.14;
use utf8;
use Moose;
use PGXN::API;
Expand All @@ -14,7 +14,7 @@ use Archive::Zip qw(:ERROR_CODES);
use constant WIN32 => $^O eq 'MSWin32';
use Moose::Util::TypeConstraints;
use namespace::autoclean;
our $VERSION = v0.16.6;
our $VERSION = v0.20.0;

subtype Executable => as 'Str', where {
my $exe = $_;
Expand Down Expand Up @@ -389,7 +389,7 @@ David E. Wheeler <david.wheeler@pgexperts.com>
=head1 Copyright and License
Copyright (c) 2011-2013 David E. Wheeler.
Copyright (c) 2011-2024 David E. Wheeler.
This module is free software; you can redistribute it and/or modify it under
the L<PostgreSQL License|http://www.opensource.org/licenses/postgresql>.
Expand Down
2 changes: 1 addition & 1 deletion t/router.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env perl -w

use 5.10.0;
use v5.14;
use utf8;
BEGIN { $ENV{EMAIL_SENDER_TRANSPORT} = 'Test' }
use Test::More tests => 196;
Expand Down

0 comments on commit 638ae86

Please sign in to comment.