Skip to content

Commit

Permalink
Latest testing templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigel Horne committed Dec 2, 2020
1 parent 07bbfad commit 9373cff
Show file tree
Hide file tree
Showing 10 changed files with 246 additions and 22 deletions.
40 changes: 32 additions & 8 deletions .appveyor.yml
@@ -1,18 +1,42 @@
version: 1.0.{build}

image:
- Visual Studio 2015
- Ubuntu
- ubuntu1804

environment:
PERL5LIB: /home/appveyor/perl5/lib/perl5
AUTOMATED_TESTING: 1
DEBIAN_FRONTEND: noninteractive
PERL_MM_USE_DEFAULT: 1

platform: x64

branches:
only:
- master

skip_tags: true

install:
- cinst StrawberryPerl --allow-empty-checksums
- path C:\strawberry\perl\bin;C:\strawberry\perl\site\bin;C:\strawberry\c\bin;%PATH%
- mkdir %APPVEYOR_BUILD_FOLDER%\tmp
- set TMPDIR=%APPVEYOR_BUILD_FOLDER%\tmp
- cmd: if not exist "C:\strawberry" cinst StrawberryPerl --allow-empty-checksums
- cmd: path C:\strawberry\perl\bin;C:\strawberry\perl\site\bin;C:\strawberry\c\bin;%PATH%
# - cmd: cd C:\projects\%APPVEYOR_PROJECT_NAME%
- sh: sudo apt-get update -q -y
- sh: sudo DEBIAN_FRONTEND=noninteractive apt-get install -q -y --force-yes build-essential git libssl-dev perl
- sh: export PATH=/home/appveyor/perl5/bin:$PATH
- perl -V
- cmd: mkdir %APPVEYOR_BUILD_FOLDER%\tmp
- cmd: set TMPDIR=%APPVEYOR_BUILD_FOLDER%\tmp
- cpan App::cpanminus
- cpanm -q --showdeps --with-develop --with-suggests . | findstr /v "^perl\>" | cpanm -n
- 'echo End install at: & time /t'
- cmd: cpanm -q --showdeps --with-develop --with-suggests . | findstr /v "^perl\>" | cpanm -n
- cpanm -qin --skip-satisfied --installdeps .
- cmd: 'echo End install at: & time /t'

build_script:
- set AUTOMATED_TESTING=1
- perl Makefile.PL

test_script:
- gmake test
- cmd: gmake test
- sh: make test
29 changes: 29 additions & 0 deletions .github/workflows/all.yml
@@ -0,0 +1,29 @@
on:
push:
branches:
- '*'
tags-ignore:
- '*'
pull_request:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['windows-latest', 'macos-latest', 'ubuntu-latest']
perl: [ '5.30', '5.28' ]
name: Perl ${{ matrix.perl }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- name: Setup perl
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl }}
- run: perl -V
- name: Install Dependencies
run: |
cpanm -iqn --skip-satisfied File::Spec ExtUtils::MakeMaker
cpanm -iqn --skip-satisfied Test::Pod::Spelling::CommonMistakes Test::Portability::Files LWP::Protocol::https JSON::XS Test::LWP::UserAgent
cpanm -iqn --skip-satisfied --installdeps --notest .
- name: Run Tests
run: prove -l -b t
53 changes: 45 additions & 8 deletions .travis.yml
@@ -1,25 +1,62 @@
---
language: perl

os:
- linux
# - osx

arch:
- amd64
- ppc64le
- s390x
# - arm64 # Gets 404 error

env:
- AUTOMATED_TESTING=1
- PERL_CPANM_OPT="--notest --force --skip-satisfied"

perl:
- "5.30"
- "5.28"
# - "5.28" # Travis gets 404 errors trying to find some older perls
- "5.26"
- "5.24"
- "5.22"
- "5.20"
- "5.18"
- "5.16"
- "5.14"
# - "5.22"
# - "5.20"
# - "5.18"
# - "5.16"
# - "5.14"
# - "5.12"
# - "5.10"
# - "5.8"
# - "5.8.7"

sudo: false

before_install:
cpanm -qn Devel::Cover::Report::Coveralls Test::Script Test::Pod::Spelling::CommonMistakes Test::Portability::Files Test::Carp LWP::Protocol::https JSON::XS Test::LWP::UserAgent
# - sudo apt-get update -q
# - sudo apt-get install sqlite3 libdbi-perl libdbd-sqlite3-perl
- cpanm -qin --skip-satisfied Devel::Cover::Report::Coveralls Test::Pod::Spelling::CommonMistakes Test::Portability::Files LWP::Protocol::https JSON::XS Test::LWP::UserAgent

install:
- cpanm -q --installdeps --notest .
- cpanm -qin --skip-satisfied --installdeps --notest .

script:
perl Makefile.PL && make && cover -test -report coveralls

jobs:
include:
- stage: Windows
os: windows
language: shell
before_install:
- cinst -y strawberryperl
- export "PATH=/c/Strawberry/perl/site/bin:/c/Strawberry/perl/bin:/c/Strawberry/c/bin:$PATH"
install:
- cpanm --notest --installdeps .
script:
- perl Makefile.PL
- gmake
- gmake test

