diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a7166ec2e..13441a81f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,7 +7,11 @@ > If your PR involves the changes mentioned below and completed the action, please tick the corresponding option. > If a modification is not involved, please skip it directly. -- [ ] If you modified `*.php`, run `composer cs-fix` at local machine. -- [ ] If it's an extension or dependency update, make sure adding related extensions in `src/global/test-extensions.php`. -- [ ] If you changed the behavior of static-php-cli, update docs in `./docs/`. -- [ ] If you updated `config/xxx.json` content, run `bin/spc dev:sort-config xxx`. +- If you modified `*.php` or `*.json`, run them locally to ensure your changes are valid: + - [ ] `PHP_CS_FIXER_IGNORE_ENV=1 composer cs-fix` + - [ ] `composer analyse` + - [ ] `composer test` + - [ ] `bin/spc dev:sort-config` +- If it's an extension or dependency update, please ensure the following: + - [ ] Add your test combination to `src/globals/test-extensions.php`. + - [ ] If adding new or fixing bugs, add commit message containing `extension test` or `test extensions` to trigger full test suite. diff --git a/.github/workflows/ext-matrix-tests.yml b/.github/workflows/ext-matrix-tests.yml index da30d0086..1c04f5c93 100644 --- a/.github/workflows/ext-matrix-tests.yml +++ b/.github/workflows/ext-matrix-tests.yml @@ -1,16 +1,14 @@ -name: "Extension matrix tests" +name: "Extension Matrix Tests" on: workflow_dispatch: - pull_request: - branches: [ "main" ] - paths: - - '.github/workflows/ext-matrix-tests.yml' + push: jobs: test: name: "${{ matrix.extension }} (PHP ${{ matrix.php-version }} on ${{ matrix.operating-system }})" runs-on: ${{ matrix.operating-system }} + if: contains(github.event.head_commit.message, 'extension test') || contains(github.event.head_commit.message, 'test extensions') strategy: fail-fast: false matrix: diff --git a/docs/deps-craft-yml.md b/docs/deps-craft-yml.md index 9e660be88..0ee0e11d0 100644 --- a/docs/deps-craft-yml.md +++ b/docs/deps-craft-yml.md @@ -42,6 +42,9 @@ build-options: # Set micro SAPI as win32 mode, without this, micro SAPI will be compiled as a console application (only for Windows, default: false) enable-micro-win32: false +# Build options for shared extensions (list or comma-separated are both accepted) +shared-extensions: [ ] + # Download options download-options: # Use custom url for specified sources, format: "{source-name}:{url}" (e.g. "php-src:https://example.com/php-8.4.0.tar.gz") diff --git a/src/SPC/command/CraftCommand.php b/src/SPC/command/CraftCommand.php index 8d3cc2bee..9a2ac4419 100644 --- a/src/SPC/command/CraftCommand.php +++ b/src/SPC/command/CraftCommand.php @@ -49,7 +49,7 @@ public function handle(): int } $static_extensions = implode(',', $craft['extensions']); - $shared_extensions = implode(',', $craft['shared-extensions']); + $shared_extensions = implode(',', $craft['shared-extensions'] ?? []); $libs = implode(',', $craft['libs']); // init log diff --git a/src/SPC/util/ConfigValidator.php b/src/SPC/util/ConfigValidator.php index eae2ef2bd..dbc8ce236 100644 --- a/src/SPC/util/ConfigValidator.php +++ b/src/SPC/util/ConfigValidator.php @@ -164,6 +164,12 @@ public static function validateAndParseCraftFile(mixed $craft_file, Command $com if (is_string($craft['extensions'])) { $craft['extensions'] = array_filter(array_map(fn ($x) => trim($x), explode(',', $craft['extensions']))); } + if (!isset($craft['shared-extensions'])) { + $craft['shared-extensions'] = []; + } + if (is_string($craft['shared-extensions'] ?? [])) { + $craft['shared-extensions'] = array_filter(array_map(fn ($x) => trim($x), explode(',', $craft['shared-extensions']))); + } // check libs if (isset($craft['libs']) && is_string($craft['libs'])) { $craft['libs'] = array_filter(array_map(fn ($x) => trim($x), explode(',', $craft['libs'])));