|
| 1 | +name: Unit/Integration tests PHP |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - develop |
| 8 | +jobs: |
| 9 | + run: |
| 10 | + runs-on: ${{ matrix.operating-system }} |
| 11 | + |
| 12 | + strategy: |
| 13 | + fail-fast: true |
| 14 | + matrix: |
| 15 | + operating-system: [ubuntu-latest] |
| 16 | + php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2'] |
| 17 | + wp-versions: ['latest'] |
| 18 | + |
| 19 | + name: WP ${{ matrix.wp-versions }} with PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}. |
| 20 | + |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v2 |
| 25 | + |
| 26 | + - name: Setup PHP |
| 27 | + uses: shivammathur/setup-php@v2 |
| 28 | + with: |
| 29 | + php-version: ${{ matrix.php-versions }} |
| 30 | + coverage: none # XDebug can be enabled here 'coverage: xdebug' |
| 31 | + tools: composer:v2, phpunit |
| 32 | + |
| 33 | + - name: Start mysql service |
| 34 | + run: sudo /etc/init.d/mysql start |
| 35 | + |
| 36 | + - name: Setup problem matchers for PHP |
| 37 | + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" |
| 38 | + |
| 39 | + - name: Setup problem matchers for PHPUnit |
| 40 | + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 41 | + |
| 42 | + - name: Get composer cache directory |
| 43 | + id: composercache |
| 44 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 45 | + |
| 46 | + - name: Cache dependencies |
| 47 | + uses: actions/cache@v2 |
| 48 | + with: |
| 49 | + path: ${{ steps.composercache.outputs.dir }} |
| 50 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 51 | + restore-keys: ${{ runner.os }}-composer- |
| 52 | + |
| 53 | + - name: Install dependencies |
| 54 | + run: composer install --prefer-dist --no-interaction --no-scripts |
| 55 | + |
| 56 | + - name: Install tests |
| 57 | + run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} |
| 58 | + |
| 59 | + - name: Mysql8 auth plugin workaround |
| 60 | + run: sudo mysql -u root -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" |
| 61 | + |
| 62 | + - name: Test |
| 63 | + run: composer run-tests |
0 commit comments