Show error logs on Github Actions - Install developer dependencies first (Test::CSS)
While trying to enable GitHub Actions to the Test-CSS distribution I received the following error:
! No MYMETA file is found after configure. Your toolchain is too old? Configuring /home/runner/work/Test-CSS/Test-CSS ... N/A ! Configuring . failed. See /home/runner/.cpanm/work/1665208338.1655/build.log for details. Error: Process completed with exit code 1.
Surprisingly this only happened on Linux and OSX. On Windows, where we use Strawberry Perl everything worked fine.
Showing error logs
The error message did not help much, so I added the following steps to the GitHub Actions configuration file, to display the content of the log files:
- name: Show Errors on Ubuntu if: ${{ failure() && startsWith( matrix.runner, 'ubuntu-')}} run: | cat /home/runner/.cpanm/work/*/build.log - name: Show Errors on OSX if: ${{ failure() && startsWith( matrix.runner, 'macos-')}} run: | cat /Users/runner/.cpanm/work/*/build.log
Pushing out the changes triggered another run of the CI and this time I could see the content of the log file in the "Show Errors on Ubuntu" step:
... Running Makefile.PL Error: Can't locate File/ShareDir/Install.pm in @INC (you may need to install the File::ShareDir::Install module) (@INC contains: /home/runner/work/Test-CSS/Test-CSS/local/lib/perl5 /home/runner/work/_actions/shogo82148/actions-setup-perl/v1/scripts/lib /opt/hostedtoolcache/perl/5.32.1/x64/lib/site_perl/5.32.1/x86_64-linux /opt/hostedtoolcache/perl/5.32.1/x64/lib/site_perl/5.32.1 /opt/hostedtoolcache/perl/5.32.1/x64/lib/5.32.1/x86_64-linux /opt/hostedtoolcache/perl/5.32.1/x64/lib/5.32.1 .) at Makefile.PL line 7. Error: BEGIN failed--compilation aborted at Makefile.PL line 7. -> N/A -> FAIL No MYMETA file is found after configure. Your toolchain is too old? ! Configuring . failed. See /home/runner/.cpanm/work/1665208877.1651/build.log for details.
Similar output could be seen from OSX.
Developer dependency
I assume this is a developer-only dependency so I included it among the other modules we need to install for the author tests and moved the installation of them before the installation of the run-time dependencies. The final configuration file is this:
examples/test-css-ci.yml
name: Perl on: push: pull_request: jobs: test: strategy: fail-fast: false matrix: runner: [ubuntu-latest, macos-latest, windows-latest] perl: [ '5.32' ] runs-on: ${{matrix.runner}} name: OS ${{matrix.runner}} Perl ${{matrix.perl}} steps: - uses: actions/checkout@v2 - name: Set up perl uses: shogo82148/actions-setup-perl@v1 with: perl-version: ${{ matrix.perl }} distribution: ${{ ( startsWith( matrix.runner, 'windows-' ) && 'strawberry' ) || 'default' }} - name: Show Perl Version run: | perl -v - name: cpanm version number run: | cpanm -v - name: Install developer Dependencies run: | cpanm File::ShareDir::Install Test::CheckManifest Test::CPAN::Meta::JSON Test::CPAN::Meta Test::Pod - name: Install Dependencies run: | cpanm --installdeps . - name: Run tests run: | perl Makefile.PL make make test - name: Show Errors on Ubuntu if: ${{ failure() && startsWith( matrix.runner, 'ubuntu-')}} run: | cat /home/runner/.cpanm/work/*/build.log - name: Show Errors on OSX if: ${{ failure() && startsWith( matrix.runner, 'macos-')}} run: | cat /Users/runner/.cpanm/work/*/build.log
Published on 2022-10-08