Skip to content

[major] Refactor WP install scripts to use WP-CLI #55

[major] Refactor WP install scripts to use WP-CLI

[major] Refactor WP install scripts to use WP-CLI #55

Workflow file for this run

name: Test
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.6
steps:
- uses: actions/checkout@v4
- name: Setup barebones project
run: |
mkdir test_proj && cd test_proj
composer init --name test/test --no-interaction --type=library --stability=dev
composer config repositories.wpunit-helpers '{"type": "vcs", "url": "https://github.com/pantheon-systems/wpunit-helpers.git"}'
composer config allow-plugins.pantheon-systems/wpunit-helpers true
composer require --dev pantheon-systems/wpunit-helpers:dev-${{ github.head_ref }}
- name: Validate that bin files were copied
run: |
cd ${{ github.workspace }}/test_proj
test -d bin || (echo "❌ bin directory not found" >&2 && exit 1)
test -f bin/install-wp-tests.sh || (echo "❌ bin/install-wp-tests.sh not found" >&2 && exit 1)
test -f bin/install-local-tests.sh || (echo "❌ bin/install-local-tests.sh not found" >&2 && exit 1)
test -f bin/phpunit-test.sh || (echo "❌ bin/phpunit-test.sh not found" >&2 && exit 1)
test -f bin/helpers.sh || (echo "❌ bin/helpers.sh not found" >&2 && exit 1)
echo "✅ All bin files found"
- name: Start MySQL
run: |
sudo systemctl start mysql
# Validate that MySQL is running
sudo systemctl status mysql
# Connect to MySQL to test auth.
mysql -e "SELECT 1" -uroot -proot
- 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
sudo mv wp-cli.phar /usr/local/bin/wp
- name: Run local install
shell: bash
run: |
echo "Testing latest install..."
mkdir -p ${{ github.workspace }}/local_tests
bash ${{ github.workspace }}/test_proj/bin/install-local-tests.sh --dbpass=root --tmpdir=${{ github.workspace }}/local_tests
echo "Testing nightly install..."
set -x
bash ${{ github.workspace }}/test_proj/bin/install-local-tests.sh --version=nightly --no-db --tmpdir=${{ github.workspace }}/local_tests
- name: Run PHPUnit Test Install
run: bash ${{ github.workspace }}/test_proj/bin/phpunit-test.sh --tmpdir=${{ github.workspace }}/local_tests