force vipwps if not found #25
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: Lint & Test | |
on: [push] | |
permissions: | |
contents: write | |
actions: read | |
pull-requests: write | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Composer dependencies | |
run: composer install --no-interaction --prefer-dist --optimize-autoloader | |
- name: Ensure VIPWPCS Standard is Installed | |
run: | | |
# Get the current installed_paths | |
CURRENT_PATHS=$(vendor/bin/phpcs --config-show | grep installed_paths | awk '{print $2}') | |
# Define all required paths | |
REQUIRED_PATHS="vendor/automattic/vipwpcs,vendor/pantheon-systems/pantheon-wp-coding-standards" | |
# If CURRENT_PATHS is empty, set it to all required paths | |
if [ -z "$CURRENT_PATHS" ]; then | |
vendor/bin/phpcs --config-set installed_paths "$REQUIRED_PATHS" | |
else | |
vendor/bin/phpcs --config-set installed_paths "$CURRENT_PATHS,vendor/automattic/vipwpcs" | |
fi | |
# List registered standards | |
vendor/bin/phpcs -i | |
- name: Lint | |
run: composer lint | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
services: | |
mariadb: | |
image: mariadb:10.6 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Start MariaDB | |
run: sudo systemctl start mysql | |
- name: Setup WP-CLI | |
uses: godaddy-wordpress/setup-wp-cli@1 | |
- name: Install Composer dependencies | |
run: | | |
composer install | |
chmod +x bin/*.sh | |
- name: Test | |
run: bash ./bin/phpunit-test.sh |