ci: debug Windows release zip packaging --skip-tests #31
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: tests | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: tests-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| COMPOSER_NO_INTERACTION: 1 | |
| COMPOSER_PROCESS_TIMEOUT: 0 | |
| jobs: | |
| build-phpx: | |
| name: Build PHPX (PHP ${{ matrix.php }}) | |
| # Skip the whole test pipeline when the push commit message contains `--skip-tests`. | |
| if: ${{ startsWith(github.ref, 'refs/tags/') || !contains(github.event.head_commit.message || '', '--skip-tests') }} | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ["8.4", "8.5"] | |
| env: | |
| PHPX_HOME: ${{ github.workspace }}/vendor/swoole/phpx | |
| steps: | |
| - name: Checkout TypePHP | |
| uses: actions/checkout@v4 | |
| - name: Checkout phpy | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: swoole/phpy | |
| path: third_party/phpy | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| ini-values: precision=17, memory_limit=4G, error_reporting=E_ERROR|E_WARNING, display_errors=1, display_startup_errors=1, log_errors=0 | |
| tools: composer:v2 | |
| - name: Patch php_hash.h C++ compatibility | |
| uses: ./.github/actions/patch-php-headers | |
| - name: Install native build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install --yes build-essential cmake libgmp-dev libmpfr-dev pkg-config python3-dev | |
| - name: Install Composer dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Build PHPX | |
| shell: bash | |
| run: | | |
| cmake -S "${PHPX_HOME}" -B "${PHPX_HOME}/build" \ | |
| -D CMAKE_BUILD_TYPE=Release \ | |
| -D BUILD_TESTS=OFF \ | |
| -D BUILD_EXT=OFF \ | |
| -D GITHUB_ACTION=ON | |
| cmake --build "${PHPX_HOME}/build" --target phpx --parallel 2 | |
| test -f "${PHPX_HOME}/lib/libphpx.so" | |
| - name: Build phpy | |
| working-directory: third_party/phpy | |
| run: | | |
| phpize | |
| ./configure | |
| make -j2 | |
| test -f modules/phpy.so | |
| - name: Upload PHPX library | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libphpx-php-${{ matrix.php }} | |
| if-no-files-found: error | |
| retention-days: 1 | |
| path: vendor/swoole/phpx/lib/libphpx.so | |
| - name: Upload phpy extension | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: phpy-php-${{ matrix.php }} | |
| if-no-files-found: error | |
| retention-days: 1 | |
| path: third_party/phpy/modules/phpy.so | |
| phpunit: | |
| name: PHPUnit (PHP ${{ matrix.php }}) | |
| if: ${{ startsWith(github.ref, 'refs/tags/') || !contains(github.event.head_commit.message || '', '--skip-tests') }} | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| needs: build-phpx | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ["8.4", "8.5"] | |
| env: | |
| PHPX_HOME: ${{ github.workspace }}/vendor/swoole/phpx | |
| steps: | |
| - name: Checkout TypePHP | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| extensions: curl, redis, mbstring, ffi | |
| ini-values: ffi.enable=1, phpy.enable_operator_overloading=0, precision=17, memory_limit=4G, error_reporting=E_ERROR|E_WARNING, display_errors=1, display_startup_errors=1, log_errors=0 | |
| tools: composer:v2 | |
| - name: Patch php_hash.h C++ compatibility | |
| uses: ./.github/actions/patch-php-headers | |
| - name: Install native build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install --yes build-essential cmake libgmp-dev libmpfr-dev pkg-config python3-dev | |
| - name: Install Composer dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Download PHPX library | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: libphpx-php-${{ matrix.php }} | |
| path: vendor/swoole/phpx/lib | |
| - name: Download phpy extension | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: phpy-php-${{ matrix.php }} | |
| path: third_party/phpy/modules | |
| - name: Enable phpy extension | |
| shell: bash | |
| run: | | |
| php_ini_dir="$(php-config --ini-dir)" | |
| echo "extension=${GITHUB_WORKSPACE}/third_party/phpy/modules/phpy.so" \ | |
| | sudo tee "${php_ini_dir}/90-phpy.ini" | |
| echo "PHP_INI_SCAN_DIR=${php_ini_dir}" >> "${GITHUB_ENV}" | |
| php --ri phpy | |
| - name: Configure native library path | |
| shell: bash | |
| run: echo "LD_LIBRARY_PATH=${PHPX_HOME}/lib:$(php-config --prefix)/lib" >> "${GITHUB_ENV}" | |
| - name: Run PHPUnit | |
| run: vendor/bin/phpunit | |
| phpt: | |
| name: PHPT (PHP ${{ matrix.php }}) | |
| if: ${{ startsWith(github.ref, 'refs/tags/') || !contains(github.event.head_commit.message || '', '--skip-tests') }} | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 180 | |
| needs: build-phpx | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ["8.4", "8.5"] | |
| env: | |
| PHPX_HOME: ${{ github.workspace }}/vendor/swoole/phpx | |
| NO_INTERACTION: 1 | |
| REPORT_EXIT_STATUS: 1 | |
| TYPEPHP_PHPT_GENERATED_ARTIFACT_DIR: ${{ github.workspace }}/build/phpt-generated | |
| steps: | |
| - name: Checkout TypePHP | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| extensions: embed, curl, redis, mbstring, ffi | |
| ini-values: ffi.enable=1, phpy.enable_operator_overloading=0, opcache.jit=0, precision=17, memory_limit=4G, error_reporting=E_ERROR|E_WARNING, display_errors=1, display_startup_errors=1, log_errors=0 | |
| tools: composer:v2 | |
| - name: Patch php_hash.h C++ compatibility | |
| uses: ./.github/actions/patch-php-headers | |
| - name: Install native build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install --yes build-essential cmake libgmp-dev libmpfr-dev pkg-config python3-dev | |
| - name: Configure version-matched PHP embed library | |
| shell: bash | |
| run: | | |
| embed_package="libphp${{ matrix.php }}-embed" | |
| php_version="$(php-config --version)" | |
| embed_version="$(dpkg-query --show --showformat='${Version}' "${embed_package}")" | |
| case "${embed_version}" in | |
| "${php_version}"*) ;; | |
| *) echo "PHP embed package ${embed_version} does not match PHP ${php_version}" >&2; exit 1 ;; | |
| esac | |
| embed_library="$(dpkg-query --listfiles "${embed_package}" \ | |
| | sed -n '/\/libphp[0-9][^/]*\.so$/ { p; q; }')" | |
| test -n "${embed_library}" | |
| test -f "${embed_library}" | |
| php_home="${RUNNER_TEMP}/typephp-php-${{ matrix.php }}" | |
| mkdir -p "${php_home}/bin" "${php_home}/include" "${php_home}/lib" | |
| ln -s "$(command -v php-config)" "${php_home}/bin/php-config" | |
| ln -s "$(php-config --include-dir)" "${php_home}/include/php" | |
| ln -s "${embed_library}" "${php_home}/lib/libphp.so" | |
| echo "PHP_HOME=${php_home}" >> "${GITHUB_ENV}" | |
| echo "Using ${embed_library} from ${embed_package} ${embed_version} for PHP ${php_version}" | |
| - name: Install Composer dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Download PHPX library | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: libphpx-php-${{ matrix.php }} | |
| path: vendor/swoole/phpx/lib | |
| - name: Download phpy extension | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: phpy-php-${{ matrix.php }} | |
| path: third_party/phpy/modules | |
| - name: Enable phpy extension | |
| shell: bash | |
| run: | | |
| php_ini_dir="$(php-config --ini-dir)" | |
| echo "extension=${GITHUB_WORKSPACE}/third_party/phpy/modules/phpy.so" \ | |
| | sudo tee "${php_ini_dir}/90-phpy.ini" | |
| echo "PHP_INI_SCAN_DIR=${php_ini_dir}" >> "${GITHUB_ENV}" | |
| php --ri phpy | |
| - name: Configure native library path | |
| shell: bash | |
| run: | | |
| test -f "${PHPX_HOME}/lib/libphpx.so" | |
| test -f "${PHP_HOME}/lib/libphp.so" | |
| echo "LD_LIBRARY_PATH=${PHPX_HOME}/lib:${PHP_HOME}/lib" >> "${GITHUB_ENV}" | |
| - name: Build bootstrap TypePHP compiler | |
| run: | | |
| php bin/tpc.php project.yml --job 2 --no-progress | |
| test -x ./tpc | |
| ./tpc --version | |
| - name: Show build environment | |
| run: | | |
| php -v | |
| php --ini | |
| ldd ./tpc | grep -E 'libphp(x)?[0-9.]*\.so' | |
| cmake --version | |
| c++ --version | |
| - name: Run compiler PHPT suite with bootstrap compiler | |
| run: | | |
| mkdir -p build | |
| php run-tests.php -q -j8 --compiler ./tpc \ | |
| -w build/failed-tests.txt -W build/test-results.txt tests/compiler | |
| - name: Package tested Linux compiler | |
| if: startsWith(github.ref, 'refs/tags/') && matrix.php == '8.5' | |
| shell: bash | |
| run: | | |
| composer install --no-dev --prefer-dist --no-progress --classmap-authoritative | |
| export TYPEPHP_PACKAGE_VERSION="${GITHUB_REF_NAME}" | |
| php package.php | |
| test "$(find . -maxdepth 1 -name 'tpc_v*_linux_*.tar.gz' -type f | wc -l)" -eq 1 | |
| - name: Upload Linux release package | |
| if: startsWith(github.ref, 'refs/tags/') && matrix.php == '8.5' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-linux-php-${{ matrix.php }} | |
| if-no-files-found: error | |
| retention-days: 1 | |
| path: tpc_v*_linux_*.tar.gz | |
| - name: Upload PHPT failure artifacts | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: phpt-failures-php-${{ matrix.php }} | |
| if-no-files-found: ignore | |
| retention-days: 7 | |
| path: | | |
| build/failed-tests.txt | |
| build/test-results.txt | |
| build/**/*.cc | |
| build/**/*.h | |
| php_test_results_*.txt | |
| tests/compiler/**/*.diff | |
| tests/compiler/**/*.log | |
| tests/compiler/**/*.out |