2022-08-13 03:53:24 -05:00
|
|
|
name: CI setup
|
2022-08-13 04:16:33 -05:00
|
|
|
description: 'Sets up the environment to run CI actions for Shlink'
|
2022-08-13 03:53:24 -05:00
|
|
|
|
|
|
|
inputs:
|
|
|
|
install-deps:
|
2022-08-13 04:16:33 -05:00
|
|
|
description: 'Tells if dependencies should be installed with composer. Default value is "yes"'
|
2022-08-13 03:53:24 -05:00
|
|
|
required: true
|
2022-08-13 04:16:33 -05:00
|
|
|
default: 'yes'
|
2022-08-13 03:53:24 -05:00
|
|
|
php-version:
|
2022-08-13 04:16:33 -05:00
|
|
|
description: 'The PHP version to be setup'
|
2022-08-13 03:53:24 -05:00
|
|
|
required: true
|
|
|
|
php-extensions:
|
2022-08-13 04:16:33 -05:00
|
|
|
description: 'The PHP extensions to install'
|
2022-08-27 02:15:58 -05:00
|
|
|
required: false
|
2022-08-13 03:53:24 -05:00
|
|
|
extensions-cache-key:
|
2022-08-13 04:16:33 -05:00
|
|
|
description: 'The key used to cache PHP extensions. If empty value is provided, extension caching is disabled'
|
2022-08-13 03:53:24 -05:00
|
|
|
required: true
|
|
|
|
|
|
|
|
runs:
|
2022-08-13 04:16:33 -05:00
|
|
|
using: composite
|
2022-08-13 03:53:24 -05:00
|
|
|
steps:
|
|
|
|
- name: Setup cache environment
|
2024-02-16 16:10:18 -06:00
|
|
|
if: ${{ inputs.php-extensions }}
|
2022-08-13 03:53:24 -05:00
|
|
|
id: extcache
|
|
|
|
uses: shivammathur/cache-extensions@v1
|
|
|
|
with:
|
|
|
|
php-version: ${{ inputs.php-version }}
|
2022-08-13 04:18:50 -05:00
|
|
|
extensions: ${{ inputs.php-extensions }}
|
2022-08-13 03:53:24 -05:00
|
|
|
key: ${{ inputs.extensions-cache-key }}
|
|
|
|
- name: Cache extensions
|
2024-02-16 16:10:18 -06:00
|
|
|
if: ${{ inputs.php-extensions }}
|
|
|
|
uses: actions/cache@v4
|
2022-08-13 03:53:24 -05:00
|
|
|
with:
|
|
|
|
path: ${{ steps.extcache.outputs.dir }}
|
|
|
|
key: ${{ steps.extcache.outputs.key }}
|
|
|
|
restore-keys: ${{ steps.extcache.outputs.key }}
|
|
|
|
- name: Use PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ inputs.php-version }}
|
|
|
|
tools: composer
|
2022-08-13 04:18:50 -05:00
|
|
|
extensions: ${{ inputs.php-extensions }}
|
2022-08-13 03:53:24 -05:00
|
|
|
coverage: pcov
|
|
|
|
ini-values: pcov.directory=module
|
|
|
|
- name: Install dependencies
|
2022-08-13 04:16:33 -05:00
|
|
|
if: ${{ inputs.install-deps == 'yes' }}
|
2024-02-11 04:22:48 -06:00
|
|
|
run: composer install --no-interaction --prefer-dist
|
2022-08-13 04:16:33 -05:00
|
|
|
shell: bash
|