parent
ee1d6e7b54
commit
8ddd04e1b1
9 changed files with 334 additions and 233 deletions
@ -0,0 +1,155 @@ |
|||||||
|
name: Unix ARM64 build |
||||||
|
description: Build and smoke-test TypePHP on a Unix ARM64 runner |
||||||
|
|
||||||
|
inputs: |
||||||
|
php-version: |
||||||
|
description: PHP minor version |
||||||
|
required: true |
||||||
|
os: |
||||||
|
description: Package operating-system identifier |
||||||
|
required: true |
||||||
|
library-extension: |
||||||
|
description: Shared-library extension used by PHPX |
||||||
|
required: true |
||||||
|
smoke-directory: |
||||||
|
description: Platform smoke project directory below .github/smoke |
||||||
|
required: true |
||||||
|
smoke-binary: |
||||||
|
description: Platform smoke executable name |
||||||
|
required: true |
||||||
|
smoke-output: |
||||||
|
description: Expected platform smoke output |
||||||
|
required: true |
||||||
|
|
||||||
|
runs: |
||||||
|
using: composite |
||||||
|
steps: |
||||||
|
- name: Setup PHP |
||||||
|
uses: shivammathur/setup-php@v2 |
||||||
|
with: |
||||||
|
php-version: ${{ inputs.php-version }} |
||||||
|
coverage: none |
||||||
|
extensions: mbstring |
||||||
|
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 |
||||||
|
env: |
||||||
|
fail-fast: true |
||||||
|
phpts: ts |
||||||
|
update: true |
||||||
|
|
||||||
|
- name: Install Linux build dependencies |
||||||
|
if: inputs.os == 'linux' |
||||||
|
shell: bash |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install --yes build-essential cmake libgmp-dev libmpfr-dev pkg-config |
||||||
|
|
||||||
|
- name: Install macOS build dependencies |
||||||
|
if: inputs.os == 'macos' |
||||||
|
shell: bash |
||||||
|
run: brew install cmake gmp mpfr pkg-config |
||||||
|
|
||||||
|
- name: Verify ZTS PHP and architecture |
||||||
|
shell: bash |
||||||
|
run: | |
||||||
|
php -r 'if (!PHP_ZTS) { fwrite(STDERR, "Expected a ZTS PHP build\n"); exit(1); }' |
||||||
|
case "$(php -r 'echo PHP_VERSION;')" in |
||||||
|
"${{ inputs.php-version }}"*) ;; |
||||||
|
*) echo "setup-php installed an unexpected PHP version" >&2; exit 1 ;; |
||||||
|
esac |
||||||
|
case "$(uname -m)" in |
||||||
|
arm64|aarch64) ;; |
||||||
|
*) echo "Expected an ARM64 runner, got $(uname -m)" >&2; exit 1 ;; |
||||||
|
esac |
||||||
|
|
||||||
|
php_home="$(php-config --prefix)" |
||||||
|
embed_library="${php_home}/lib/libphp.${{ inputs.library-extension }}" |
||||||
|
test -x "${php_home}/bin/php-config" |
||||||
|
test -f "${embed_library}" |
||||||
|
echo "PHP_HOME=${php_home}" >> "${GITHUB_ENV}" |
||||||
|
if [[ '${{ inputs.os }}' == 'linux' ]]; then |
||||||
|
echo "LD_LIBRARY_PATH=${PHPX_HOME}/lib:${php_home}/lib" >> "${GITHUB_ENV}" |
||||||
|
else |
||||||
|
echo "DYLD_LIBRARY_PATH=${PHPX_HOME}/lib:${php_home}/lib" >> "${GITHUB_ENV}" |
||||||
|
fi |
||||||
|
php -v |
||||||
|
php-config --configure-options |
||||||
|
|
||||||
|
- name: Patch php_hash.h C++ compatibility |
||||||
|
uses: ./.github/actions/patch-php-headers |
||||||
|
|
||||||
|
- name: Install Composer dependencies |
||||||
|
shell: bash |
||||||
|
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 \ |
||||||
|
-D php_dir="${PHP_HOME}" |
||||||
|
cmake --build "${PHPX_HOME}/build" --target phpx --parallel 2 |
||||||
|
test -f "${PHPX_HOME}/lib/libphpx.${{ inputs.library-extension }}" |
||||||
|
|
||||||
|
- name: Build tpc |
||||||
|
shell: bash |
||||||
|
run: | |
||||||
|
php bin/tpc.php project.yml --job 2 --no-progress |
||||||
|
test -x ./tpc |
||||||
|
file ./tpc |
||||||
|
file ./tpc | grep -Eiq 'arm64|aarch64|ARM aarch64' |
||||||
|
./tpc --version |
||||||
|
|
||||||
|
- name: Run platform smoke test |
||||||
|
shell: bash |
||||||
|
run: | |
||||||
|
smoke_root=".github/smoke/${{ inputs.smoke-directory }}" |
||||||
|
./tpc "${smoke_root}/project.yml" --job 1 --no-progress |
||||||
|
smoke_binary="${smoke_root}/${{ inputs.smoke-binary }}" |
||||||
|
test -x "${smoke_binary}" |
||||||
|
output="$("${smoke_binary}")" |
||||||
|
test "${output}" = '${{ inputs.smoke-output }}' |
||||||
|
|
||||||
|
- name: Show native dependencies |
||||||
|
shell: bash |
||||||
|
run: | |
||||||
|
if [[ '${{ inputs.os }}' == 'linux' ]]; then |
||||||
|
ldd ./tpc |
||||||
|
else |
||||||
|
otool -L ./tpc |
||||||
|
fi |
||||||
|
|
||||||
|
- name: Package tested compiler |
||||||
|
if: startsWith(github.ref, 'refs/tags/') && inputs.php-version == '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*_${{ inputs.os }}_arm64.tar.gz' -type f | wc -l)" -eq 1 |
||||||
|
|
||||||
|
- name: Upload release package |
||||||
|
if: startsWith(github.ref, 'refs/tags/') && inputs.php-version == '8.5' |
||||||
|
uses: actions/upload-artifact@v4 |
||||||
|
with: |
||||||
|
name: release-${{ inputs.os }}-arm64-php-${{ inputs.php-version }}-zts |
||||||
|
if-no-files-found: error |
||||||
|
retention-days: 1 |
||||||
|
path: tpc_v*_${{ inputs.os }}_arm64.tar.gz |
||||||
|
|
||||||
|
- name: Upload platform build outputs |
||||||
|
if: always() |
||||||
|
uses: actions/upload-artifact@v4 |
||||||
|
with: |
||||||
|
name: tpc-${{ inputs.os }}-arm64-php-${{ inputs.php-version }}-zts |
||||||
|
include-hidden-files: true |
||||||
|
if-no-files-found: warn |
||||||
|
retention-days: 7 |
||||||
|
path: | |
||||||
|
tpc |
||||||
|
.github/smoke/${{ inputs.smoke-directory }}/${{ inputs.smoke-binary }} |
||||||
|
.github/smoke/${{ inputs.smoke-directory }}/build/**/*.cc |
||||||
|
.github/smoke/${{ inputs.smoke-directory }}/build/**/*.h |
||||||
@ -0,0 +1,43 @@ |
|||||||
|
name: Linux ARM64 |
||||||
|
|
||||||
|
on: |
||||||
|
push: |
||||||
|
pull_request: |
||||||
|
workflow_dispatch: |
||||||
|
|
||||||
|
permissions: |
||||||
|
contents: read |
||||||
|
|
||||||
|
concurrency: |
||||||
|
group: linux-arm64-${{ github.ref }} |
||||||
|
cancel-in-progress: true |
||||||
|
|
||||||
|
env: |
||||||
|
COMPOSER_NO_INTERACTION: 1 |
||||||
|
COMPOSER_PROCESS_TIMEOUT: 0 |
||||||
|
|
||||||
|
jobs: |
||||||
|
build: |
||||||
|
name: Build - PHP ${{ matrix.php }} ZTS |
||||||
|
runs-on: ubuntu-22.04-arm |
||||||
|
timeout-minutes: 90 |
||||||
|
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: Build and smoke test |
||||||
|
uses: ./.github/actions/unix-arm64-build |
||||||
|
with: |
||||||
|
php-version: ${{ matrix.php }} |
||||||
|
os: linux |
||||||
|
library-extension: so |
||||||
|
smoke-directory: linux-arm64 |
||||||
|
smoke-binary: linux_arm64_smoke |
||||||
|
smoke-output: linux-arm64-smoke-ok:zts |
||||||
@ -0,0 +1,43 @@ |
|||||||
|
name: macOS ARM64 |
||||||
|
|
||||||
|
on: |
||||||
|
push: |
||||||
|
pull_request: |
||||||
|
workflow_dispatch: |
||||||
|
|
||||||
|
permissions: |
||||||
|
contents: read |
||||||
|
|
||||||
|
concurrency: |
||||||
|
group: macos-arm64-${{ github.ref }} |
||||||
|
cancel-in-progress: true |
||||||
|
|
||||||
|
env: |
||||||
|
COMPOSER_NO_INTERACTION: 1 |
||||||
|
COMPOSER_PROCESS_TIMEOUT: 0 |
||||||
|
|
||||||
|
jobs: |
||||||
|
build: |
||||||
|
name: Build - PHP ${{ matrix.php }} ZTS |
||||||
|
runs-on: macos-15 |
||||||
|
timeout-minutes: 90 |
||||||
|
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: Build and smoke test |
||||||
|
uses: ./.github/actions/unix-arm64-build |
||||||
|
with: |
||||||
|
php-version: ${{ matrix.php }} |
||||||
|
os: macos |
||||||
|
library-extension: dylib |
||||||
|
smoke-directory: macos |
||||||
|
smoke-binary: macos_smoke |
||||||
|
smoke-output: macos-arm64-smoke-ok:zts |
||||||
@ -1,179 +0,0 @@ |
|||||||
name: ARM64 and macOS tpc build |
|
||||||
|
|
||||||
on: |
|
||||||
push: |
|
||||||
pull_request: |
|
||||||
workflow_dispatch: |
|
||||||
|
|
||||||
permissions: |
|
||||||
contents: read |
|
||||||
|
|
||||||
concurrency: |
|
||||||
group: platform-tpc-${{ github.workflow }}-${{ github.ref }} |
|
||||||
cancel-in-progress: true |
|
||||||
|
|
||||||
env: |
|
||||||
COMPOSER_NO_INTERACTION: 1 |
|
||||||
COMPOSER_PROCESS_TIMEOUT: 0 |
|
||||||
|
|
||||||
jobs: |
|
||||||
build-tpc: |
|
||||||
name: ${{ matrix.target.label }} (PHP ${{ matrix.php }} ZTS) |
|
||||||
runs-on: ${{ matrix.target.runner }} |
|
||||||
timeout-minutes: 90 |
|
||||||
strategy: |
|
||||||
fail-fast: false |
|
||||||
matrix: |
|
||||||
php: ["8.4", "8.5"] |
|
||||||
target: |
|
||||||
- label: Linux ARM64 |
|
||||||
runner: ubuntu-22.04-arm |
|
||||||
os: linux |
|
||||||
arch: arm64 |
|
||||||
library_ext: so |
|
||||||
smoke_dir: linux-arm64 |
|
||||||
smoke_binary: linux_arm64_smoke |
|
||||||
smoke_output: linux-arm64-smoke-ok:zts |
|
||||||
- label: macOS ARM64 |
|
||||||
runner: macos-15 |
|
||||||
os: macos |
|
||||||
arch: arm64 |
|
||||||
library_ext: dylib |
|
||||||
smoke_dir: macos |
|
||||||
smoke_binary: macos_smoke |
|
||||||
smoke_output: macos-arm64-smoke-ok:zts |
|
||||||
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: mbstring |
|
||||||
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 |
|
||||||
env: |
|
||||||
fail-fast: true |
|
||||||
phpts: ts |
|
||||||
update: true |
|
||||||
|
|
||||||
- name: Install Linux build dependencies |
|
||||||
if: matrix.target.os == 'linux' |
|
||||||
shell: bash |
|
||||||
run: | |
|
||||||
sudo apt-get update |
|
||||||
sudo apt-get install --yes build-essential cmake libgmp-dev libmpfr-dev pkg-config |
|
||||||
|
|
||||||
- name: Install macOS build dependencies |
|
||||||
if: matrix.target.os == 'macos' |
|
||||||
shell: bash |
|
||||||
run: brew install cmake gmp mpfr pkg-config |
|
||||||
|
|
||||||
- name: Verify ZTS PHP and architecture |
|
||||||
shell: bash |
|
||||||
run: | |
|
||||||
php -r 'if (!PHP_ZTS) { fwrite(STDERR, "Expected a ZTS PHP build\n"); exit(1); }' |
|
||||||
case "$(php -r 'echo PHP_VERSION;')" in |
|
||||||
"${{ matrix.php }}"*) ;; |
|
||||||
*) echo "setup-php installed an unexpected PHP version" >&2; exit 1 ;; |
|
||||||
esac |
|
||||||
case "$(uname -m)" in |
|
||||||
arm64|aarch64) ;; |
|
||||||
*) echo "Expected an ARM64 runner, got $(uname -m)" >&2; exit 1 ;; |
|
||||||
esac |
|
||||||
|
|
||||||
php_home="$(php-config --prefix)" |
|
||||||
embed_library="${php_home}/lib/libphp.${{ matrix.target.library_ext }}" |
|
||||||
test -x "${php_home}/bin/php-config" |
|
||||||
test -f "${embed_library}" |
|
||||||
echo "PHP_HOME=${php_home}" >> "${GITHUB_ENV}" |
|
||||||
if [[ '${{ matrix.target.os }}' == 'linux' ]]; then |
|
||||||
echo "LD_LIBRARY_PATH=${PHPX_HOME}/lib:${php_home}/lib" >> "${GITHUB_ENV}" |
|
||||||
else |
|
||||||
echo "DYLD_LIBRARY_PATH=${PHPX_HOME}/lib:${php_home}/lib" >> "${GITHUB_ENV}" |
|
||||||
fi |
|
||||||
php -v |
|
||||||
php-config --configure-options |
|
||||||
|
|
||||||
- name: Patch php_hash.h C++ compatibility |
|
||||||
uses: ./.github/actions/patch-php-headers |
|
||||||
|
|
||||||
- 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 \ |
|
||||||
-D php_dir="${PHP_HOME}" |
|
||||||
cmake --build "${PHPX_HOME}/build" --target phpx --parallel 2 |
|
||||||
test -f "${PHPX_HOME}/lib/libphpx.${{ matrix.target.library_ext }}" |
|
||||||
|
|
||||||
- name: Build tpc |
|
||||||
shell: bash |
|
||||||
run: | |
|
||||||
php bin/tpc.php project.yml --job 2 --no-progress |
|
||||||
test -x ./tpc |
|
||||||
file ./tpc |
|
||||||
file ./tpc | grep -Eiq 'arm64|aarch64|ARM aarch64' |
|
||||||
./tpc --version |
|
||||||
|
|
||||||
- name: Run platform smoke test |
|
||||||
shell: bash |
|
||||||
run: | |
|
||||||
smoke_root=".github/smoke/${{ matrix.target.smoke_dir }}" |
|
||||||
./tpc "${smoke_root}/project.yml" --job 1 --no-progress |
|
||||||
smoke_binary="${smoke_root}/${{ matrix.target.smoke_binary }}" |
|
||||||
test -x "${smoke_binary}" |
|
||||||
output="$("${smoke_binary}")" |
|
||||||
test "${output}" = '${{ matrix.target.smoke_output }}' |
|
||||||
|
|
||||||
- name: Show native dependencies |
|
||||||
shell: bash |
|
||||||
run: | |
|
||||||
if [[ '${{ matrix.target.os }}' == 'linux' ]]; then |
|
||||||
ldd ./tpc |
|
||||||
else |
|
||||||
otool -L ./tpc |
|
||||||
fi |
|
||||||
|
|
||||||
- name: Package tested 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*_${{ matrix.target.os }}_${{ matrix.target.arch }}.tar.gz' -type f | wc -l)" -eq 1 |
|
||||||
|
|
||||||
- name: Upload release package |
|
||||||
if: startsWith(github.ref, 'refs/tags/') && matrix.php == '8.5' |
|
||||||
uses: actions/upload-artifact@v4 |
|
||||||
with: |
|
||||||
name: release-${{ matrix.target.os }}-${{ matrix.target.arch }}-php-${{ matrix.php }}-zts |
|
||||||
if-no-files-found: error |
|
||||||
retention-days: 1 |
|
||||||
path: tpc_v*_${{ matrix.target.os }}_${{ matrix.target.arch }}.tar.gz |
|
||||||
|
|
||||||
- name: Upload platform build outputs |
|
||||||
if: always() |
|
||||||
uses: actions/upload-artifact@v4 |
|
||||||
with: |
|
||||||
name: tpc-${{ matrix.target.os }}-${{ matrix.target.arch }}-php-${{ matrix.php }}-zts |
|
||||||
include-hidden-files: true |
|
||||||
if-no-files-found: warn |
|
||||||
retention-days: 7 |
|
||||||
path: | |
|
||||||
tpc |
|
||||||
.github/smoke/${{ matrix.target.smoke_dir }}/${{ matrix.target.smoke_binary }} |
|
||||||
.github/smoke/${{ matrix.target.smoke_dir }}/build/**/*.cc |
|
||||||
.github/smoke/${{ matrix.target.smoke_dir }}/build/**/*.h |
|
||||||
Loading…
Reference in new issue