shlink/.github/actions/ci-setup/action.yml

49 lines
1.5 KiB
YAML
Raw Normal View History

name: CI setup
2022-08-13 04:16:33 -05:00
description: 'Sets up the environment to run CI actions for Shlink'
inputs:
install-deps:
2022-08-13 04:16:33 -05:00
description: 'Tells if dependencies should be installed with composer. Default value is "yes"'
required: true
2022-08-13 04:16:33 -05:00
default: 'yes'
php-version:
2022-08-13 04:16:33 -05:00
description: 'The PHP version to be setup'
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
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'
required: true
runs:
2022-08-13 04:16:33 -05:00
using: composite
steps:
- name: Setup cache environment
if: ${{ inputs.php-extensions }}
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ inputs.php-version }}
extensions: ${{ inputs.php-extensions }}
key: ${{ inputs.extensions-cache-key }}
- name: Cache extensions
if: ${{ inputs.php-extensions }}
uses: actions/cache@v4
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
extensions: ${{ inputs.php-extensions }}
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