From 638ae86604f3232e9bef27b6a57608bd239321ac Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Thu, 8 Feb 2024 19:32:53 -0500 Subject: [PATCH] Add workflows and prep for release 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. --- .github/workflows/ci.yml | 34 +++++++++++++++++++++ .github/workflows/release.yml | 41 +++++++++++++++++++++++++ .gitignore | 1 - .travis.yml | 9 ------ Build.PL | 27 +++++++++++++++-- Changes | 3 +- MANIFEST.SKIP | 4 +-- README.md | 56 +++++++++++++++++++++++++++++++---- bin/pgxn_api_server | 4 +-- bin/pgxn_api_sync | 4 +-- lib/PGXN/API.pm | 6 ++-- lib/PGXN/API/Indexer.pm | 6 ++-- lib/PGXN/API/Router.pm | 6 ++-- lib/PGXN/API/Sync.pm | 6 ++-- t/router.t | 2 +- 15 files changed, 169 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1a55ae8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ce4385e --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/.gitignore b/.gitignore index 2a17c37..0e77273 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,4 @@ /*META.* /Build /www - .vscode/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a69365c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: perl -perl: - - "5.22" - - "5.20" - - "5.18" - - "5.16" - - "5.14" - - "5.12" - - "5.10" diff --git a/Build.PL b/Build.PL index c4220a1..8f712c8 100644 --- a/Build.PL +++ b/Build.PL @@ -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'); + } }, ); @@ -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', @@ -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, @@ -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/', diff --git a/Changes b/Changes index 852e826..28ff6fd 100644 --- a/Changes +++ b/Changes @@ -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 @@ -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 diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP index f50beb0..d81b0b2 100644 --- a/MANIFEST.SKIP +++ b/MANIFEST.SKIP @@ -4,6 +4,7 @@ ,v$ \B\.svn\b \B\.git +\.vscode # Avoid Makemaker generated and utility files. \bMakefile$ @@ -33,6 +34,3 @@ # Avoid Pod tests. t/pod.+ - -^MYMETA.yml$ -^MYMETA\.json$ diff --git a/README.md b/README.md index fd21d55..726a4f9 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/bin/pgxn_api_server b/bin/pgxn_api_server index 7908beb..ffb1c00 100755 --- a/bin/pgxn_api_server +++ b/bin/pgxn_api_server @@ -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; @@ -233,7 +233,7 @@ David E. Wheeler =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. diff --git a/bin/pgxn_api_sync b/bin/pgxn_api_sync index 0e43bbb..44a2f3d 100755 --- a/bin/pgxn_api_sync +++ b/bin/pgxn_api_sync @@ -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; @@ -87,7 +87,7 @@ David E. Wheeler =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. diff --git a/lib/PGXN/API.pm b/lib/PGXN/API.pm index 9579357..d1240d6 100644 --- a/lib/PGXN/API.pm +++ b/lib/PGXN/API.pm @@ -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 @@ -308,7 +308,7 @@ David E. Wheeler =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. diff --git a/lib/PGXN/API/Indexer.pm b/lib/PGXN/API/Indexer.pm index deac57b..02b7d59 100644 --- a/lib/PGXN/API/Indexer.pm +++ b/lib/PGXN/API/Indexer.pm @@ -1,6 +1,6 @@ package PGXN::API::Indexer; -use 5.10.0; +use v5.14; use utf8; use Moose; use PGXN::API; @@ -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); @@ -1515,7 +1515,7 @@ David E. Wheeler =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. diff --git a/lib/PGXN/API/Router.pm b/lib/PGXN/API/Router.pm index 75e61b7..4d49d7b 100644 --- a/lib/PGXN/API/Router.pm +++ b/lib/PGXN/API/Router.pm @@ -1,6 +1,6 @@ package PGXN::API::Router; -use 5.10.0; +use v5.14; use utf8; use PGXN::API; use Plack::Builder; @@ -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) = @_; @@ -226,7 +226,7 @@ David E. Wheeler =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. diff --git a/lib/PGXN/API/Sync.pm b/lib/PGXN/API/Sync.pm index 8108ce2..716b07f 100644 --- a/lib/PGXN/API/Sync.pm +++ b/lib/PGXN/API/Sync.pm @@ -1,6 +1,6 @@ package PGXN::API::Sync; -use 5.10.0; +use v5.14; use utf8; use Moose; use PGXN::API; @@ -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 = $_; @@ -389,7 +389,7 @@ David E. Wheeler =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. diff --git a/t/router.t b/t/router.t index aea7ecc..9cdf41d 100644 --- a/t/router.t +++ b/t/router.t @@ -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;