byjg/phpthread

View on GitHub
.github/workflows/phpunit.yml

Summary

Maintainability
Test Coverage
name: PHPUnit
on:
  push:
    branches:
      - master
    tags:
      - "*.*.*"
  pull_request:
    branches:
      - master

jobs:
  Build:
    runs-on: 'ubuntu-latest'
    container: 'byjg/php:${{ matrix.php-version }}-cli'
    strategy:
      matrix:
        php-version:
          - "8.2"
          - "8.1"
          - "8.0"
          - "7.4"

    steps:
      - uses: actions/checkout@v4
      - run: composer install
      - run: php tests/get_class_name.php
      - run: ./vendor/bin/phpunit

  Build-zts:
    runs-on: 'ubuntu-latest'
    container: 'php:${{ matrix.php-version }}-zts'
    strategy:
      matrix:
        php-version:
          - "8.2"
          - "8.1"
          - "8.0"
          - "7.4"

    steps:
      - uses: actions/checkout@v4
      - name: Install requirements
        run: |
          apt -y -qq update
          apt -y -qq install git zip unzip build-essential
      - name: Install Composer
        run: |
          php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
          php composer-setup.php
          php -r "unlink('composer-setup.php');"
          mv composer.phar /usr/bin/composer
      - name: Install Extensions (PHP < 8.0)
        if:  ${{ matrix.php-version < '8.0' }}
        run: |
          docker-php-ext-install pcntl
          docker-php-ext-install shmop
          pecl install parallel-1.1.4
          docker-php-ext-enable parallel
      - name: Install Extensions (PHP >= 8.0)
        if:  ${{ matrix.php-version >= '8.0' }}
        run: |
          docker-php-ext-install pcntl
          docker-php-ext-install shmop
          pecl install parallel
          docker-php-ext-enable parallel

      - run: composer install
      - run: php tests/get_class_name.php
      - run: ./vendor/bin/phpunit

  Documentation:
    if: github.ref == 'refs/heads/master'
    needs:
      - Build
      - Build-zts
    uses: byjg/byjg.github.io/.github/workflows/add-doc.yaml@master
    with:
      folder: php
      project: ${{ github.event.repository.name }}
    secrets: inherit