[major] Refactor WP install scripts to use WP-CLI #99
Workflow file for this run
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 | |
on: [pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
actions: write | |
services: | |
mariadb: | |
image: mariadb:10.6 | |
steps: | |
- uses: actions/checkout@v4 | |
- 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: 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 | |
env: | |
TEST_PROJECT_DIR: ${{ github.workspace }}/test_proj | |
run: ${{ github.workspace }}/.github/workflows/bin/validate-bin-files.sh | |
- name: Run local install | |
shell: bash | |
env: | |
GITHUB_WORKSPACE: ${{ github.workspace }} | |
DB_NAME: wordpress_test | |
DB_USER: root | |
DB_PASS: root | |
DB_HOST: 127.0.0.1 | |
run: ${{ github.workspace }}/.github/workflows/bin/run-local-tests.sh | |
- name: Run PHPUnit Test Install | |
run: bash ${{ github.workspace }}/test_proj/bin/phpunit-test.sh --tmpdir=${{ github.workspace }}/local_tests | |