From 6a8176b08ad6c7e02d2436c51eb87e0cdc309e5f Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Tue, 9 Jul 2024 13:44:14 +1200 Subject: [PATCH] NEW Install extra PHP extensions for some unit tests --- .github/workflows/ci.yml | 15 +++++++++++++-- README.md | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93f6545..599bd1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,7 +101,7 @@ jobs: steps: - name: Generate matrix id: generate-matrix - uses: silverstripe/gha-generate-matrix@v1 + uses: creative-commoners/gha-generate-matrix@pulls/1/in-memory-cache with: composer_install: ${{ inputs.composer_install }} extra_jobs: ${{ inputs.extra_jobs }} @@ -187,7 +187,7 @@ jobs: with: php-version: ${{ matrix.php }} extensions: curl, dom, gd, intl, json, ldap, mbstring, mysql, tidy, xdebug, zip - tools: composer:v2 + tools: composer:v2, pecl coverage: xdebug # While this should be the correct way to allow forks in composer.json repositories # in practice there are still many sporadic "Could not authenticate against github.com" errors @@ -197,6 +197,8 @@ jobs: # COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Configure PHP + env: + INSTALL_IN_MEMORY_CACHE_EXTS: ${{ matrix.install_inmemory_cache_exts }} run: | # Set memory limit and disable xdebug if not running phpcoverage if [[ -z $(which php) ]]; then @@ -234,6 +236,15 @@ jobs: echo "Removed PHP extension $extension" fi + echo "INSTALL_IN_MEMORY_CACHE_EXTS is $INSTALL_IN_MEMORY_CACHE_EXTS" + echo "matrix.install_inmemory_cache_exts is ${{ matrix.install_inmemory_cache_exts }}" + if [[ $INSTALL_IN_MEMORY_CACHE_EXTS == 'true' ]]; then + pecl install memcached + pecl install redis + sudo sh -c "echo 'apc.enable_cli=On' >> /etc/php/${{ matrix.php }}/cli/php.ini" + echo 'Installed in-memory cache extensions and set APCu to be enabled' + fi + echo "PHP has been configured" - name: Install additional requirements diff --git a/README.md b/README.md index b0321a2..85da874 100644 --- a/README.md +++ b/README.md @@ -149,3 +149,6 @@ The end-to-end suite as defined in `behat.yml`. Must be defined, specify 'root' ###### endtoend_config The `behat.yml` config file to use if not using the root `behat.yml`. Only used if running behat tests in a different module + +###### install_inmemory_cache_exts +Must be true or false. Determines whether to install in-memory cache extensions for framework unit tests.