more, more, moar #753
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://github.com/wp-cli/scaffold-command/blob/f9bad3dd7224d5684d950d31c486df70905e386f/templates/plugin-github.mustache | |
# Thanks Josh https://github.com/Shelob9/wordpress-plugin/blob/main/.github/workflows/wordpress.yml | |
# Thanks https://github.com/shivammathur | |
# Thanks Alex Stine for rubber ducking and help figuring out MySQL 5.7 | |
# Thanks @desrosj for idea to just use MySQL 8.0 with correct authentication method. | |
name: WordPress Tests | |
on: | |
push: | |
branches: | |
- develop | |
- master | |
pull_request: | |
branches: | |
- develop | |
- master | |
jobs: | |
run: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: ["7.4", "8.0", "8.1", "8.2", "8.3"] | |
name: PHP ${{ matrix.php-versions }} Test on ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Setup MySQL 8.0 with mysql_native_password | |
uses: shogo82148/actions-setup-mysql@v1 | |
with: | |
mysql-version: "8.0" | |
my-cnf: | | |
bind_address=127.0.0.1 | |
default-authentication-plugin=mysql_native_password | |
root-password: root | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
coverage: none | |
extensions: mysql, mysqli | |
tools: composer, wp-cli, phpunit-polyfills:1.1 | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Composer install | |
run: composer install --optimize-autoloader --prefer-dist | |
- name: Install WP Tests | |
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 latest | |
- name: PHPUnit tests | |
run: | | |
echo "define('WP_TESTS_PHPUNIT_POLYFILLS_PATH', '$HOME/.composer/vendor/yoast/phpunit-polyfills');" >> /tmp/wordpress-tests-lib/wp-tests-config.php | |
phpunit --config=phpunit.xml |