3.6.8 #180
Workflow file for this run
This file contains hidden or 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: Feature Tests | |
| on: | |
| push: | |
| branches: [ master, v3 ] | |
| pull_request: | |
| branches: [ master, v3 ] | |
| env: | |
| SITE_URL: simplejwtlogin.local | |
| DB_PASSWORD: root | |
| WP_USER: admin | |
| WP_PASSWORD: admin | |
| WP_EMAIL: contact@simplejwtlogin.com | |
| jobs: | |
| run: | |
| runs-on: ubuntu-latest | |
| name: Simple-JWT-Login Feature tests | |
| strategy: | |
| matrix: | |
| php_version: [ 8.2, 8.3, 8.4 ] | |
| steps: | |
| - name: "Checkout" | |
| uses: actions/checkout@v4 | |
| - name: "🔧 Setup PHP" | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php_version }} | |
| extension: mbstring, intl #setup extensions | |
| ini-values: post_max_size=256M, short_open_tag=Off, error_reporting=E_ALL, display_errors=On, display_startup_errors=On #setup php.ini configuration | |
| coverage: xdebug #setup coverage driver | |
| pecl: false | |
| - name: "🚧 MySQL Setup" | |
| run: | | |
| sudo /etc/init.d/mysql start | |
| mysql --user="root" --password="root" --execute="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$DB_PASSWORD';" | |
| - name: "🚧 Apache Setup" | |
| run: | | |
| sudo add-apt-repository -y ppa:ondrej/php | |
| sudo apt-get update | |
| sudo apt-get install -y libapache2-mod-php${{ matrix.php_version }} | |
| sudo a2enmod php${{ matrix.php_version }} | |
| sudo /etc/init.d/apache2 start | |
| - name: "🚧 Install WordPress" | |
| run: | | |
| echo "PATH:" | |
| echo "$PATH" | |
| sudo chmod -R 777 /var/www/html | |
| sudo rm -rf /var/www/html/* | |
| curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
| sudo mv wp-cli.phar /usr/local/bin/wp | |
| sudo chmod +x /usr/local/bin/wp | |
| wp core download --path=/var/www/html/ | |
| wp config create --dbname=wordpress --dbuser=root --dbpass=$DB_PASSWORD --dbhost=localhost --dbprefix=wp_ --path=/var/www/html | |
| chmod 600 /var/www/html/wp-config.php | |
| wp db create --path=/var/www/html | |
| wp db check --path=/var/www/html | |
| wp core install --url="$SITE_URL" --title="Test WP" --admin_user="$WP_USER" --admin_password="$WP_PASSWORD" --admin_email="$WP_EMAIL" --path=/var/www/html | |
| wp option get siteurl --path=/var/www/html | |
| wp config set --raw WP_DEBUG true --path=/var/www/html | |
| wp config set --raw WP_DEBUG_LOG true --path=/var/www/html | |
| wp config set --raw WP_DEBUG_DISPLAY true --path=/var/www/html | |
| echo "127.0.0.1 $SITE_URL" | sudo tee -a /etc/hosts | |
| - name: "🚧 Init the plugin" | |
| run: | | |
| cp -R simple-jwt-login /var/www/html/wp-content/plugins | |
| wp plugin activate simple-jwt-login --path=/var/www/html | |
| - name: "🚧 Prepare Feature tests" | |
| run: | | |
| cp phpunit.xml.actions.dist /var/www/html/wp-content/plugins/phpunit.xml | |
| cp composer.json /var/www/html/wp-content/plugins/ | |
| cp bootstrap.php /var/www/html/wp-content/plugins/ | |
| cp -R tests /var/www/html/wp-content/plugins | |
| cd /var/www/html/wp-content/plugins | |
| composer install --prefer-dist --no-progress | |
| mkdir -p /var/www/html/wp-content/plugins/.phpunit.cache/code-coverage | |
| sudo chmod -R 777 /var/www/html/wp-content/plugins/.phpunit.cache/ | |
| touch clover.xml | |
| - name: "🚧 Change /var/www/html owner" | |
| run: | | |
| sudo chown -R www-data:www-data /var/www/html | |
| - name: "🚑️ Site healthcheck" | |
| run: | | |
| echo "🩺 Healthcheck WordPress endpoint" | |
| curl -v "http://$SITE_URL/index.php?rest_route=/wp/v2/users" | |
| echo "🩺 Healthcheck Simple-JWT-Login endpoint" | |
| curl -X POST -v "http://$SITE_URL/index.php?rest_route=/simple-jwt-login/v1/users" | |
| - name: "🧪 Run the Feature tests" | |
| run: | | |
| cd /var/www/html | |
| echo "🔖 WordPress Version: $(wp core version)" | |
| echo "🔖 PHP Version: $(php -v)" | |
| cd /var/www/html/wp-content/plugins/ | |
| echo "🧪 Running the tests..." | |
| vendor/bin/phpunit --testsuite "Feature" --testdox --do-not-cache-result |