Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
briandfoy committed Jul 22, 2023
1 parent 0b731e9 commit 9b3be88
Show file tree
Hide file tree
Showing 5 changed files with 225 additions and 27 deletions.
41 changes: 41 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# brian's standard Appveyor config for Perl 5 modules
# https://github.com/briandfoy/brians_perl_modules_appveyor_config
# This file is licensed under the Artistic License 2.0
# version 20230308
---
image:
- Visual Studio 2019
- Visual Studio 2022
- ubuntu2004

environment:
PERL5LIB: /home/appveyor/perl5/lib/perl5
DEBIAN_FRONTEND: noninteractive
SP: C:\strawberry

platform: x64

branches:
only:
- master
- appveyor

skip_tags: true

install:
- cmd: if not exist "C:\strawberry" cinst strawberryperl
- cmd: set PATH=%SP%\perl\bin;%SP%\perl\site\bin;%SP%\c\bin;%PATH%
- cmd: cd %APPVEYOR_BUILD_FOLDER%
- sh: sudo apt-get update --allow-releaseinfo-change
- sh: sudo env apt-get -yq install build-essential git libssl-dev
- sh: sudo apt-get install -y perl
- sh: export PATH=/home/appveyor/perl5/bin:$PATH
- perl -v
- cpan -M https://www.cpan.org -T App::cpanminus ExtUtils::MakeMaker
- cmd: cpanm --notest --installdeps .
- sh: cpanm --local-lib=/home/appveyor/perl5 --notest --installdeps .

build_script:
- perl Makefile.PL
- cmd: gmake test
- sh: make test
119 changes: 119 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# brian's standard GitHub Actions Ubuntu config for Perl 5 modules
# version 20230718.001
# https://github.com/briandfoy/github_workflows
# https://github.com/features/actions
# This file is licensed under the Artistic License 2.0
name: ubuntu

on:
push:
branches:
- '**'
- '!**appveyor**'
- '!**circleci**'
- '!**macos**'
- '!**notest**'
- '!**release**'
- '!**windows**'
tags-ignore:
# I tag release pushes but those should have already been tested
- 'release-*'
paths-ignore:
# list all the files which are irrelevant to the tests
# non-code, support files, docs, etc
- '.appveyor.yml'
- '.circleci'
- '.gitattributes'
- '.github/workflows/macos.yml'
- '.github/workflows/release.yml'
- '.github/workflows/windows.yml'
- '.gitignore'
- '.releaserc'
- 'Changes'
- 'LICENSE'
- 'README.pod'
pull_request:

