|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + |
| 7 | + test: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + services: |
| 10 | + mysql: |
| 11 | + image: mysql:5.7 |
| 12 | + env: |
| 13 | + MYSQL_ALLOW_EMPTY_PASSWORD: true |
| 14 | + MYSQL_ROOT_PASSWORD: root |
| 15 | + MYSQL_DATABASE: wordpress_test |
| 16 | + ports: |
| 17 | + - 3306:3306 |
| 18 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + include: |
| 22 | + - php: 8.0 |
| 23 | + wp: trunk |
| 24 | + |
| 25 | + name: PHP ${{ matrix.php }} / WP ${{ matrix.wp }} Test |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v2 |
| 28 | + |
| 29 | + - name: Setup PHP |
| 30 | + uses: shivammathur/setup-php@master |
| 31 | + with: |
| 32 | + tools: phpunit-polyfills, phpunit |
| 33 | + php-version: ${{ matrix.php }} |
| 34 | + extensions: mbstring, intl , mysqli |
| 35 | + ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration |
| 36 | + coverage: xdebug #optional, setup coverage driver |
| 37 | + |
| 38 | + - name: Check PHP Version |
| 39 | + run: php -v |
| 40 | + |
| 41 | + - name: Cache composer packages |
| 42 | + uses: actions/cache@v2 |
| 43 | + with: |
| 44 | + path: vendor |
| 45 | + key: composer-${{ hashFiles('composer.lock') }} |
| 46 | + |
| 47 | + - name: Composer install |
| 48 | + run: composer install --optimize-autoloader --prefer-dist |
| 49 | + |
| 50 | + - name: Install WP Tests |
| 51 | + run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wp }} true |
| 52 | + |
| 53 | + - name: Build |
| 54 | + run: | |
| 55 | + bash ./bin/build.sh |
| 56 | +
|
| 57 | + - name: phpunit tests |
| 58 | + run: | |
| 59 | + phpunit |
| 60 | + WP_MULTISITE=1 phpunit |
| 61 | +
|
| 62 | + lint: |
| 63 | + runs-on: ubuntu-latest |
| 64 | + name: PHP lint |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@v2 |
| 67 | + - name: Setup PHP |
| 68 | + uses: shivammathur/setup-php@v2 |
| 69 | + with: |
| 70 | + php-version: 7.3 |
| 71 | + extensions: mbstring, intl #optional, setup extensions |
| 72 | + ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration |
| 73 | + coverage: xdebug #optional, setup coverage driver |
| 74 | + |
| 75 | + - name: Check PHP Version |
| 76 | + run: php -v |
| 77 | + |
| 78 | + - name: Cache composer packages |
| 79 | + uses: actions/cache@v2 |
| 80 | + with: |
| 81 | + path: vendor |
| 82 | + key: composer-${{ hashFiles('composer.lock') }} |
| 83 | + |
| 84 | + - name: Composer install |
| 85 | + run: composer install --optimize-autoloader --prefer-dist |
| 86 | + |
| 87 | + - name: phpcs tests |
| 88 | + run: composer phpcs |
| 89 | + |
| 90 | + release: |
| 91 | + name: Release |
| 92 | + runs-on: ubuntu-latest |
| 93 | + needs: [test,lint] |
| 94 | + steps: |
| 95 | + - uses: actions/checkout@v2 |
| 96 | + - name: Build |
| 97 | + if: contains(github.ref, 'tags/') |
| 98 | + run: | |
| 99 | + bash ./bin/build.sh |
| 100 | + - name: WordPress Plugin Deploy |
| 101 | + if: contains(github.ref, 'tags/') |
| 102 | + uses: 10up/action-wordpress-plugin-deploy@master |
| 103 | + env: |
| 104 | + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} |
| 105 | + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} |
| 106 | + SLUG: custom-post-type-permalinks |
0 commit comments