diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index af22aca..1a62354 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,9 +1,17 @@ +# brian's standard GitHub Actions Ubuntu config for Perl 5 modules +# version 20220825.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: - - '*' + - '**' + - '!**windows**' + - '!**macos**' + - '!**release**' tags-ignore: # I tag release pushes but those should have already been tested - 'release-*' @@ -11,7 +19,10 @@ on: # list all the files which are irrelevant to the tests # non-code, support files, docs, etc - '.appveyor.yml' - - '.github/**' + - '.gitattributes' + - '.github/workflows/macos.yml' + - '.github/workflows/windows.yml' + - '.github/workflows/release.yml' - '.gitignore' - '.releaserc' - 'Changes' @@ -42,7 +53,6 @@ jobs: - '5.30' - '5.32' - 'latest' - container: image: perl:${{ matrix.perl-version }} steps: @@ -50,12 +60,27 @@ jobs: - name: Platform check run: uname -a - name: Perl version check - run: perl -V + 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 LWP::Protocol::https App::Cpan - cpan -M https://www.cpan.org -T ExtUtils::MakeMaker + cpanm --notest IO::Socket::SSL App::Cpan HTTP::Tiny + cpan -M https://www.cpan.org -T 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 . @@ -63,11 +88,38 @@ jobs: run: | perl Makefile.PL make test +# Run author tests, but only if there's an xt/ directory + - name: Author tests + if: hashFiles('xt') != '' + run: | + cpan -M https://www.cpan.org -T 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.10 and later since modern +# Devel::Cover instances don't work with 5.8 + - name: Run coverage tests + if: env.PERL_VERSION != 'v5.8' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cpan -M https://www.cpan.org -T Devel::Cover Devel::Cover::Report::Coveralls + perl Makefile.PL + cover -test -report coveralls diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 45cce32..5bb1b85 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,9 +1,17 @@ +# brian's standard GitHub Actions macOS config for Perl 5 modules +# version 20220825.001 +# https://github.com/briandfoy/github_workflows +# https://github.com/features/actions +# This file is licensed under the Artistic License 2.0 name: macos on: push: branches: - - '*' + - '**' + - '!**windows**' + - '!**linux**' + - '!**release**' tags-ignore: # I tag release pushes but those should have already been tested - 'release-*' @@ -11,7 +19,9 @@ on: # list all the files which are irrelevant to the tests # non-code, support files, docs, etc - '.appveyor.yml' - - '.github/**' + - '.gitattributes' + - '.github/workflows/windows.yml' + - '.github/workflows/release.yml' - '.gitignore' - '.releaserc' - 'Changes' @@ -22,19 +32,34 @@ on: jobs: perl: runs-on: macOS-latest - steps: - uses: actions/checkout@v2 - name: Platform check run: uname -a - name: Set up Perl - run: brew install perl + run: | + brew install perl + ls -d /usr/local/Cellar/perl/*/bin | head -1 >> $GITHUB_PATH + perl -v | perl -0777 -ne 'm/(v5\.\d+)/ && print "PERL_VERSION=$1"' >> $GITHUB_ENV - name: Perl version check run: perl -V +# cpan can operate with https, but we need IO::SSL::Socket, which +# does not come with Perl. +# +# When using cpan, use -M to specify the CDN-backed www.cpan.org +# mirror. I've noticed that letting CPAN.pm auto-choose mirrors +# sometimes selects things that the action can't reach. +# +# Also, use the -T option to not test the dependencies. Assume these +# mainline modules are good and save lots of CI minutes. - name: Prepare cpan run: | openssl version - cpan -M https://www.cpan.org -T IO::Socket::SSL LWP::Protocol::https ExtUtils::MakeMaker + cpan -M http://www.cpan.org -T IO::Socket::SSL HTTP::Tiny + cpan -M https://www.cpan.org -T 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 . @@ -42,11 +67,38 @@ jobs: run: | perl Makefile.PL make test +# Run author tests, but only if there's an xt/ directory + - name: Author tests + if: hashFiles('xt') != '' + run: | + cpan -M https://www.cpan.org -T 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.10 and later since modern +# Devel::Cover instances don't work with 5.8 + - name: Run coverage tests + if: env.PERL_VERSION != 'v5.8' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cpan -M https://www.cpan.org -T Devel::Cover Devel::Cover::Report::Coveralls + perl Makefile.PL + cover -test -report coveralls diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..852d843 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +# brian's standard GitHub Actions release config for Perl 5 modules +# version 20220825.001 +# https://github.com/briandfoy/github_workflows +# https://github.com/features/actions +# This file is licensed under the Artistic License 2.0 +name: release + +on: + push: + tags: + - 'release-*' +jobs: + perl: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-20.04 + perl-version: + - 'latest' + container: + image: perl:${{ matrix.perl-version }} + steps: + - uses: actions/checkout@v2 +# 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 + cpan -M https://www.cpan.org -T 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 . + - 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)" + 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: upload + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: "*.tar.gz" diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 7e8033c..2d89abd 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,9 +1,17 @@ +# brian's standard GitHub Actions Windows config for Perl 5 modules +# version 20220825.001 +# https://github.com/briandfoy/github_workflows +# https://github.com/features/actions +# This file is licensed under the Artistic License 2.0 name: windows on: push: branches: - - '*' + - '**' + - '!**linux**' + - '!**macos**' + - '!**release**' tags-ignore: # I tag release pushes but those should have already been tested - 'release-*' @@ -11,7 +19,10 @@ on: # list all the files which are irrelevant to the tests # non-code, support files, docs, etc - '.appveyor.yml' - - '.github/**' + - '.gitattributes' + - '.github/workflows/release.yml' + - '.github/workflows/macos.yml' + - '.github/workflows/ubuntu.yml' - '.gitignore' - '.releaserc' - 'Changes' @@ -22,35 +33,65 @@ on: jobs: perl: runs-on: ${{ matrix.os }} + # store any secrets in an environment named "testing" strategy: matrix: os: - windows-2019 - - windows-2016 - + - windows-2022 steps: - uses: actions/checkout@v2 - name: Set up Perl run: | choco install strawberryperl - echo "C:\strawberry\c\bin" >> $GITHUB_PATH - echo "C:\strawberry\perl\site\bin" >> $GITHUB_PATH - echo "C:\strawberry\perl\bin" >> $GITHUB_PATH + echo "C:\strawberry\c\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "C:\strawberry\perl\site\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "C:\strawberry\perl\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Perl version run: perl -V +# 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 . + run: | + cpan -M https://www.cpan.org -T . + cpan -M https://www.cpan.org -T Test::Manifest - 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: | + cpan -M https://www.cpan.org -T 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 env: HARNESS_OPTIONS: j10 run: | perl Makefile.PL 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 + - name: Run coverage tests + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cpan -M https://www.cpan.org -T Devel::Cover Devel::Cover::Report::Coveralls + perl Makefile.PL + cover -test -report coveralls