Isolate vendor dependencies #503
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: PHP Code Analysis | |
on: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
jobs: | |
php-stan: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ['7.4'] | |
steps: | |
- name: Install PHP 7.4 | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: intl #optional | |
ini-values: "post_max_size=256M" #optional | |
- name: Install wordpress | |
run: | | |
curl -O https://wordpress.org/latest.tar.gz | |
tar xzvf latest.tar.gz | |
rm latest.tar.gz | |
- name: Install woocommerce plugin | |
run: | | |
wget https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip | |
unzip woocommerce.latest-stable.zip | |
rm woocommerce.latest-stable.zip | |
working-directory: wordpress/wp-content/plugins | |
- name: Install woocommerce-subscriptions plugin | |
run: | | |
git clone https://github.com/wp-premium/woocommerce-subscriptions.git | |
working-directory: wordpress/wp-content/plugins | |
- name: Install wordpress-develop-tests plugin | |
run: | | |
git clone https://github.com/bobbingwide/wordpress-develop-tests.git | |
working-directory: wordpress/wp-content/plugins | |
- run: mkdir wordpress/wp-content/plugins/plugin-wordpress | |
- uses: actions/checkout@v2 | |
with: | |
path: wordpress/wp-content/plugins/plugin-wordpress | |
- name: Install and run PhpStan | |
run: | | |
composer install --no-interaction | |
vendor/bin/phpstan analyze | |
working-directory: wordpress/wp-content/plugins/plugin-wordpress | |
- name: Install PHP 7.4 | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
extensions: intl #optional | |
ini-values: "post_max_size=256M" #optional | |
- name: Run php7.4 linter | |
run: | | |
find . -path ./vendor -prune -false -o -type f -name '*.php' -print0 | xargs -0 -n1 -P$(nproc) php7.4 -l -n | (! grep -v "No syntax errors detected" ) | |
working-directory: wordpress/wp-content/plugins/plugin-wordpress | |
- name: Install PHP 7.4 | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
extensions: intl #optional | |
ini-values: "post_max_size=256M" #optional | |
- name: Run php7.4 linter | |
run: | | |
find . -path ./vendor -prune -false -o -type f -name '*.php' -print0 | xargs -0 -n1 -P$(nproc) php7.4 -l -n | (! grep -v "No syntax errors detected" ) | |
working-directory: wordpress/wp-content/plugins/plugin-wordpress | |
- name: Install PHP 8.1 | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: intl #optional | |
ini-values: "post_max_size=256M" #optional | |
- name: Run php8.1 linter | |
run: | | |
find . -path ./vendor -prune -false -o -type f -name '*.php' -print0 | xargs -0 -n1 -P$(nproc) php8.1 -l -n | (! grep -v "No syntax errors detected" ) | |
working-directory: wordpress/wp-content/plugins/plugin-wordpress |