Skip to content

Commit

Permalink
Add CI/CD workflows, update links and spelling
Browse files Browse the repository at this point in the history
Modernize things a big: Add workflows for testing on all supported
versions of Perl on macOS and Linux (but not Windows, alas) and to
release on CPAN and GitHub. Also fix typos, update URLs and copyright
dates, and do some general cleanup.
  • Loading branch information
theory committed Feb 6, 2024
1 parent bb59b1d commit 7e163e2
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 40 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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', '5.12', '5.10' ]
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: Install Dependencies
run: cpanm -vn Module::Build && cpanm -vn --installdeps --with-recommends .
- 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
21 changes: 12 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
_build
blib
PGXN-API-Searcher-*
MANIFEST
MANIFEST.bak
META.*
Build
MYMETA.*
Makefile*
/_build
/blib
/PGXN-API-Searcher-*
/MANIFEST
/MANIFEST.bak
/*META.*
/Build
.DS_Store
/Makefile*
/pm_to_blib
/latest_changes.md
.vscode/
42 changes: 35 additions & 7 deletions Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,56 @@ use strict;
use warnings;
use Module::Build;

Module::Build->new(
my $class = Module::Build->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 => 'PGXN::API::Searcher',
license => 'perl',
create_makefile_pl => 'traditional',
configure_requires => { 'Module::Build' => '0.30' },
configure_requires => { 'Module::Build' => '0.4209' },
build_requires => {
'Module::Build' => '0.4209',
},
test_requires => {
'File::Path' => '2.08',
'File::Spec::Functions' => 0,
'Module::Build' => '0.30',
'Test::More' => '0.96',
},
requires => {
'Carp' => 0,
'File::Spec' => 0,
'Lucy' => '0.2.1',
'perl' => 5.010,
'perl' => '5.10.0',
},
meta_merge => {
resources => {
homepage => 'http://search.cpan.org/dist/PGXN-API-Searcher/',
bugtracker => 'http://github.com/pgxn/pgxn-api-searcher/issues/',
repository => 'http://github.com/pgxn/pgxn-api-searcher/',
homepage => 'https://metacpan.org/dist/PGXN-API-Searcher',
bugtracker => 'https://github.com/pgxn/pgxn-api-searcher/issues/',
repository => 'https://github.com/pgxn/pgxn-api-searcher/',
}
},
)->create_build_script;
4 changes: 2 additions & 2 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Revision history for Perl extension PGXN-API-Searcher.

0.10.1 2011-11-08T17:48:20Z
- Fixed test to be neutral about scores, since Lucy is prone to changing
how they're calculatd (as is the case on 0.2.2).
how they're calculated (as is the case on 0.2.2).
- Worked around bug in Lucy 0.2.2's highlighting in the tests.

0.10.0 2011-08-26T17:11:54Z
Expand Down Expand Up @@ -62,7 +62,7 @@ Revision history for Perl extension PGXN-API-Searcher.
0.6.1 2011-03-28T03:07:13Z
- The index to query is no longer specified as the first argument to
`search()`, but via the new `index` parameter.
- The `index` paraemter defaults to "doc" if it's not specified.
- The `index` parameter defaults to "doc" if it's not specified.
- Pass parameters to `search()` as a list rather than a hash reference.
- Add `index` key to the returned hash.

Expand Down
5 changes: 3 additions & 2 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\B\.svn\b
\B\.git

# Avoid Makemaker generated and utility files.
# Avoid MakeMaker generated and utility files.
\bMakefile$
\bblib
\bMakeMaker-\d
Expand All @@ -16,6 +16,7 @@
# Avoid Module::Build generated and utility files.
\bBuild$
\b_build
^latest_changes\.md$

# Avoid temp and backup files.
~$
Expand All @@ -28,7 +29,7 @@
# Avoid build files.
^PGXN-API-Searcher

# Avoid Pos tests.
# Avoid Pod tests.
t/pod.+

^MYMETA.yml$
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
PGXN/API/Search v0.10.3
=======================
PGXN/API/Searcher v0.10.3
=========================

This library's module, PGXN::API::Searcher, provides an interface to the
PGXN::API search engine index. You *must* have direct access to the index,
which is generated by PGXN::API. So if you use that module to create an API
server, you can use its index with this module. In fact, it uses *this* module
to seve the search API.
to serve the search API.

INSTALLATION

Expand All @@ -29,12 +29,12 @@ Dependencies
PGXN-API-Searcher requires the following modules:

* perl 5.12.0
* KinoeSearch 0.311
* Lucy 0.2.1

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

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

This module is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.
21 changes: 10 additions & 11 deletions lib/PGXN/API/Searcher.pm
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ PGXN::API::Searcher - PGXN API full text search interface
=head1 Description
L<PGXN|http://pgxn.org> is a L<CPAN|http://cpan.org>-inspired network for
distributing extensions for the L<PostgreSQL RDBMS|http://www.postgresql.org>.
L<PGXN|https://pgxn.org> is a L<CPAN|https://cpan.org>-inspired network for
distributing extensions for the L<PostgreSQL RDBMS|https://www.postgresql.org>.
All of the infrastructure tools, however, have been designed to be used to
create networks for distributing any kind of release distributions and for
providing a lightweight static file JSON REST API.
This module encapsulates the PGXN API search functionality. The indexes are
created by L<PGXN::API::Indexer>; this module parses search queries, executes
them against the appropriate index, and returns the results as a hash suitable
for serializing to L<JSON|http://json.org/> in response to a request.
for serializing to L<JSON|https://json.org/> in response to a request.
To use this module, one must have a path to the API server document root
created by PGXN::API. That is, with access to the same file system. It is
Expand Down Expand Up @@ -402,13 +402,12 @@ The tag name.
=head1 Support
This module is stored in an open L<GitHub
repository|http://github.com/pgxn/pgxn-api-searcher/>. Feel free to fork and
contribute!
This module is stored in an open
L<GitHub repository|https://github.com/pgxn/pgxn-api-searcher/>. Feel free to
fork and contribute!
Please file bug reports via L<GitHub
Issues|http://github.com/pgxn/pgxn-api-searcher/issues/> or by sending mail to
L<bug-PGXN-API-Searcher@rt.cpan.org|mailto:bug-PGXN-API-Searcher@rt.cpan.org>.
Please file bug reports via
L<GitHub Issues|https://github.com/pgxn/pgxn-api-searcher/issues/>.
=head1 See Also
Expand Down Expand Up @@ -445,10 +444,10 @@ David E. Wheeler <david.wheeler@pgexperts.com>
=head1 Copyright and License
Copyright (c) 2011-2013 David E. Wheeler.
Copyright (c) 2011-2014 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>.
the L<PostgreSQL License|https://opensource.org/license/postgresql/>.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without a written agreement is
Expand Down
6 changes: 3 additions & 3 deletions t/base.t
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ for my $doc (
key => 'theory',
name => 'David E. Wheeler',
user => 'theory',
uri => 'http://justatheory.com/',
uri => 'https://justatheory.com/',
},
{
type => 'tags',
Expand Down Expand Up @@ -241,7 +241,7 @@ for my $doc (
email => 'roger@example.com',
key => 'roger',
name => 'Roger Davidson',
uri => 'http://roger.example.com/',
uri => 'https://roger.example.com/',
user => 'roger',
},
{
Expand Down Expand Up @@ -460,7 +460,7 @@ is_deeply $res, {
{
excerpt => "roger Roger is a <strong>Davidson</strong>. Har har.",
name => "Roger Davidson",
uri => 'http://roger.example.com/',
uri => 'https://roger.example.com/',
user => "roger",
},
],
Expand Down
1 change: 1 addition & 0 deletions t/pod-spelling.t
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ GitHub
docpath
htmldoc
CPAN
merchantability

0 comments on commit 7e163e2

Please sign in to comment.