astehlik/typo3-extension-tinyurls

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
---
name: Testing and linting

on:
  push:
    branches:
      - main
      - develop
  pull_request:
  workflow_dispatch:
  schedule:
    - cron: '35 8 * * 6'

env:
  TYPO3_EXTENSION_KEY: tinyurls
  MAIN_PHP_VERSION: 8.3

jobs:
  "composer-validate":
    name: "Composer validate"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/composer
        with:
          php_version: "${{ env.MAIN_PHP_VERSION }}"
      - run: composer validate

  "composer-normalize":
    name: "Composer normalize"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/composer
        with:
          php_version: "${{ env.MAIN_PHP_VERSION }}"
      - run: composer normalize --dry-run --diff

  "check-codestyle-codesniffer":
    name: "PHP_CodeSniffer check"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/composer
        with:
          php_version: "${{ env.MAIN_PHP_VERSION }}"
      - uses: shivammathur/setup-php@v2
        with:
          php-version: "${{ env.MAIN_PHP_VERSION }}"
      - run: |
          bash bin/t3_check_codestyle.sh PerCodeStyleT3Ext

  "check-codestyle-php-cs-fixer":
    name: "PHP CS Fixer check"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/composer
        with:
          php_version: "${{ env.MAIN_PHP_VERSION }}"
      - run: |
          bash bin/t3_run_tests.sh -s cgl -n -p ${{ env.MAIN_PHP_VERSION }}

  "php-unit-tests":
    name: "PHP Unit tests"
    strategy:
      matrix:
        php_version: ["8.2", "8.3"]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/composer
        with:
          php_version: ${{ matrix.php_version }}
      - run: |
          bash bin/t3_run_tests.sh -s unit -p ${{ matrix.php_version }}

  "php-functional-tests-sqlite-82":
    name: "Functional tests on SQLite"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/composer
        with:
          php_version: "${{ env.MAIN_PHP_VERSION }}"
      - run: |
          bash bin/t3_run_tests.sh -s functional -d sqlite -p ${{ env.MAIN_PHP_VERSION }}

  "php-functional-tests-mariadb-main":
    name: "Functional tests on MariaDB"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/composer
        with:
          php_version: ${{ env.MAIN_PHP_VERSION }}
      - run: |
          bash bin/t3_run_tests.sh -s functional -d mariadb -p ${{ env.MAIN_PHP_VERSION }}

  "php-lint":
    name: "PHP linting"
    strategy:
      matrix:
        php_version: ["8.2", "8.3"]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/composer
        with:
          php_version: ${{ matrix.php_version }}
      - run: |
          bash bin/t3_run_tests.sh -s lintPhp -p ${{ matrix.php_version }}

  "phpstan":
    name: "PHPStan"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/composer
        with:
          php_version: "${{ env.MAIN_PHP_VERSION }}"
      - run: |
          bash bin/t3_run_tests.sh -s phpstan -p ${{ env.MAIN_PHP_VERSION }}

  "coverage-phpunit":
    name: "Test coverage by Unit Tests"
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/develop'
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/composer
        with:
          php_version: ${{ env.MAIN_PHP_VERSION }}
      - run: |
          bash bin/t3_run_tests.sh -s unit -p ${{ env.MAIN_PHP_VERSION }} -X coverage -- --coverage-clover Logs/clover-unit.xml --coverage-filter ../Classes
      - uses: actions/upload-artifact@v3
        with:
          name: coverage-phpunit
          path: Logs/clover-unit.xml
          retention-days: 1

  "coverage-functional":
    name: "Test coverage by Functional Tests"
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/develop'
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/composer
        with:
          php_version: ${{ env.MAIN_PHP_VERSION }}
      - run: |
          bash bin/t3_run_tests.sh -s functional -d mariadb -p ${{ env.MAIN_PHP_VERSION }} -X coverage -- --coverage-clover Logs/clover-functional.xml --coverage-filter ../Classes
      - uses: actions/upload-artifact@v3
        with:
          name: coverage-functional
          path: Logs/clover-functional.xml
          retention-days: 1

  "coverage-upload":
    name: Upload coverage report to Code Climage
    needs:
      - coverage-phpunit
      - coverage-functional
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/develop'
    env:
      CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
    steps:
      - uses: actions/checkout@v4
      - uses: actions/download-artifact@v3
        with:
          name: coverage-phpunit
      - uses: actions/download-artifact@v3
        with:
          name: coverage-functional
      - run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
      - run: chmod +x ./cc-test-reporter
      - run: ./cc-test-reporter before-build
      - run: |
          ./cc-test-reporter format-coverage -t clover -o clover-unit.json clover-unit.xml
      - run: |
          ./cc-test-reporter format-coverage -t clover -o clover-functional.json clover-functional.xml
      - run: |
          ./cc-test-reporter sum-coverage --parts=2 --output=clover-sum.json clover-unit.json clover-functional.json
      - run: |
          ./cc-test-reporter upload-coverage --input=clover-sum.json

  "typo3-scan":
    name: "Scan for deprecated and breaking code using typo3scan"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/composer
        with:
          php_version: "${{ env.MAIN_PHP_VERSION }}"
      - uses: shivammathur/setup-php@v2
        with:
          php-version: "${{ env.MAIN_PHP_VERSION }}"
      - run: php bin/typo3scan scan .