Skip to content

Test Current Directory Plugin Install #3975

Test Current Directory Plugin Install

Test Current Directory Plugin Install #3975

name: Test Current Directory Plugin Install
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '5 */12 * * *'
workflow_dispatch:
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:
WPROOT: /var/www/html/wordpress
services:
database:
image: mariadb:10.7
env:
MARIADB_DATABASE: wp
MARIADB_USER: wp
MARIADB_PASSWORD: wp
MARIADB_RANDOM_ROOT_PASSWORD: yes
ports:
- 13306:3306
# Set health checks to wait until database has started
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
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: Create Directory
run: |
id
sudo mkdir -p $WPROOT
sudo chmod a+wrx $WPROOT
ls -al $WPROOT
- name: Cache WordPress Download
id: cache-wp
uses: actions/cache@v3
with:
path: $WPROOT
key: ${{ matrix.wordpress-versions }}-wp
- name: Download WordPress
if: steps.cache-wp.outputs.cache-hit != 'true'
run: >
wp core download
--path=$WPROOT
--version=${{ matrix.wordpress-versions }}
--force
- name: Configure WordPress
run: >
wp config create
--path=$WPROOT
--allow-root
--dbhost=127.0.0.1:13306
--dbname=wp
--dbuser=wp
--dbpass=wp
--force
- name: Install WordPress
run: >
wp core install
--path=$WPROOT
--allow-root
--url=127.0.0.1:8081
--title=WP
--admin_user=admin
[email protected]
--admin_password=password
--skip-email
- name: Install Plugin from WordPress Directory
run: >
wp plugin install platforminfo
--path=$WPROOT
--force
--activate
- name: Run due cron events
run: >
wp cron event run
--path=$WPROOT
--due-now
- name: Run PHP
run: |
php -v
php -S 127.0.0.1:8081 -t /var/www/html/wordpress/ &
- name: Test WP Response (Cron)
run: wget -SO- http://127.0.0.1:8081/wp-cron.php
- name: Test WP Response (Main Page)
run: wget -SO- http://127.0.0.1:8081/
- name: Test WP Response (WP Admin)
run: wget -SO- http://127.0.0.1:8081/wp-admin/