Test Plugin Install #10275
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
name: Test Plugin Install | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '5 */12 * * *' | |
jobs: | |
test-install: | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: ['7.4', '8.0', '8.1', '8.2'] | |
wordpress-versions: ['5.8', '5.9', '6.0', '6.1', '6.2', '6.3', '6.4', 'latest', 'nightly'] | |
exclude: | |
- php-versions: '7.4' | |
wordpress-versions: '6.4' | |
experimental: [false] | |
# Uncomment for testing other experimental version combinations | |
# include: | |
# - php-versions: '8.2' | |
# wordpress-versions: '5.9' | |
# experimental: true | |
env: | |
MYSQL_DATABASE: wp | |
MYSQL_USER: wp | |
MYSQL_PASSWORD: wp | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: gd, mbstring, mysqli, zip | |
- name: Install WP-CLI | |
run: | | |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
chmod +x wp-cli.phar | |
mv wp-cli.phar /usr/local/bin/wp | |
- name: Start MySQL | |
run: sudo systemctl start mysql.service | |
- name: Create MySQL database | |
run: > | |
mysql --user=root --password=root -e " | |
CREATE DATABASE \`$MYSQL_DATABASE\` ; | |
CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ; | |
GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ; | |
FLUSH PRIVILEGES ; | |
" | |
- name: Create Directory | |
run: mkdir wp_root | |
- name: Cache WordPress Download | |
id: cache-wp | |
uses: actions/cache@v3 | |
with: | |
path: wp_root | |
key: ${{ matrix.wordpress-versions }}-wp | |
- name: Download WordPress | |
if: steps.cache-wp.outputs.cache-hit != 'true' | |
run: > | |
wp core download | |
--version=${{ matrix.wordpress-versions }} | |
--force | |
working-directory: wp_root | |
- name: Configure WordPress | |
run: > | |
wp config create | |
--allow-root | |
--dbname=$MYSQL_DATABASE | |
--dbuser=$MYSQL_USER | |
--dbpass=$MYSQL_PASSWORD | |
--force | |
working-directory: wp_root | |
- name: Install WordPress | |
run: > | |
wp core install | |
--allow-root | |
--url=localhost | |
--title=WP | |
--admin_user=admin | |
--admin_email=example@example.com | |
--admin_password=password | |
--skip-email | |
working-directory: wp_root | |
- name: Build Plugin | |
run: | | |
composer update | |
composer run build | |
- name: Install Plugin | |
run: > | |
wp plugin install platforminfo.zip | |
--path=wp_root | |
--force | |
--activate | |
- name: Run due cron events | |
run: > | |
wp cron event run | |
--due-now | |
working-directory: wp_root |