Browse Source

Cache PHP extensions

ADmad 6 years ago
parent
commit
dbed31a6a1
1 changed files with 25 additions and 6 deletions
  1. 25 6
      .github/workflows/ci.yml

+ 25 - 6
.github/workflows/ci.yml

@@ -101,16 +101,39 @@ jobs:
     runs-on: windows-2019
     name: Windows - PHP 7.4 & SQL Server
 
+    env:
+      EXTENSIONS: mbstring, intl, apcu, pdo_sqlsrv
+      PHP_VERSION: '7.4'
+
     steps:
     - uses: actions/checkout@v1
       with:
         fetch-depth: 1
 
+    - name: Get date part for cache key
+      id: key-date
+      run: echo "::set-output name=date::$(date +'%Y-%m')"
+
+    - name: Setup PHP extensions cache
+      id: php-ext-cache
+      uses: shivammathur/cache-extensions@v1
+      with:
+        php-version: ${{ env.PHP_VERSION }}
+        extensions: ${{ env.EXTENSIONS }}
+        key: ${{ steps.key-date.outputs.date }}
+
+    - name: Cache PHP extensions
+      uses: actions/cache@v1
+      with:
+        path: ${{ steps.php-ext-cache.outputs.dir }}
+        key: ${{ steps.php-ext-cache.outputs.dir }}
+        restore-keys: ${{ steps.php-ext-cache.outputs.key }}
+
     - name: Setup PHP
       uses: shivammathur/setup-php@v2
       with:
-        php-version: '7.4'
-        extensions: mbstring, intl, apcu, pdo_sqlsrv
+        php-version: ${{ env.PHP_VERSION }}
+        extensions: ${{ env.EXTENSIONS }}
         ini-values: apc.enable_cli = 1, extension = php_fileinfo.dll
         coverage: none
 
@@ -125,10 +148,6 @@ jobs:
       id: composer-cache
       run: echo "::set-output name=dir::$(composer config cache-files-dir)"
 
-    - name: Get date part for cache key
-      id: key-date
-      run: echo "::set-output name=date::$(date +'%Y-%m')"
-
     - name: Cache composer dependencies
       uses: actions/cache@v1
       with: