diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5819b4ba..5abfc6e0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -176,16 +176,16 @@ jobs: run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - name: "Run Build Tests (doctor)" - run: bin/spc doctor --auto-fix --debug + run: php src/globals/test-extensions.php doctor_cmd ${{ matrix.os }} ${{ matrix.php }} - name: "Prepare UPX for Windows" - if: matrix.os == 'windows-latest' + if: ${{ startsWith(matrix.os, 'windows-') }} run: | bin/spc install-pkg upx echo "UPX_CMD=$(php src/globals/test-extensions.php upx)" >> $env:GITHUB_ENV - name: "Prepare UPX for Linux" - if: matrix.os == 'ubuntu-latest' + if: ${{ startsWith(matrix.os, 'ubuntu-') }} run: | bin/spc install-pkg upx echo "UPX_CMD=$(php src/globals/test-extensions.php upx)" >> $GITHUB_ENV diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index bd3351a6..97f0df8d 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -24,7 +24,9 @@ $test_os = [ // 'macos-13', // 'macos-14', 'ubuntu-latest', - 'windows-latest', + 'ubuntu-22.04', + 'ubuntu-22.04-arm', + 'ubuntu-24.04-arm', ]; // whether enable thread safe @@ -115,6 +117,10 @@ if ($argv[1] === 'download_cmd') { $down_cmd .= $prefer_pre_built ? '--prefer-pre-built ' : ''; } +if ($argv[1] === 'doctor_cmd') { + $doctor_cmd = 'doctor --auto-fix --debug'; +} + // generate build command if ($argv[1] === 'build_cmd' || $argv[1] === 'build_embed_cmd') { $build_cmd = 'build '; @@ -139,30 +145,33 @@ echo match ($argv[1]) { 'upx' => $upx ? '--with-upx-pack' : '', 'prefer_pre_built' => $prefer_pre_built ? '--prefer-pre-built' : '', 'download_cmd' => $down_cmd, + 'doctor_cmd' => $doctor_cmd, 'build_cmd' => $build_cmd, 'build_embed_cmd' => $build_cmd, default => '', }; +$prefix = match ($argv[2]) { + 'windows-latest', 'windows-2022', 'windows-2019', 'windows-2025' => 'powershell.exe -file .\bin\spc.ps1 ', + 'ubuntu-latest', 'ubuntu-24.04', 'ubuntu-24.04-arm' => './bin/spc ', + 'ubuntu-22.04', 'ubuntu-22.04-arm' => 'bin/spc-gnu-docker ', + 'ubuntu-20.04' => 'bin/spc-alpine-docker ', + default => 'bin/spc ', +}; + if ($argv[1] === 'download_cmd') { - if (str_starts_with($argv[2], 'windows-')) { - passthru('powershell.exe -file .\bin\spc.ps1 ' . $down_cmd, $retcode); - } else { - passthru('./bin/spc ' . $down_cmd, $retcode); - } + passthru($prefix . $down_cmd, $retcode); } elseif ($argv[1] === 'build_cmd') { - if (str_starts_with($argv[2], 'windows-')) { - passthru('powershell.exe -file .\bin\spc.ps1 ' . $build_cmd . ' --build-cli --build-micro', $retcode); - } else { - passthru('./bin/spc ' . $build_cmd . ' --build-cli --build-micro', $retcode); - } + passthru($prefix . $build_cmd . ' --build-cli --build-micro', $retcode); } elseif ($argv[1] === 'build_embed_cmd') { if (str_starts_with($argv[2], 'windows-')) { // windows does not accept embed SAPI - passthru('powershell.exe -file .\bin\spc.ps1 ' . $build_cmd . ' --build-cli', $retcode); + passthru($prefix . $build_cmd . ' --build-cli', $retcode); } else { - passthru('./bin/spc ' . $build_cmd . ' --build-embed', $retcode); + passthru($prefix . $build_cmd . ' --build-embed', $retcode); } +} elseif ($argv[1] === 'doctor_cmd') { + passthru($prefix . $doctor_cmd, $retcode); } else { $retcode = 0; }