use actions/cache@v4 #19
This file contains hidden or 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: Run Tests | |
| on: | |
| push: | |
| branches: | |
| - '*' | |
| pull_request: | |
| jobs: | |
| dist: | |
| name: Make distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Cache ~/perl5 | |
| uses: actions/cache@v4 | |
| with: | |
| key: ${{ runner.os }}-dist-locallib | |
| path: ~/perl5 | |
| - name: Perl version | |
| run: | | |
| perl -v | |
| - name: Install cpanm | |
| run: | | |
| curl -L https://cpanmin.us | perl - --sudo App::cpanminus | |
| - name: Install local::lib | |
| run: | | |
| cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) | |
| - name: Install author deps | |
| shell: bash | |
| run: | | |
| eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) | |
| true | |
| - name: Make distribution | |
| shell: bash | |
| run: | | |
| eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) | |
| perl Makefile.PL | |
| make dist DISTVNAME=dist | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v2 | |
| with: | |
| name: dist | |
| path: ./dist.tar.gz | |
| test: | |
| needs: dist | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [macos-latest, ubuntu-latest] | |
| perl: | |
| - "5.32" | |
| - "5.30" | |
| - "5.28" | |
| - "5.26" | |
| - "5.24" | |
| - "5.22" | |
| - "5.20" | |
| - "5.18" | |
| - "5.16" | |
| - "5.14" | |
| include: | |
| - { os: 'windows-latest', perl: 'strawberry' } | |
| - { os: 'ubuntu-latest' , perl: '5' , coverage: true } | |
| name: Perl ${{ matrix.perl }} on ${{ matrix.os }} ${{ fromJSON('[ "", "(coverage)" ]')[ matrix.coverage ] }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Get dist artifact | |
| uses: actions/download-artifact@v2 | |
| with: | |
| name: dist | |
| - name: Set up perl | |
| uses: shogo82148/actions-setup-perl@v1 | |
| if: matrix.os != 'windows-latest' | |
| with: | |
| perl-version: ${{ matrix.perl }} | |
| - name: Set up perl (Strawberry) | |
| uses: shogo82148/actions-setup-perl@v1 | |
| if: matrix.os == 'windows-latest' | |
| with: | |
| distribution: 'strawberry' | |
| - run: perl -V | |
| - name: Install Perl deps | |
| run: | | |
| cpanm --notest --installdeps dist.tar.gz | |
| - name: Run tests (no coverage) | |
| if: ${{ !matrix.coverage }} | |
| run: | |
| cpanm --verbose --test-only dist.tar.gz | |
| - name: Run tests (with coverage) | |
| if: ${{ matrix.coverage }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| cpanm -n Devel::Cover::Report::Coveralls | |
| export HARNESS_PERL_SWITCHES="-MDevel::Cover" | |
| perl Makefile.PL && make test | |
| cover -report Coveralls |