|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + lint: |
| 15 | + name: Lint |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - uses: shivammathur/setup-php@v2 |
| 21 | + with: |
| 22 | + php-version: '8.3' |
| 23 | + coverage: none |
| 24 | + tools: composer |
| 25 | + |
| 26 | + - uses: ramsey/composer-install@v3 |
| 27 | + |
| 28 | + - run: composer lint |
| 29 | + |
| 30 | + phpstan: |
| 31 | + name: PHPStan |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - uses: shivammathur/setup-php@v2 |
| 37 | + with: |
| 38 | + php-version: '8.3' |
| 39 | + coverage: none |
| 40 | + tools: composer |
| 41 | + |
| 42 | + - uses: ramsey/composer-install@v3 |
| 43 | + |
| 44 | + - run: composer phpstan |
| 45 | + |
| 46 | + phpunit: |
| 47 | + name: PHPUnit - PHP ${{ matrix.php }} |
| 48 | + runs-on: ubuntu-latest |
| 49 | + strategy: |
| 50 | + fail-fast: false |
| 51 | + matrix: |
| 52 | + php: ['8.1', '8.2', '8.3', '8.4'] |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v4 |
| 55 | + |
| 56 | + - uses: shivammathur/setup-php@v2 |
| 57 | + with: |
| 58 | + php-version: ${{ matrix.php }} |
| 59 | + coverage: none |
| 60 | + tools: composer |
| 61 | + |
| 62 | + - uses: ramsey/composer-install@v3 |
| 63 | + |
| 64 | + - run: composer phpunit |
| 65 | + |
| 66 | + behat: |
| 67 | + name: Behat - PHP ${{ matrix.php }}, WP ${{ matrix.wp }} |
| 68 | + runs-on: ubuntu-latest |
| 69 | + strategy: |
| 70 | + fail-fast: false |
| 71 | + matrix: |
| 72 | + php: ['8.1', '8.3'] |
| 73 | + wp: ['latest'] |
| 74 | + include: |
| 75 | + - php: '8.4' |
| 76 | + wp: 'trunk' |
| 77 | + env: |
| 78 | + WP_CLI_TEST_DBROOTUSER: root |
| 79 | + WP_CLI_TEST_DBROOTPASS: root |
| 80 | + WP_CLI_TEST_DBNAME: wp_cli_test |
| 81 | + WP_CLI_TEST_DBUSER: wp_cli_test |
| 82 | + WP_CLI_TEST_DBPASS: password1 |
| 83 | + WP_CLI_TEST_DBHOST: 127.0.0.1:3306 |
| 84 | + steps: |
| 85 | + - uses: actions/checkout@v4 |
| 86 | + |
| 87 | + - uses: shivammathur/setup-php@v2 |
| 88 | + with: |
| 89 | + php-version: ${{ matrix.php }} |
| 90 | + extensions: gd, imagick, mysql, zip |
| 91 | + coverage: none |
| 92 | + tools: composer |
| 93 | + |
| 94 | + - uses: ramsey/composer-install@v3 |
| 95 | + |
| 96 | + - uses: shogo82148/actions-setup-mysql@v1 |
| 97 | + with: |
| 98 | + mysql-version: '8.0' |
| 99 | + auto-start: true |
| 100 | + root-password: root |
| 101 | + user: wp_cli_test |
| 102 | + password: password1 |
| 103 | + my-cnf: | |
| 104 | + default_authentication_plugin=mysql_native_password |
| 105 | +
|
| 106 | + - name: Prepare test database |
| 107 | + run: composer prepare-tests |
| 108 | + |
| 109 | + - name: Run Behat |
| 110 | + env: |
| 111 | + WP_VERSION: ${{ matrix.wp }} |
| 112 | + run: composer behat || composer behat-rerun |
0 commit comments