arvenil/ninja-mutex

View on GitHub
.github/workflows/PHP.yml

Summary

Maintainability
Test Coverage
name: PHP

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  workflow_dispatch:

jobs:
  run:
    runs-on: ${{ matrix.operating-system }}
    services:
      memcached:
        image: memcached
        ports:
          - 11211:11211
        options: --health-cmd "timeout 5 bash -c 'cat < /dev/null > /dev/udp/127.0.0.1/11211'" --health-interval=10s --health-timeout=5s --health-retries=3
      mysql:
        image: mysql
        env:
          MYSQL_ALLOW_EMPTY_PASSWORD: true
        ports:
          - 3306:3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
      redis:
        image: redis
        ports:
          - 6379:6379
        options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
    strategy:
      matrix:
        operating-system: ['ubuntu-latest']
        php-versions: ['7.4', '8.0']
        phpunit-versions: ['latest']

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-versions }}
          extensions: memcache, memcached, pdo_mysql, pcntl, redis, xdebug
          coverage: xdebug
          tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}

      - name: Get composer cache directory
        id: composer-cache
        run: echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Cache composer dependencies
        uses: actions/cache@v2
        with:
          path: ${{ steps.composer-cache.outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
          restore-keys: ${{ runner.os }}-composer-

      - name: Install Composer dependencies
        run: |
          composer require --dev symfony/phpunit-bridge
          composer install --no-progress --prefer-dist --optimize-autoloader

      - name: Run Tests
        run: |
          vendor/bin/phpunit --coverage-text

      - name: Publish code coverage
        uses: paambaati/codeclimate-action@v2.7.5
        env:
          CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
        with:
          coverageLocations: ${{github.workspace}}/build/logs/clover.xml:clover