From eb3530b6e6e689a73f8890af601d73734ca97431 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 7 Nov 2021 23:13:56 +0000 Subject: [PATCH] Use pmmp/setup-php-action to compile PHP --- .github/workflows/main.yml | 94 +++++------------------- tests/gh-actions/build.sh | 25 ------- tests/gh-actions/install-dependencies.sh | 3 - 3 files changed, 20 insertions(+), 102 deletions(-) delete mode 100755 tests/gh-actions/build.sh delete mode 100755 tests/gh-actions/install-dependencies.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 67790cea17..133254c85a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,17 +16,11 @@ jobs: php: [8.0.11] steps: - - uses: actions/checkout@v2 #needed for build.sh - - name: Check for PHP build cache - id: php-build-cache - uses: actions/cache@v2 + - name: Build and prepare PHP cache + uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636 with: - path: "./bin" - key: "php-build-generic-${{ matrix.php }}-${{ matrix.image }}-${{ hashFiles('./tests/gh-actions/build.sh') }}" - - - name: Compile PHP - if: steps.php-build-cache.outputs.cache-hit != 'true' - run: ./tests/gh-actions/build.sh "${{ matrix.php }}" + php-version: ${{ matrix.php }} + install-path: "./bin" phpstan: name: PHPStan analysis @@ -42,23 +36,11 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Restore PHP build cache - id: php-build-cache - uses: actions/cache@v2 + - name: Setup PHP + uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636 with: - path: "./bin" - key: "php-build-generic-${{ matrix.php }}-${{ matrix.image }}-${{ hashFiles('./tests/gh-actions/build.sh') }}" - - - name: Kill build on PHP build cache miss (should never happen) - if: steps.php-build-cache.outputs.cache-hit != 'true' - run: exit 1 - - - name: Install cached PHP's dependencies - if: steps.php-build-cache.outputs.cache-hit == 'true' - run: ./tests/gh-actions/install-dependencies.sh - - - name: Prefix PHP to PATH - run: echo "$(pwd)/bin/php7/bin" >> $GITHUB_PATH + php-version: ${{ matrix.php }} + install-path: "./bin" - name: Install Composer run: curl -sS https://getcomposer.org/installer | php @@ -92,23 +74,11 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Restore PHP build cache - id: php-build-cache - uses: actions/cache@v2 + - name: Setup PHP + uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636 with: - path: "./bin" - key: "php-build-generic-${{ matrix.php }}-${{ matrix.image }}-${{ hashFiles('./tests/gh-actions/build.sh') }}" - - - name: Kill build on PHP build cache miss (should never happen) - if: steps.php-build-cache.outputs.cache-hit != 'true' - run: exit 1 - - - name: Install cached PHP's dependencies - if: steps.php-build-cache.outputs.cache-hit == 'true' - run: ./tests/gh-actions/install-dependencies.sh - - - name: Prefix PHP to PATH - run: echo "$(pwd)/bin/php7/bin" >> $GITHUB_PATH + php-version: ${{ matrix.php }} + install-path: "./bin" - name: Install Composer run: curl -sS https://getcomposer.org/installer | php @@ -144,23 +114,11 @@ jobs: with: submodules: true - - name: Restore PHP build cache - id: php-build-cache - uses: actions/cache@v2 + - name: Setup PHP + uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636 with: - path: "./bin" - key: "php-build-generic-${{ matrix.php }}-${{ matrix.image }}-${{ hashFiles('./tests/gh-actions/build.sh') }}" - - - name: Kill build on PHP build cache miss (should never happen) - if: steps.php-build-cache.outputs.cache-hit != 'true' - run: exit 1 - - - name: Install cached PHP's dependencies - if: steps.php-build-cache.outputs.cache-hit == 'true' - run: ./tests/gh-actions/install-dependencies.sh - - - name: Prefix PHP to PATH - run: echo "$(pwd)/bin/php7/bin" >> $GITHUB_PATH + php-version: ${{ matrix.php }} + install-path: "./bin" - name: Install Composer run: curl -sS https://getcomposer.org/installer | php @@ -196,23 +154,11 @@ jobs: with: submodules: true - - name: Restore PHP build cache - id: php-build-cache - uses: actions/cache@v2 + - name: Setup PHP + uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636 with: - path: "./bin" - key: "php-build-generic-${{ matrix.php }}-${{ matrix.image }}-${{ hashFiles('./tests/gh-actions/build.sh') }}" - - - name: Kill build on PHP build cache miss (should never happen) - if: steps.php-build-cache.outputs.cache-hit != 'true' - run: exit 1 - - - name: Install cached PHP's dependencies - if: steps.php-build-cache.outputs.cache-hit == 'true' - run: ./tests/gh-actions/install-dependencies.sh - - - name: Prefix PHP to PATH - run: echo "$(pwd)/bin/php7/bin" >> $GITHUB_PATH + php-version: ${{ matrix.php }} + install-path: "./bin" - name: Install Composer run: curl -sS https://getcomposer.org/installer | php diff --git a/tests/gh-actions/build.sh b/tests/gh-actions/build.sh deleted file mode 100755 index 89638dd0a2..0000000000 --- a/tests/gh-actions/build.sh +++ /dev/null @@ -1,25 +0,0 @@ -VERSION="$1" - -sudo apt update && sudo apt install -y \ - re2c \ - libtool \ - libtool-bin \ - zlib1g-dev \ - libcurl4-openssl-dev \ - libxml2-dev \ - libyaml-dev \ - libgmp-dev \ - libzip-dev \ - libssl-dev - -INSTALL_DIR="$(pwd)/bin/php7" - -export CFLAGS="$CFLAGS -march=x86-64" -export CXXFLAGS="$CXXFLAGS -march=x86-64" - -git clone https://github.com/pmmp/php-build.git -cd php-build -./install-dependencies.sh -echo '"pthreads",,"https://github.com/pmmp/pthreads.git",,,"extension",' >> share/php-build/extension/definition -PHP_BUILD_INSTALL_EXTENSION='pthreads=@4.0.0 yaml=2.2.1' PHP_BUILD_ZTS_ENABLE=on ./bin/php-build "$VERSION" "$INSTALL_DIR" || exit 1 -rm "$INSTALL_DIR/etc/conf.d/xdebug.ini" || true diff --git a/tests/gh-actions/install-dependencies.sh b/tests/gh-actions/install-dependencies.sh deleted file mode 100755 index 368e27e3aa..0000000000 --- a/tests/gh-actions/install-dependencies.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -sudo apt update && sudo apt install -y \ - libzip5