Skip to content

Commit dedd755

Browse files
theoryoalders
authored andcommitted
Add test and release workflows
Remove Travis CI config, which wasn't working anymore. The test workflow tests Perls 5.8 - 5.36 on Linux, macOS, and Windows. The release workflow uses a custom Build.PL targets to build a list of changes and to print the name of the tarball for releasing on GitHub. Requires GitHub secrets `CPAN_PASSWORD` and `CPAN_USERNAME` to release on CPAN.
1 parent b86fa5d commit dedd755

File tree

6 files changed

+101
-46
lines changed

6 files changed

+101
-46
lines changed

.github/workflows/ci.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: ✅ CI
2+
on: [push, pull_request]
3+
jobs:
4+
test:
5+
strategy:
6+
matrix:
7+
os: [ubuntu-latest, macos-latest, windows-latest]
8+
perl: [ '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' ]
9+
name: 🐪 Perl ${{ matrix.perl }} on ${{ matrix.os }}
10+
runs-on: ${{ matrix.os }}
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Setup Perl
14+
uses: shogo82148/actions-setup-perl@v1
15+
with:
16+
perl-version: ${{ matrix.perl }}
17+
env:
18+
AUTHOR_TESTING: 1
19+
RELEASE_TESTING: 1
20+
- name: Build and Test
21+
# Have to build on Windows to get scripts\psql.bat.
22+
run: |
23+
perl -V
24+
cpanm --notest --installdeps . # https://github.com/Perl-Toolchain-Gang/extutils-pl2bat/issues/7
25+
perl Build.PL
26+
perl Build code
27+
prove -lv t

.github/workflows/release.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 🚀 Release
2+
on:
3+
push:
4+
tags: [v*]
5+
jobs:
6+
release:
7+
name: 🚀 Release
8+
runs-on: ubuntu-latest
9+
env:
10+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11+
steps:
12+
- name: Check out the repo
13+
uses: actions/checkout@v3
14+
- name: Setup Perl
15+
uses: shogo82148/actions-setup-perl@v1
16+
- name: Install Release Dependencies
17+
run: cpanm -qn Module::Build CPAN::Uploader
18+
19+
# CPAN
20+
- name: Package the Release
21+
id: package
22+
run: perl Build.PL && ./Build manifest && ./Build dist && echo "tarball=$(./Build tarball_name)" >> $GITHUB_OUTPUT
23+
- name: Generate Release Changes
24+
run: ./Build latest_changes
25+
- name: Release on CPAN
26+
env:
27+
CPANPASS: ${{ secrets.CPAN_PASSWORD }}
28+
CPANUSER: ${{ secrets.CPAN_USERNAME }}
29+
run: cpan-upload --user "$CPANUSER" --password "$CPANPASS" '${{ steps.package.outputs.tarball }}'
30+
31+
# GitHub
32+
- name: Create GitHub Release
33+
id: release
34+
uses: actions/create-release@v1
35+
with:
36+
tag_name: ${{ github.ref }}
37+
release_name: Release ${{ github.ref }}
38+
body_path: latest_changes.md
39+
- name: Upload Release Asset
40+
uses: actions/upload-release-asset@v1
41+
with:
42+
upload_url: ${{ steps.release.outputs.upload_url }}
43+
asset_path: ./${{ steps.package.outputs.tarball }}
44+
asset_name: ${{ steps.package.outputs.tarball }}
45+
asset_content_type: application/gzip

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
/Build
88
/Makefile*
99
/pm_to_blib
10+
/latest_changes.md

.travis.yml

-44
This file was deleted.

Build.PL

+27-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,33 @@ use strict;
22
use warnings;
33
use Module::Build;
44

5-
Module::Build->new(
5+
my $class = Module::Build->subclass(
6+
class => 'My::Builder',
7+
code => q{
8+
sub ACTION_tarball_name { print shift->dist_dir . ".tar.gz\n" }
9+
sub ACTION_latest_changes {
10+
my $self = shift;
11+
(my $dv = $self->dist_version) =~ s/^v//;
12+
open my $in, '<:raw', 'Changes' or die "Cannot open Changes: $!\n";
13+
open my $out, '>:raw', 'latest_changes.md' or die "Cannot open latest_changes.md: $!\n";
14+
while (<$in>) { last if /^\Q$dv\E\b/ }
15+
print {$out} "Changes for v$dv\n";
16+
while (<$in>) {
17+
last if /^\s*$/;
18+
chomp;
19+
if (s/^\s+-/- /) {
20+
print {$out} "\n";
21+
} else {
22+
s/^\s+/ /;
23+
}
24+
print {$out} $_;
25+
}
26+
$self->add_to_cleanup('latest_changes.md');
27+
}
28+
},
29+
);
30+
31+
$class->new(
632
module_name => 'URI::db',
733
license => 'perl',
834
configure_requires => { 'Module::Build' => '0.30', },

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Database URI
22
============
33

44
[![CPAN version](https://badge.fury.io/pl/URI-db.svg)](http://badge.fury.io/pl/URI-db)
5-
[![Build Status](https://travis-ci.org/theory/sqitch.svg?branch=master)](https://travis-ci.org/theory/uri-db)
5+
[![Build Status](https://github.com/libwww-perl/URI-db/actions/workflows/ci.yml/badge.svg)](https://github.com/libwww-perl/URI-db/actions/workflows/ci.yml)
66

77
This project proposes a standard for database connection URIs and provides a
88
simple Perl implementation. This figure summarizes the definition syntax and

0 commit comments

Comments
 (0)