From 73d3a310ac21a0e3f4c06ab680f6c5521c76ba8e Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Mon, 20 Nov 2023 19:59:16 -0500 Subject: [PATCH] GitHub Actions: add testing workflow --- .github/workflows/multiperl-test.yml | 88 ++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/multiperl-test.yml diff --git a/.github/workflows/multiperl-test.yml b/.github/workflows/multiperl-test.yml new file mode 100644 index 0000000..a2b00b2 --- /dev/null +++ b/.github/workflows/multiperl-test.yml @@ -0,0 +1,88 @@ +name: "multiperl test" +on: + push: + branches: "*" + tags-ignore: "*" + pull_request: ~ + +# FUTURE ENHANCEMENT(s): +# * install faster (see below) +# * use github.event.repository.name or ${GITHUB_REPOSITORY#*/} as the +# tarball/build name instead of Dist-To-Test + +jobs: + build-tarball: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Check out repo + uses: actions/checkout@v3 + - name: Install cpanminus + run: | + curl https://cpanmin.us/ > /tmp/cpanm + chmod u+x /tmp/cpanm + - name: Install Dist::Zilla + run: sudo apt-get install -y libdist-zilla-perl + - name: Install prereqs + # This could probably be made more efficient by looking at what it's + # installing via cpanm that could, instead, be installed from apt. I + # may do that later, but for now, it's fine! -- rjbs, 2023-01-07 + run: | + dzil authordeps --missing | /tmp/cpanm --notest -S + dzil listdeps --author --missing | /tmp/cpanm --notest -S + - name: Build tarball + run: | + dzil build --in Dist-To-Test + tar zcvf Dist-To-Test.tar.gz Dist-To-Test + - name: Upload tarball + uses: actions/upload-artifact@v3 + with: + name: Dist-To-Test.tar.gz + path: Dist-To-Test.tar.gz + + multiperl-test: + needs: build-tarball + env: + # some plugins still needs this to run their tests... + PERL_USE_UNSAFE_INC: 0 + AUTHOR_TESTING: 1 + AUTOMATED_TESTING: 1 + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + perl-version: [ "devel", "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" ] + + container: + image: perldocker/perl-tester:${{ matrix.perl-version }} + + steps: + - name: Download tarball + uses: actions/download-artifact@v3 + with: + name: Dist-To-Test.tar.gz + - name: Extract tarball + run: tar zxvf Dist-To-Test.tar.gz + - name: Install dependencies + working-directory: ./Dist-To-Test + run: cpanm --installdeps --notest . + - name: Makefile.PL + working-directory: ./Dist-To-Test + run: perl Makefile.PL + - name: Install yath + run: cpanm --notest Test2::Harness + - name: Install testing libraries + run: cpanm --notest Test2::Harness::Renderer::JUnit + - name: Run the tests + working-directory: ./Dist-To-Test + run: | + JUNIT_TEST_FILE="/tmp/test-output.xml" ALLOW_PASSING_TODOS=1 yath test --renderer=Formatter --renderer=JUnit -D + - name: Publish test report + uses: mikepenz/action-junit-report@v3 + if: always() # always run even if the previous step fails + with: + check_name: JUnit Report (${{ matrix.perl-version }}) + report_paths: /tmp/test-output.xml