Skip to content

Commit 24e19de

Browse files
authored
Merge pull request #768 from crazywhalecc/ci/commit-tests
Add commit tests
2 parents 04cefda + f7a3f80 commit 24e19de

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

.github/pull_request_template.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
> If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
88
> If a modification is not involved, please skip it directly.
99
10-
- [ ] If you modified `*.php`, run `composer cs-fix` at local machine.
11-
- [ ] If it's an extension or dependency update, make sure adding related extensions in `src/global/test-extensions.php`.
12-
- [ ] If you changed the behavior of static-php-cli, update docs in `./docs/`.
13-
- [ ] If you updated `config/xxx.json` content, run `bin/spc dev:sort-config xxx`.
10+
- If you modified `*.php` or `*.json`, run them locally to ensure your changes are valid:
11+
- [ ] `PHP_CS_FIXER_IGNORE_ENV=1 composer cs-fix`
12+
- [ ] `composer analyse`
13+
- [ ] `composer test`
14+
- [ ] `bin/spc dev:sort-config`
15+
- If it's an extension or dependency update, please ensure the following:
16+
- [ ] Add your test combination to `src/globals/test-extensions.php`.
17+
- [ ] If adding new or fixing bugs, add commit message containing `extension test` or `test extensions` to trigger full test suite.

.github/workflows/ext-matrix-tests.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
name: "Extension matrix tests"
1+
name: "Extension Matrix Tests"
22

33
on:
44
workflow_dispatch:
5-
pull_request:
6-
branches: [ "main" ]
7-
paths:
8-
- '.github/workflows/ext-matrix-tests.yml'
5+
push:
96

107
jobs:
118
test:
129
name: "${{ matrix.extension }} (PHP ${{ matrix.php-version }} on ${{ matrix.operating-system }})"
1310
runs-on: ${{ matrix.operating-system }}
11+
if: contains(github.event.head_commit.message, 'extension test') || contains(github.event.head_commit.message, 'test extensions')
1412
strategy:
1513
fail-fast: false
1614
matrix:

docs/deps-craft-yml.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ build-options:
4242
# Set micro SAPI as win32 mode, without this, micro SAPI will be compiled as a console application (only for Windows, default: false)
4343
enable-micro-win32: false
4444

45+
# Build options for shared extensions (list or comma-separated are both accepted)
46+
shared-extensions: [ ]
47+
4548
# Download options
4649
download-options:
4750
# Use custom url for specified sources, format: "{source-name}:{url}" (e.g. "php-src:https://example.com/php-8.4.0.tar.gz")

src/SPC/command/CraftCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function handle(): int
4949
}
5050

5151
$static_extensions = implode(',', $craft['extensions']);
52-
$shared_extensions = implode(',', $craft['shared-extensions']);
52+
$shared_extensions = implode(',', $craft['shared-extensions'] ?? []);
5353
$libs = implode(',', $craft['libs']);
5454

5555
// init log

src/SPC/util/ConfigValidator.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ public static function validateAndParseCraftFile(mixed $craft_file, Command $com
164164
if (is_string($craft['extensions'])) {
165165
$craft['extensions'] = array_filter(array_map(fn ($x) => trim($x), explode(',', $craft['extensions'])));
166166
}
167+
if (!isset($craft['shared-extensions'])) {
168+
$craft['shared-extensions'] = [];
169+
}
170+
if (is_string($craft['shared-extensions'] ?? [])) {
171+
$craft['shared-extensions'] = array_filter(array_map(fn ($x) => trim($x), explode(',', $craft['shared-extensions'])));
172+
}
167173
// check libs
168174
if (isset($craft['libs']) && is_string($craft['libs'])) {
169175
$craft['libs'] = array_filter(array_map(fn ($x) => trim($x), explode(',', $craft['libs'])));

0 commit comments

Comments
 (0)