Skip to content

Commit 5c51305

Browse files
committed
Add embed build tests
1 parent 43cc9d0 commit 5c51305

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

.github/workflows/tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,7 @@ jobs:
199199

200200
- name: "Run Build Tests (build)"
201201
run: php src/globals/test-extensions.php build_cmd ${{ matrix.os }} ${{ matrix.php }}
202+
203+
- name: "Run Build Tests (build - embed for non-windows)"
204+
if: matrix.os != 'windows-latest'
205+
run: php src/globals/test-extensions.php build_embed_cmd ${{ matrix.os }} ${{ matrix.php }}

src/SPC/command/BuildCliCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ public function handle(): int
181181

182182
// compile stopwatch :P
183183
$time = round(microtime(true) - START_TIME, 3);
184-
logger()->info('Build complete, used ' . $time . ' s !');
184+
logger()->info('');
185+
logger()->info(' Build complete, used ' . $time . ' s !');
186+
logger()->info('');
185187

186188
// ---------- When using bin/spc-alpine-docker, the build root path is different from the host system ----------
187189
$build_root_path = BUILD_ROOT_PATH;

src/globals/test-extensions.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
$upx = false;
3535

3636
// prefer downloading pre-built packages to speed up the build process
37-
$prefer_pre_built = false;
37+
$prefer_pre_built = true;
3838

3939
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
4040
$extensions = match (PHP_OS_FAMILY) {
41-
'Linux', 'Darwin' => 'parallel',
41+
'Linux', 'Darwin' => 'apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,ftp,gd,gmp,gettext,iconv,igbinary,imagick,intl,ldap,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,parallel,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,ssh2,sysvmsg,sysvsem,sysvshm,tidy,tokenizer,xlswriter,xml,xmlreader,xmlwriter,zip,zlib,yaml,zstd',
4242
'Windows' => 'amqp,apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,ds,exif,ffi,fileinfo,filter,ftp,gd,iconv,igbinary,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_sqlite,pdo_sqlsrv,phar,rar,redis,session,shmop,simdjson,simplexml,soap,sockets,sqlite3,sqlsrv,ssh2,swow,sysvshm,tokenizer,xml,xmlreader,xmlwriter,yac,yaml,zip,zlib',
4343
};
4444

@@ -52,7 +52,7 @@
5252
// You can use `common`, `bulk`, `minimal` or `none`.
5353
// note: combination is only available for *nix platform. Windows must use `none` combination
5454
$base_combination = match (PHP_OS_FAMILY) {
55-
'Linux', 'Darwin' => 'minimal',
55+
'Linux', 'Darwin' => 'none',
5656
'Windows' => 'none',
5757
};
5858

@@ -121,7 +121,6 @@ function quote2(string $param): string
121121
$build_cmd .= $no_strip ? '--no-strip ' : '';
122122
$build_cmd .= $upx ? '--with-upx-pack ' : '';
123123
$build_cmd .= $final_libs === '' ? '' : ('--with-libs=' . quote2($final_libs) . ' ');
124-
$build_cmd .= '--build-cli --build-micro ';
125124
$build_cmd .= str_starts_with($argv[2], 'windows-') ? '' : '--build-fpm ';
126125
$build_cmd .= '--debug ';
127126
}
@@ -150,9 +149,16 @@ function quote2(string $param): string
150149
}
151150
} elseif ($argv[1] === 'build_cmd') {
152151
if (str_starts_with($argv[2], 'windows-')) {
153-
passthru('powershell.exe -file .\bin\spc.ps1 ' . $build_cmd, $retcode);
152+
passthru('powershell.exe -file .\bin\spc.ps1 ' . $build_cmd . ' --build-cli --build-micro', $retcode);
154153
} else {
155-
passthru('./bin/spc ' . $build_cmd, $retcode);
154+
passthru('./bin/spc ' . $build_cmd . ' --build-cli --build-micro', $retcode);
155+
}
156+
} elseif ($argv[1] === 'build_embed_cmd') {
157+
if (str_starts_with($argv[2], 'windows-')) {
158+
// windows does not accept embed SAPI
159+
passthru('powershell.exe -file .\bin\spc.ps1 ' . $build_cmd . ' --build-cli', $retcode);
160+
} else {
161+
passthru('./bin/spc ' . $build_cmd . ' --build-embed', $retcode);
156162
}
157163
}
158164

0 commit comments

Comments
 (0)