Add GitHub Actions testing workflow #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: ~ | |
pull_request: ~ | |
jobs: | |
perl-versions: | |
runs-on: ubuntu-latest | |
name: Calculate Perl Versions | |
outputs: | |
versions: ${{ steps.perl-versions.outputs.perl-versions }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: perl-versions | |
uses: perl-actions/perl-versions@v1 | |
with: | |
since-perl: v5.14 | |
with-devel: true | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.perl-cpm | |
key: cpm-${{ runner.os }} | |
- name: Setup local::lib | |
run: | | |
echo "$RUNNER_TEMP/perl5/bin" >> "$GITHUB_PATH" | |
echo "PERL5LIB=$RUNNER_TEMP/perl5/lib/perl5:$PERL5LIB" >> "$GITHUB_ENV" | |
echo "PERL_MB_OPT=--install_base $RUNNER_TEMP/perl5" >> "$GITHUB_ENV" | |
echo "PERL_MM_OPT=INSTALL_BASE=$RUNNER_TEMP/perl5" >> "$GITHUB_ENV" | |
- name: Extract Dist::Zilla dependencies | |
id: authordeps | |
uses: perl-actions/get-prereqs@v1 | |
with: | |
sources: dist.ini | |
phases: author | |
- name: Install authordeps | |
uses: perl-actions/install-with-cpm@v1 | |
with: | |
sudo: false | |
install: ${{ steps.authordeps.outputs.prereqs }} | |
- name: Build | |
id: build | |
run: | | |
DZIL_COLOR=1 dzil build --no-tgz | tee "/tmp/dzil-build.log" | |
echo build="$(grep --only-matching 'built in .*' "/tmp/dzil-build.log" | tail -1 | cut -c10-)" >> "$GITHUB_OUTPUT" | |
- name: Upload build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.build.outputs.build }} | |
path: ${{ steps.build.outputs.build }} | |
include-hidden-files: true | |
outputs: | |
name: ${{ steps.build.outputs.build }} | |
test: | |
needs: | |
- perl-versions | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
perl-version: ${{ fromJson(needs.perl-versions.outputs.versions) }} | |
runs-on: ubuntu-latest | |
container: | |
image: perl:${{ matrix.perl-version }}-buster | |
env: | |
AUTOMATED_TESTING: 1 | |
PERL_USE_UNSAFE_INC: 0 | |
steps: | |
- name: Download build | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ needs.build.outputs.name }} | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.perl-cpm | |
key: cpm-perl:${{ matrix.perl-version }}-buster | |
- name: Setup local::lib | |
run: | | |
echo "$RUNNER_TEMP/perl5/bin" >> "$GITHUB_PATH" | |
echo "PERL5LIB=$RUNNER_TEMP/perl5/lib/perl5:$PERL5LIB" >> "$GITHUB_ENV" | |
echo "PERL_MB_OPT=--install_base $RUNNER_TEMP/perl5" >> "$GITHUB_ENV" | |
echo "PERL_MM_OPT=INSTALL_BASE=$RUNNER_TEMP/perl5" >> "$GITHUB_ENV" | |
- name: Extract configure dependecies | |
id: configure | |
uses: perl-actions/get-prereqs@v1 | |
with: | |
phases: configure | |
- name: Install configure deps | |
uses: perl-actions/install-with-cpm@v1 | |
with: | |
sudo: false | |
install: ${{ steps.configure.outputs.prereqs }} | |
- name: Run Makefile.PL | |
run: perl Makefile.PL | |
- name: Extract dependecies | |
id: prereqs | |
uses: perl-actions/get-prereqs@v1 | |
with: | |
phases: build test runtime | |
relationships: requires recommends suggests | |
exclude: | | |
^lib$ | |
- name: Install deps | |
uses: perl-actions/install-with-cpm@v1 | |
with: | |
sudo: false | |
install: ${{ steps.prereqs.outputs.prereqs }} | |
- name: Run the tests | |
run: make test | |
env: | |
AUTHOR_TESTING: 1 | |
test-xt: | |
needs: | |
- perl-versions | |
- build | |
runs-on: ubuntu-latest | |
container: | |
image: perl:5.36-buster | |
env: | |
AUTOMATED_TESTING: 1 | |
steps: | |
- name: Download build | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ needs.build.outputs.name }} | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.perl-cpm | |
key: cpm-perl:5.36-buster | |
- name: Setup local::lib | |
run: | | |
echo "$RUNNER_TEMP/perl5/bin" >> "$GITHUB_PATH" | |
echo "PERL5LIB=$RUNNER_TEMP/perl5/lib/perl5:$PERL5LIB" >> "$GITHUB_ENV" | |
echo "PERL_MB_OPT=--install_base $RUNNER_TEMP/perl5" >> "$GITHUB_ENV" | |
echo "PERL_MM_OPT=INSTALL_BASE=$RUNNER_TEMP/perl5" >> "$GITHUB_ENV" | |
- name: Extract configure dependecies | |
id: configure | |
uses: perl-actions/get-prereqs@v1 | |
with: | |
phases: configure | |
- name: Install configure deps | |
uses: perl-actions/install-with-cpm@v1 | |
with: | |
sudo: false | |
install: ${{ steps.configure.outputs.prereqs }} | |
- name: Run Makefile.PL | |
run: perl Makefile.PL | |
- name: Extract dependecies | |
id: prereqs | |
uses: perl-actions/get-prereqs@v1 | |
with: | |
phases: build test runtime develop | |
relationships: requires recommends suggests | |
exclude: | | |
^lib$ | |
- name: Install deps | |
uses: perl-actions/install-with-cpm@v1 | |
with: | |
sudo: false | |
install: ${{ steps.prereqs.outputs.prereqs }} | |
- name: Run the xt tests | |
run: prove -l xt | |
env: | |
AUTHOR_TESTING: 1 | |
- name: Run the xt/author tests | |
run: prove -lr xt/author | |
env: | |
AUTHOR_TESTING: 1 |