name: linux

on:
  push:
    branches:
      - '*'
    tags-ignore:
      - '*'
  pull_request:

jobs:
  perl:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        perl-version:
          - '5.30'
          - '5.32'
          - '5.34'
          - '5.36'
          - '5.38'
          - '5.40'
          - '5.42'
          - 'latest'
          - 'threaded'

    container:
      image: perl:${{ matrix.perl-version }}

    steps:
      - uses: actions/checkout@v4
        with:
          path: 'lib/YATT'
      - name: perl -V
        run: perl -V
      - name: Install Dependencies
        working-directory: 'lib/YATT'
        run: |
          apt-get update -y
          apt-get install -y zsh
          curl -fsSL --compressed https://raw.githubusercontent.com/skaji/cpm/main/cpm > cpm
          perl ./cpm install -g Test::Requires B::Debug Devel::Cover Devel::Cover::Report::Coveralls 
          perl ./cpm install -g --show-build-log-on-failure --with-recommends --with-test
      - name: Run Tests (no coverage)
        if: ${{ !matrix.coverage }}
        run: PERL=$(which perl) lib/YATT/t/runtests.zsh
