From 86ff123fc8ee058c6c0b9e1b749826556e633f6c Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Tue, 21 Jan 2025 15:56:20 +0100 Subject: [PATCH] ci: migrate to shivammathur/setup-php - simplify CI setup workflow - migrate off of php-build since it still does not provide php 8.4 - use shivammathur/setup-php - use ramsey/composer-install --- .github/workflows/main.yml | 85 +++++++++++--------------------------- 1 file changed, 25 insertions(+), 60 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0c3ed52..e1b760d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,80 +7,45 @@ on: - "master" workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" build: - name: PHP ${{ matrix.php }} ZTS ${{ matrix.zts }} OPcache ${{ matrix.opcache }} - # The type of runner that the job will run on - runs-on: ubuntu-20.04 + name: PHP ${{ matrix.php }} PHPTS ${{ matrix.phpts }} OPcache ${{ matrix.opcache }} + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: php: - - 7.4.14 - - 8.0.1 - - 8.1snapshot - - 8.2snapshot - - 8.3snapshot - - 8.4snapshot - zts: [on, off] - opcache: [on, off] + - "7.4" + - "8.0" + - "8.1" + - "8.2" + - "8.3" + - "8.4" + phpts: ["ts", "nts"] + opcache: [1, 0] + steps: - uses: actions/checkout@v2 - - name: Restore PHP build cache - id: php-build-cache - uses: actions/cache@v2 - with: - path: ${{ github.workspace }}/php - key: php-build-${{ matrix.php }}-zts-${{ matrix.zts }} - - - name: Clone php-build/php-build - uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - repository: php-build/php-build - path: ${{ github.workspace }}/php-build - - - name: Install PHP dependencies - run: ${{ github.workspace }}/php-build/install-dependencies.sh - - - name: Compile PHP - if: steps.php-build-cache.outputs.cache-hit != 'true' - run: | - cd ${{ github.workspace }}/php-build - ./install-dependencies.sh - PHP_BUILD_ZTS_ENABLE=${{ matrix.zts }} ./bin/php-build ${{ matrix.php }} ${{ github.workspace }}/php + php-version: ${{ matrix.php }} + ini-values: opcache.enable_cli=${{ matrix.opcache }} + env: + phpts: ${{ matrix.phpts }} - name: Install extension + working-directory: ${{ github.workspace }} run: | - cd ${{ github.workspace }} - ${{ github.workspace }}/php/bin/phpize - ./configure --with-php-config=${{ github.workspace }}/php/bin/php-config - make -j8 install - echo "extension=ds.so" > ${{ github.workspace }}/php/etc/conf.d/ds.ini - rm ${{ github.workspace }}/php/etc/conf.d/xdebug.ini || true - - - name: Prefix PHP to PATH - run: echo "${{ github.workspace }}/php/bin" >> $GITHUB_PATH + phpize + ./configure --with-php-config=/usr/bin/php-config + sudo make -j8 install - - name: Generate OPcache configuration - run: echo "opcache.enable_cli=${{ matrix.opcache }}" > ${{ github.workspace }}/php/etc/conf.d/opcache.ini - - - name: Install Composer - run: curl -sS https://getcomposer.org/installer | php - - name: Restore Composer package cache - uses: actions/cache@v2 + - name: "Install dependencies with Composer" + uses: "ramsey/composer-install@v3" with: - path: | - ~/.cache/composer/files - ~/.cache/composer/vcs - key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.json') }}" - restore-keys: | - composer-v2-cache- - - - name: Install Composer dependencies - run: php composer.phar install --prefer-dist --no-interaction + composer-options: "--prefer-dist" - name: Run PHPUnit tests - run: php composer.phar test + run: composer test