<commit_before>name: Testing

on: pull_request

jobs:

  unit: #-----------------------------------------------------------------------
    name: Unit test /  PHP ${{ matrix.php }}
    strategy:
      fail-fast: false
      matrix:
        php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
    runs-on: ubuntu-latest

    steps:
      - name: Check out source code
        uses: actions/checkout@v2

      - name: Check existence of composer.json file
        id: check_files
        uses: andstor/file-existence-action@v1
        with:
          files: "composer.json, phpunit.xml.dist"

      - name: Set up PHP environment
        if: steps.check_files.outputs.files_exists == 'true'
        uses: shivammathur/setup-php@v2
        with:
          php-version: '${{ matrix.php }}'
          coverage: none
          tools: composer,cs2pr

      - name: Get Composer cache Directory
        if: steps.check_files.outputs.files_exists == 'true'
        id: composer-cache
        run: |
          echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Use Composer cache
        if: steps.check_files.outputs.files_exists == 'true'
        uses: actions/cache@master
        with:
          path: ${{ steps['composer-cache'].outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: |
            ${{ runner.os }}-composer-

      - name: Install dependencies
        if: steps.check_files.outputs.files_exists == 'true'
        run: COMPOSER_ROOT_VERSION=dev-master composer install --prefer-dist --no-progress --no-suggest

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

      - name: Run PHPUnit
        if: steps.check_files.outputs.files_exists == 'true'
        run: composer phpunit

  functional: #----------------------------------------------------------------------
    name: Functional - WP ${{ matrix.wp }} on PHP ${{ matrix.php }}
    strategy:
      fail-fast: false
      matrix:
        php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
        wp: ['latest']
        allowed-to-fail: [false]
        include:
          - php: '5.6'
            wp: 'trunk'
            allowed-to-fail: false
          - php: '7.4'
            wp: 'trunk'
            allowed-to-fail: false
          - php: '5.6'
            wp: '3.7'
            allowed-to-fail: true
    runs-on: ubuntu-latest
    continue-on-error: ${{ matrix.allowed-to-fail }}

    services:
      mysql:
        image: mysql:5.7
        env:
          MYSQL_DATABASE: wp_cli_test
          MYSQL_USER: root
          MYSQL_ROOT_PASSWORD: <PASSWORD>
        ports:
          - 3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:
      - name: Check out source code
        uses: actions/checkout@v2

      - name: Check existence of composer.json & behat.yml files
        id: check_files
        uses: andstor/file-existence-action@v1
        with:
          files: "composer.json, behat.yml"

      - name: Set up PHP envirnoment
        uses: shivammathur/setup-php@v2
        with:
          php-version: '${{ matrix.php }}'
          extensions: mysql, zip
          coverage: none
          tools: composer

      - name: Get Composer cache Directory
        if: steps.check_files.outputs.files_exists == 'true'
        id: composer-cache
        run: |
          echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Use Composer cache
        if: steps.check_files.outputs.files_exists == 'true'
        uses: actions/cache@master
        with:
          path: ${{ steps['composer-cache'].outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: |
            ${{ runner.os }}-composer-

      - name: Install dependencies
        if: steps.check_files.outputs.files_exists == 'true'
        run: COMPOSER_ROOT_VERSION=dev-master composer install --prefer-dist --no-progress --no-suggest

      - name: Start MySQL server
        if: steps.check_files.outputs.files_exists == 'true'
        run: sudo service mysql start

      - name: Prepare test database
        if: steps.check_files.outputs.files_exists == 'true'
        run: |
          export MYQSL_HOST=127.0.0.1
          export MYSQL_TCP_PORT=${{ job.services.mysql.ports['3306'] }}
          mysql -e 'CREATE DATABASE IF NOT EXISTS wp_cli_test;' -uroot -proot
          mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "<PASSWORD>"' -uroot -proot
          mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test_scaffold.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "<PASSWORD>"' -uroot -proot

      - name: Run Behat
        if: steps.check_files.outputs.files_exists == 'true'
        env:
          WP_VERSION: '${{ matrix.wp }}'
        run: composer behat
<commit_msg>Skip PHP 8 for funcitonal tests for now, pending Behat update<commit_after>name: Testing

on: pull_request

jobs:

  unit: #-----------------------------------------------------------------------
    name: Unit test /  PHP ${{ matrix.php }}
    strategy:
      fail-fast: false
      matrix:
        php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
    runs-on: ubuntu-latest

    steps:
      - name: Check out source code
        uses: actions/checkout@v2

      - name: Check existence of composer.json file
        id: check_files
        uses: andstor/file-existence-action@v1
        with:
          files: "composer.json, phpunit.xml.dist"

      - name: Set up PHP environment
        if: steps.check_files.outputs.files_exists == 'true'
        uses: shivammathur/setup-php@v2
        with:
          php-version: '${{ matrix.php }}'
          coverage: none
          tools: composer,cs2pr

      - name: Get Composer cache Directory
        if: steps.check_files.outputs.files_exists == 'true'
        id: composer-cache
        run: |
          echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Use Composer cache
        if: steps.check_files.outputs.files_exists == 'true'
        uses: actions/cache@master
        with:
          path: ${{ steps['composer-cache'].outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: |
            ${{ runner.os }}-composer-

      - name: Install dependencies
        if: steps.check_files.outputs.files_exists == 'true'
        run: COMPOSER_ROOT_VERSION=dev-master composer install --prefer-dist --no-progress --no-suggest

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

      - name: Run PHPUnit
        if: steps.check_files.outputs.files_exists == 'true'
        run: composer phpunit

  functional: #----------------------------------------------------------------------
    name: Functional - WP ${{ matrix.wp }} on PHP ${{ matrix.php }}
    strategy:
      fail-fast: false
      matrix:
        php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
        wp: ['latest']
        allowed-to-fail: [false]
        include:
          - php: '5.6'
            wp: 'trunk'
            allowed-to-fail: false
          - php: '7.4'
            wp: 'trunk'
            allowed-to-fail: false
          - php: '5.6'
            wp: '3.7'
            allowed-to-fail: true
    runs-on: ubuntu-latest
    continue-on-error: ${{ matrix.allowed-to-fail }}

    services:
      mysql:
        image: mysql:5.7
        env:
          MYSQL_DATABASE: wp_cli_test
          MYSQL_USER: root
          MYSQL_ROOT_PASSWORD: <PASSWORD>
        ports:
          - 3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:
      - name: Check out source code
        uses: actions/checkout@v2

      - name: Check existence of composer.json & behat.yml files
        id: check_files
        uses: andstor/file-existence-action@v1
        with:
          files: "composer.json, behat.yml"

      - name: Set up PHP envirnoment
        uses: shivammathur/setup-php@v2
        with:
          php-version: '${{ matrix.php }}'
          extensions: mysql, zip
          coverage: none
          tools: composer

      - name: Get Composer cache Directory
        if: steps.check_files.outputs.files_exists == 'true'
        id: composer-cache
        run: |
          echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Use Composer cache
        if: steps.check_files.outputs.files_exists == 'true'
        uses: actions/cache@master
        with:
          path: ${{ steps['composer-cache'].outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: |
            ${{ runner.os }}-composer-

      - name: Install dependencies
        if: steps.check_files.outputs.files_exists == 'true'
        run: COMPOSER_ROOT_VERSION=dev-master composer install --prefer-dist --no-progress --no-suggest

      - name: Start MySQL server
        if: steps.check_files.outputs.files_exists == 'true'
        run: sudo service mysql start

      - name: Prepare test database
        if: steps.check_files.outputs.files_exists == 'true'
        run: |
          export MYQSL_HOST=127.0.0.1
          export MYSQL_TCP_PORT=${{ job.services.mysql.ports['3306'] }}
          mysql -e 'CREATE DATABASE IF NOT EXISTS wp_cli_test;' -uroot -proot
          mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "<PASSWORD>"' -uroot -proot
          mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test_scaffold.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "<PASSWORD>"' -uroot -proot

      - name: Run Behat
        if: steps.check_files.outputs.files_exists == 'true'
        env:
          WP_VERSION: '${{ matrix.wp }}'
        run: composer behat

{'fraction_non_alphanumeric': 0.15556882651537773, 'fraction_numerical': 0.014830297601274012, 'mean_word_length': 1.8376164925162384, 'pattern_counts': {'":': 6, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '789862', 'n_tokens_mistral': 3219, 'n_tokens_neox': 3083, 'n_words': 737}