TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

257 lines
7.6 KiB

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 }})
runs-on: ubuntu-latest
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
extensions: embed
ini-values: precision=17, memory_limit=4G, error_reporting=E_ERROR|E_WARNING, display_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 }})
runs-on: ubuntu-latest
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: embed, 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, 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 }})
runs-on: ubuntu-latest
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
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, precision=17, memory_limit=4G, error_reporting=E_ERROR|E_WARNING, display_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: |
test -f "${PHPX_HOME}/lib/libphpx.so"
echo "LD_LIBRARY_PATH=${PHPX_HOME}/lib:$(php-config --prefix)/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
cmake --version
c++ --version
- name: Run compiler PHPT suite with bootstrap compiler
run: |
mkdir -p build
php run-tests.php -q -j4 --compiler ./tpc \
-w build/failed-tests.txt -W build/test-results.txt tests/compiler
- 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
php_test_results_*.txt
tests/compiler/**/*.diff
tests/compiler/**/*.log
tests/compiler/**/*.out