Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run build-cs composer install/update via post-install/update-cmd scripts #962

Merged
merged 13 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/php-test-standalone-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: npm
- name: npm install
run: npm ci
- name: General debug information
run: |
npm --version
node --version
composer --version
php -v
- name: npm install
run: npm ci
- name: Building standalone plugins
run: npm run build-plugins
- name: Running single site standalone plugin integration tests
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/php-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,22 @@ jobs:
steps:
- uses: styfle/[email protected]
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I guess this isn't needed because it's running unit tests in the container.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it would allow composer install to work properly without having to run it in the container?

- name: Setup Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
- name: Composer update
run: composer update
- name: General debug information
run: |
npm --version
node --version
composer --version
php -v
- name: Composer install
run: composer install
- name: npm install
run: npm ci
- name: Install WordPress
Expand Down
17 changes: 5 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,11 @@
"php": ">=7|^8"
},
"scripts": {
"phpstan": [
"composer --working-dir=build-cs update --no-interaction",
"build-cs/vendor/bin/phpstan analyse --memory-limit=2048M -c phpstan.neon.dist"
],
"format": [
"composer --working-dir=build-cs update --no-interaction",
"build-cs/vendor/bin/phpcbf --standard=phpcs.xml.dist --report-summary --report-source"
],
"lint": [
"composer --working-dir=build-cs update --no-interaction",
"build-cs/vendor/bin/phpcs --standard=phpcs.xml.dist"
],
"post-install-cmd": "if [ $(php -r 'echo PHP_MAJOR_VERSION;') -ge 8 ]; then composer --working-dir=build-cs install --no-interaction; else echo 'Skipping composer install for build-cs since not on PHP 8.'; fi",
"post-update-cmd": "if [ $(php -r 'echo PHP_MAJOR_VERSION;') -ge 8 ]; then composer --working-dir=build-cs update --no-interaction; else echo 'Skipping composer update for build-cs since not on PHP 8.'; fi",
"phpstan": "build-cs/vendor/bin/phpstan analyse --memory-limit=2048M -c phpstan.neon.dist",
"format": "build-cs/vendor/bin/phpcbf --standard=phpcs.xml.dist --report-summary --report-source",
"lint": "build-cs/vendor/bin/phpcs --standard=phpcs.xml.dist",
"test": "phpunit -c phpunit.xml.dist --verbose",
"test-multisite": "phpunit -c tests/multisite.xml --verbose"
},
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@
"lint-js": "wp-scripts lint-js",
"format-php": "composer format",
"phpstan": "composer phpstan",
"prelint-php": "wp-env run composer 'install --no-interaction'",
"lint-php": "composer lint",
"pretest-php": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename $(pwd)) composer update --no-interaction",
"test-php": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename $(pwd)) composer test",
"pretest-php-multisite": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename $(pwd)) composer update --no-interaction",
"test-php-multisite": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename $(pwd)) composer test-multisite",
"wp-env": "wp-env",
"prepare": "husky install"
Expand Down
Loading