after_failure:
- cat /home/travis/.cpanm/work/*/build.log
4 changes: 4 additions & 0 deletions MANIFEST
Expand Up @@ -4,6 +4,7 @@ lib/Geo/Coder/Postcodes.pm
LICENSE
Makefile.PL
MANIFEST This list of files
MANIFEST.SKIP
README
README.md
t/00-load.t
Expand All @@ -15,11 +16,14 @@ t/coverage.t
t/critic.t
t/cv.t
t/dist.t
t/eol.t
t/gv.t
t/kwalitee.t
t/links.t
t/manifest.t
t/metrics.t
t/namespaces.t
t/no404s.t
t/noplan.t
t/pod-cm.t
t/pod.t
Expand Down
68 changes: 68 additions & 0 deletions MANIFEST.SKIP
@@ -0,0 +1,68 @@

#!start included /usr/local/perls/perl-5.18.1/lib/5.18.1/ExtUtils/MANIFEST.SKIP
# Avoid version control files.
\bRCS\b
\bCVS\b
\bSCCS\b
,v$
\B\.svn\b
\B\.git\b
\B\.github\b
\B\.gitignore\b
\b_darcs\b
\B\.cvsignore$

# Avoid VMS specific MakeMaker generated files
\bDescrip.MMS$
\bDESCRIP.MMS$
\bdescrip.mms$

# Avoid Makemaker generated and utility files.
\bMANIFEST\.bak
\bMakefile$
\bblib/
\bMakeMaker-\d
\bpm_to_blib\.ts$
\bpm_to_blib$
\bblibdirs\.ts$ # 6.18 through 6.25 generated this

# Avoid Module::Build generated and utility files.
\bBuild$
\b_build/
\bBuild.bat$
\bBuild.COM$
\bBUILD.COM$
\bbuild.com$

# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$
\.tmp$
\.#
\.rej$
\.yml$
\.swp$

# Avoid OS-specific files/dirs
# Mac OSX metadata
\B\.DS_Store
# Mac OSX SMB mount metadata files
\B\._

# Avoid Devel::Cover and Devel::CoverX::Covered files.
\bcover_db\b
\bcovered\b

# Avoid MYMETA files
^MYMETA\.
#!end included /usr/local/perls/perl-5.18.1/lib/5.18.1/ExtUtils/MANIFEST.SKIP

\.travis\.yml
\.appveyor\.yml
\.releaserc
\.lwpcookies
Geo-.*
t/online.enabled
18 changes: 14 additions & 4 deletions Makefile.PL
Expand Up @@ -10,6 +10,14 @@ if($ENV{AUTHOR_TESTING}) {
$online_tests = are_online();
} else {
Getopt::Long::GetOptions('online-tests!' => \$online_tests);

if(!defined($online_tests)) {
$online_tests = are_online();
}
if(!$online_tests) {
print "On-line tests have been disabled\n";
$online_tests = 0;
}
}

my $build_requires = {
Expand Down Expand Up @@ -55,9 +63,11 @@ WriteMakefile(
type => 'git',
url => 'git://github.com/nigelhorne/Geo-Coder-Postcodes.git',
web => 'https://github.com/nigelhorne/Geo-Coder-Postcodes',
},
bugtracker => {
web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Geo-Coder-Postcodes',
repository => 'https://github.com/nigelhorne/Geo-Coder-Postcodes',
}, bugtracker => {
# web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Geo-Coder-Postcodes',
web => 'https://github.com/nigelhorne/Geo-Coder-Postcodes/issues',
url => 'https://github.com/nigelhorne/Geo-Coder-Postcodes/issues',
mailto => 'bug-Geo-Coder-Postcodes@rt.cpan.org'
}
},
Expand All @@ -67,7 +77,7 @@ WriteMakefile(

sub are_online
{
return 0 if($ENV{'AUTOMATED_TESTING'});
# return 0 if($ENV{'AUTOMATED_TESTING'});
return 0 if($ENV{'NO_NETWORK_TESTING'});
return 0 if(!-t STDIN);
my $s = IO::Socket::INET->new(
Expand Down
4 changes: 2 additions & 2 deletions lib/Geo/Coder/Postcodes.pm
Expand Up @@ -226,9 +226,9 @@ may work, but you're best to search only for "Margate".
=head1 AUTHOR
Nigel Horne <njh@bandsman.co.uk>
Nigel Horne C<< <njh@bandsman.co.uk> >>
Based on L<Geo::Coder::Coder::Googleplaces>.
Based on L<Geo::Coder::GooglePlaces>.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
Expand Down
20 changes: 20 additions & 0 deletions t/eol.t
@@ -0,0 +1,20 @@
use strict;
use warnings;

use Test::Most;

BEGIN {
if($ENV{AUTHOR_TESTING}) {
eval {
require Test::EOL;
};
if($@) {
plan(skip_all => 'Test::EOL not installed');
} else {
import Test::EOL;
all_perl_files_ok({ trailing_whitespace => 1 });
}
} else {
plan(skip_all => 'Author tests not required for installation');
}
}
16 changes: 16 additions & 0 deletions t/links.t
@@ -0,0 +1,16 @@
#!perl -w

use strict;
use warnings;
use Test::Most;

if($ENV{AUTHOR_TESTING}) {
eval 'use Test::Pod::LinkCheck';
if($@) {
plan(skip_all => 'Test::Pod::LinkCheck required for testing POD');
} else {
Test::Pod::LinkCheck->new->all_pod_ok();
}
} else {
plan(skip_all => 'Author tests not required for installation');
}
16 changes: 16 additions & 0 deletions t/no404s.t
@@ -0,0 +1,16 @@
#!perl -wT

use strict;
use warnings;
use Test::Most;

if($ENV{AUTHOR_TESTING}) {
eval "use Test::Pod::No404s";
if($@) {
plan skip_all => 'Test::Pod::No404s required for testing POD';
} else {
all_pod_files_ok();
}
} else {
plan(skip_all => 'Author tests not required for installation');
}

0 comments on commit 9373cff

Please sign in to comment.