jobs:
perl:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-22.04
perl-version:
- 'latest'
container:
image: perl:${{ matrix.perl-version }}
steps:
- uses: actions/checkout@v3
- name: Platform check
run: uname -a
- name: Perl version check
run: |
perl -V
perl -v | perl -0777 -ne 'm/(v5\.\d+)/ && print "PERL_VERSION=$1"' >> $GITHUB_ENV
# Some older versions of Perl have trouble with hostnames in certs. I
# haven't figured out why.
- name: Setup environment
run: |
echo "PERL_LWP_SSL_VERIFY_HOSTNAME=0" >> $GITHUB_ENV
# I had some problems with openssl on Ubuntu, so I punted by installing
# cpanm first, which is easy. I can install IO::Socket::SSL with that,
# then switch back to cpan. I didn't explore this further, but what you
# see here hasn't caused problems for me.
# Need HTTP::Tiny 0.055 or later.
- name: Install cpanm and multiple modules
run: |
curl -L https://cpanmin.us | perl - App::cpanminus
cpanm --notest IO::Socket::SSL App::Cpan HTTP::Tiny ExtUtils::MakeMaker Test::Manifest Test::More
# Install the dependencies, again not testing them. This installs the
# module in the current directory, so we end up installing the module,
# but that's not a big deal.
- name: Install dependencies
run: |
cpanm --notest --installdeps --with-suggests --with-recommends .
- name: Show cpanm failures
if: ${{ failure() }}
run: |
cat /home/runner/.cpanm/work/*/build.log
- name: Run tests
run: |
perl Makefile.PL
make test
# Run author tests, but only if there's an xt/ directory
- name: Author tests
if: hashFiles('xt') != ''
run: |
cpanm --notest Test::CPAN::Changes
prove -r -b xt
# Running tests in parallel should be faster, but it's also more
# tricky in cases where different tests share a feature, such as a
# file they want to write to. Parallel tests can stomp on each other.
# Test in parallel to catch that, because other people will test your
# stuff in parallel.
- name: Run tests in parallel
run: |
perl Makefile.PL
HARNESS_OPTIONS=j10 make test
# The disttest target creates the distribution, unwraps it, changes
# into the dist dir, then runs the tests there. That checks that
# everything that should be in the dist is in the dist. If you forget
# to update MANIFEST with new modules, data files, and so on, you
# should notice the error.
- name: Run distribution tests
run: |
perl Makefile.PL
make disttest
make clean
# And, coverage reports, but only under 5.12 and later since modern
# Devel::Cover instances don't work with earlier versions as of
# Devel::Cover 1.39
- name: Run coverage tests
if: env.PERL_VERSION != 'v5.8' && env.PERL_VERSION != 'v5.10'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cpanm --notest Devel::Cover Devel::Cover::Report::Coveralls
perl Makefile.PL
cover -test -report coveralls
23 changes: 14 additions & 9 deletions .github/workflows/perl-module-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# brian's standard GitHub Actions Ubuntu config for Perl 5 modules
# version 20220902.001
# version 20230718.001
# https://github.com/briandfoy/github_workflows
# https://github.com/features/actions
# This file is licensed under the Artistic License 2.0
Expand Down Expand Up @@ -56,6 +56,7 @@ jobs:
- '5.30'
- '5.32'
- '5.34'
- '5.36'
- 'latest'
container:
image: perl:${{ matrix.perl-version }}
Expand All @@ -80,14 +81,17 @@ jobs:
- name: Install cpanm and multiple modules
run: |
curl -L https://cpanmin.us | perl - App::cpanminus
cpanm --notest IO::Socket::SSL App::Cpan HTTP::Tiny
cpan -M https://www.cpan.org -T ExtUtils::MakeMaker Test::Manifest
cpanm --notest IO::Socket::SSL App::Cpan HTTP::Tiny ExtUtils::MakeMaker Test::Manifest Test::More
# Install the dependencies, again not testing them. This installs the
# module in the current directory, so we end up installing the module,
# but that's not a big deal.
- name: Install dependencies
run: |
cpan -M https://www.cpan.org -T .
cpanm --notest --installdeps --with-suggests --with-recommends .
- name: Show cpanm failures
if: ${{ failure() }}
run: |
cat /home/runner/.cpanm/work/*/build.log
- name: Run tests
run: |
perl Makefile.PL
Expand All @@ -96,7 +100,7 @@ jobs:
- name: Author tests
if: hashFiles('xt') != ''
run: |
cpan -M https://www.cpan.org -T Test::CPAN::Changes
cpanm --notest Test::CPAN::Changes
prove -r -b xt
# Running tests in parallel should be faster, but it's also more
# tricky in cases where different tests share a feature, such as a
Expand All @@ -117,13 +121,14 @@ jobs:
perl Makefile.PL
make disttest
make clean
# And, coverage reports, but only under 5.10 and later since modern
# Devel::Cover instances don't work with 5.8
# And, coverage reports, but only under 5.12 and later since modern
# Devel::Cover instances don't work with earlier versions as of
# Devel::Cover 1.39
- name: Run coverage tests
if: env.PERL_VERSION != 'v5.8'
if: env.PERL_VERSION != 'v5.8' && env.PERL_VERSION != 'v5.10'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cpan -M https://www.cpan.org -T Devel::Cover Devel::Cover::Report::Coveralls
cpanm --notest Devel::Cover Devel::Cover::Report::Coveralls
perl Makefile.PL
cover -test -report coveralls
1 change: 1 addition & 0 deletions .github/workflows/perl-module-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
- windows-2019
- windows-2022
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v3
- name: Set up Perl
run: |
Expand Down
68 changes: 50 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
# brian's standard GitHub Actions release config for Perl 5 modules
# version 20220827.002
# version 20230604.001
# https://github.com/briandfoy/github_workflows
# https://github.com/features/actions
# This file is licensed under the Artistic License 2.0
#
# This action builds a Perl distribution and adds it as a release
# on GitHub. This does not upload to PAUSE, but that wouldn't be
# that hard, but that doesn't fit with my workflow since this part
# happens after everything else has succeeded.
#
# This requires that you configure a repository secret named
# RELEASE_ACTION_TOKEN with a GitHub Personal Access Token
# that has "read and write" permissions on Repository/Contents
name: release

