Fix tests CI

This commit is contained in:
crazywhalecc 2024-10-04 15:48:12 +08:00 committed by Jerry Ma
parent d93c8fcb45
commit 85df4731d1
2 changed files with 44 additions and 15 deletions

View File

@ -193,18 +193,8 @@ jobs:
- name: "Run Build Tests (download)"
run: |
bin/spc download --for-extensions="$(php src/globals/test-extensions.php extensions)" --for-libs="$(php src/globals/test-extensions.php libs)" --with-php=${{ matrix.php }} --ignore-cache-sources=php-src --debug --retry=5 --shallow-clone $(php src/globals/test-extensions.php prefer_pre_built)
bin/spc $(php src/globals/test-extensions.php download_cmd ${{ matrix.os }} ${{ matrix.php }})
- name: "Download pre-built libraries for pkg-config"
if: matrix.os != 'windows-latest'
- name: "Run Build Tests (build)"
run: |
bin/spc del-download pkg-config
bin/spc download pkg-config --prefer-pre-built --debug
- name: "Run Build Tests (build, *nix)"
if: matrix.os != 'windows-latest'
run: bin/spc build "$(php src/globals/test-extensions.php extensions)" $(php src/globals/test-extensions.php zts) $(php src/globals/test-extensions.php no_strip) $UPX_CMD --with-libs="$(php src/globals/test-extensions.php libs)" --build-cli --build-micro --build-fpm --debug
- name: "Run Build Tests (build, windows)"
if: matrix.os == 'windows-latest'
run: bin/spc build "$(php src/globals/test-extensions.php extensions)" $(php src/globals/test-extensions.php zts) $(php src/globals/test-extensions.php no_strip) $env:UPX_CMD --with-libs="$(php src/globals/test-extensions.php libs)" --build-cli --build-micro --debug
bin/spc $(php src/globals/test-extensions.php build_cmd ${{ matrix.os }} ${{ matrix.php }})

View File

@ -11,16 +11,31 @@ declare(strict_types=1);
// --------------------------------- edit area ---------------------------------
$test_php_version = ['8.0', '8.1', '8.2', '8.3'];
// test php version
$test_php_version = [
'8.0',
// '8.1',
// '8.2',
'8.3',
];
$test_os = ['macos-14', 'ubuntu-latest', 'macos-13', 'windows-latest'];
// test os (macos-13, macos-14, ubuntu-latest, windows-latest are available)
$test_os = [
'macos-14',
'ubuntu-latest',
'macos-13',
'windows-latest',
];
// whether enable thread safe
$zts = true;
$no_strip = false;
// compress with upx
$upx = false;
// prefer downloading pre-built packages to speed up the build process
$prefer_pre_built = true;
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
@ -78,6 +93,28 @@ if (PHP_OS_FAMILY === 'Windows') {
$final_extensions_cmd = $final_extensions;
}
// generate download command
$down_cmd = 'download ';
$down_cmd .= '--for-extensions="' . $final_extensions . '" ';
$down_cmd .= '--for-libs="' . $final_libs . '" ';
$down_cmd .= '--with-php="' . $argv[3] . '" ';
$down_cmd .= '--ignore-cache-sources=php-src ';
$down_cmd .= '--debug ';
$down_cmd .= '--retry=5 ';
$down_cmd .= '--shallow-clone ';
$down_cmd .= $prefer_pre_built ? '--prefer-pre-built ' : '';
// generate build command
$build_cmd = 'build ';
$build_cmd .= '"' . $final_extensions . '" ';
$build_cmd .= $zts ? '--enable-zts ' : '';
$build_cmd .= $no_strip ? '--no-strip ' : '';
$build_cmd .= $upx ? '--with-upx-pack ' : '';
$build_cmd .= $final_libs === '' ? '' : ('--with-libs="' . $final_libs . '" ');
$build_cmd .= '--build-cli --build-micro ';
$build_cmd .= str_starts_with($argv[2], 'windows-') ? '' : '--build-fpm ';
$build_cmd .= '--debug ';
echo match ($argv[1]) {
'os' => json_encode($test_os),
'php' => json_encode($test_php_version),
@ -89,5 +126,7 @@ echo match ($argv[1]) {
'no_strip' => $no_strip ? '--no-strip' : '',
'upx' => $upx ? '--with-upx-pack' : '',
'prefer_pre_built' => $prefer_pre_built ? '--prefer-pre-built' : '',
'download_cmd' => $down_cmd,
'build_cmd' => $build_cmd,
default => '',
};