Improved cache keys for extensions in CI workflow to support several PHP versions when needed

This commit is contained in:
Alejandro Celaya 2022-08-13 10:11:41 +02:00
parent be82204df2
commit 1613975e0e
6 changed files with 36 additions and 6 deletions

View file

@ -32,7 +32,7 @@ jobs:
with: with:
php-version: ${{ matrix.php-version }} php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }} extensions: ${{ env.extensions }}
key: db-tests-extensions-${{ inputs.platform }} key: db-tests-extensions-${{ matrix.php-version }}-${{ inputs.platform }}
- name: Cache extensions - name: Cache extensions
uses: actions/cache@v2 uses: actions/cache@v2
with: with:

View file

@ -25,7 +25,7 @@ jobs:
with: with:
php-version: ${{ matrix.php-version }} php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }} extensions: ${{ env.extensions }}
key: mutation-tests-extensions-${{ inputs.test-group }} key: mutation-tests-extensions-${{ matrix.php-version }}-${{ inputs.test-group }}
- name: Cache extensions - name: Cache extensions
uses: actions/cache@v2 uses: actions/cache@v2
with: with:

View file

@ -31,7 +31,7 @@ jobs:
with: with:
php-version: ${{ matrix.php-version }} php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }} extensions: ${{ env.extensions }}
key: tests-extensions-${{ inputs.test-group }} key: tests-extensions-${{ matrix.php-version }}-${{ inputs.test-group }}
- name: Cache extensions - name: Cache extensions
uses: actions/cache@v2 uses: actions/cache@v2
with: with:

View file

@ -26,7 +26,7 @@ jobs:
with: with:
php-version: ${{ matrix.php-version }} php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }} extensions: ${{ env.extensions }}
key: tests-extensions-${{ matrix.command }} key: tests-extensions-${{ matrix.php-version }}-${{ matrix.command }}
- name: Cache extensions - name: Cache extensions
uses: actions/cache@v2 uses: actions/cache@v2
with: with:

View file

@ -12,15 +12,30 @@ jobs:
matrix: matrix:
php-version: ['8.1'] php-version: ['8.1']
swoole: ['yes', 'no'] swoole: ['yes', 'no']
env:
extensions: openswoole-4.11.1
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
key: publish-release-extensions-${{ matrix.php-version }}-${{ matrix.swoole }}
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
- name: Use PHP - name: Use PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-version }} php-version: ${{ matrix.php-version }}
tools: composer tools: composer
extensions: openswoole-4.11.1 extensions: ${{ env.extensions }}
- if: ${{ matrix.swoole == 'yes' }} - if: ${{ matrix.swoole == 'yes' }}
run: ./build.sh ${GITHUB_REF#refs/tags/v} run: ./build.sh ${GITHUB_REF#refs/tags/v}
- if: ${{ matrix.swoole == 'no' }} - if: ${{ matrix.swoole == 'no' }}

View file

@ -11,6 +11,8 @@ jobs:
strategy: strategy:
matrix: matrix:
php-version: ['8.1'] php-version: ['8.1']
env:
extensions: openswoole-4.11.1
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -18,12 +20,25 @@ jobs:
id: determine_version id: determine_version
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}" run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
shell: bash shell: bash
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
key: publish-release-extensions-${{ matrix.php-version }}
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
- name: Use PHP - name: Use PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-version }} php-version: ${{ matrix.php-version }}
tools: composer tools: composer
extensions: openswoole-4.11.1 extensions: ${{ env.extensions }}
coverage: none coverage: none
- run: composer install --no-interaction --prefer-dist - run: composer install --no-interaction --prefer-dist
- run: composer swagger:inline - run: composer swagger:inline