permissions:
contents: write

on:
push:
# tag a release commit with "release-....". This workflow then runs
# whenever it sees that tag, and doesn't run for other commits.
tags:
- 'release-*'
# With workflow_dispatch, you can trigger this manually. This is
# especially handy when you want to re-run a job that failed because
# the token had expired. Update the GitHub secret and re-run on the
# same commit.
workflow_dispatch:

jobs:
perl:
# We need a GitHub secret, so create an Environment named "release"
# * Go to Settings > Environment (repo settings, not account settings)
# * Make an environment named "release"
# * Add a secret named "RELEASE_ACTION_TOKEN" with a GitHub token with repo permissions
# If you use a different token name, update "RELEASE_ACTION_TOKEN" in the last
# step in this job.
environment: release
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -31,39 +58,44 @@ jobs:
# cpanm first, which is easy. I can install IO::Socket::SSL with that,
# then switch back to cpan. I didn't explore this further, but what you
# see here hasn't caused problems for me.
# Need HTTP::Tiny 0.055 or later.
#
# Need HTTP::Tiny 0.055 or later. Probably don't need it at all since I'm
# not using cpan here.
#
# Test::Manifest is there because it's a thing I do. If you are writing
# modules and don't know what it is, you don't need it.
- name: Install cpanm and multiple modules
run: |
curl -L https://cpanmin.us | perl - App::cpanminus
cpanm --notest IO::Socket::SSL App::Cpan HTTP::Tiny
cpan -M https://www.cpan.org -T ExtUtils::MakeMaker Test::Manifest
cpanm --notest IO::Socket::SSL HTTP::Tiny ExtUtils::MakeMaker Test::Manifest
# Install the dependencies, again not testing them. This installs the
# module in the current directory, so we end up installing the module,
# but that's not a big deal.
- name: Install dependencies
run: |
cpan -M https://www.cpan.org -T .
cpanm --notest --installdeps --with-suggests --with-recommends .
# This makes the distribution and tests it, but assumes by the time we
# got here, everything else was already tested.
- name: Create distro
run: |
perl Makefile.PL
make disttest
make dist 2>/dev/null | grep Created | awk '{ print "ASSET_NAME=" $2 }' >> $GITHUB_ENV
- name: version
run: echo "::set-output name=version::$(perl -le 'print $ARGV[0] =~ m/(.*?).tar.gz/' *.tar.gz)"
run: |
perl -le '($name) = $ARGV[0] =~ m/(.*?).tar.gz/; print qq(name=$name)' *.tar.gz >> $GITHUB_OUTPUT
id: version
- name: release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ github.token }}
with:
draft: false
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ github.ref }}
body_path: Changes
- name: Changes extract
run: |
perl -00 -lne 'next unless /\A\d+\.\d+(_\d+)?/; print; last' Changes > Changes-latest
cat Changes-latest
id: extract
- name: upload
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: Changes-latest
draft: false
prerelease: false
name: ${{ steps.version.outputs.name }}
files: "*.tar.gz"
token: ${{ secrets.RELEASE_ACTION_TOKEN }}

0 comments on commit 9b3be88

Please sign in to comment.