j4mie/idiorm

View on GitHub
.github/workflows/idiorm-workflow.yml

Summary

Maintainability
Test Coverage

on: push

jobs:
  test-idiorm-with-php5-2:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: read

    env:
      REGISTRY: ghcr.io
      IMAGE_NAME: treffynnon/php5.2cli:latest

    name: 'PHP 5.2'
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Pull docker image
        run: docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

      - name: Run PHPUnit tests
        run: docker run -t -v $(realpath ./):/tmp/idiorm --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} /root/phpunit -c /tmp/idiorm/phpunit.xml

  test-idiorm-against-php-matrix:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        php-versions:     ['5.4', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
        phpunit-versions: ['4.8']
        include:
          - php-versions: '8.0'
            phpunit-versions: '8.5.21'
          - php-versions: '8.2'
            phpunit-versions: '8.5.21'

    name: PHP ${{ matrix.php-versions }}

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-versions }}
          coverage: xdebug
          tools: composer, phpunit:${{ matrix.phpunit-versions }}

      - name: Setup problem matchers for PHPUnit
        run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

      - name: Add PHP 8 return types
        if: ${{ matrix.php-versions >= '8.0' }}
        run: |
          sed -i 's#setUp()#setUp(): void#' test/*.php
          sed -i 's#tearDown()#tearDown(): void#' test/*.php

      - name: Run phpunit tests
        run: composer run-script test -- --colors --coverage-text