mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
110 lines
3.5 KiB
YAML
110 lines
3.5 KiB
YAML
name: "Installation Test"
|
|
author: "Graycore"
|
|
description: " A Github Action that tests the installability of a Magento Package"
|
|
|
|
inputs:
|
|
php_version:
|
|
required: true
|
|
default: "8.1"
|
|
description: "PHP Version to use"
|
|
|
|
cache_key:
|
|
required: true
|
|
default: "2"
|
|
description: "The cache key used to hold Composer Packages"
|
|
|
|
composer_version:
|
|
required: true
|
|
default: "2"
|
|
description: "The version of composer to use"
|
|
|
|
source_folder:
|
|
required: true
|
|
default: $GITHUB_WORKSPACE
|
|
description: "The source folder of the package"
|
|
|
|
package_name:
|
|
required: true
|
|
description: "The name of the package"
|
|
|
|
magento_directory:
|
|
required: true
|
|
default: "../magento2"
|
|
description: "The folder where Magento will be installed"
|
|
|
|
magento_version:
|
|
required: true
|
|
default: "magento/project-community-edition"
|
|
description: "The version of Magento to test against"
|
|
|
|
magento_repository:
|
|
required: true
|
|
default: "https://mirror.mage-os.org/"
|
|
description: "Where to install Magento from"
|
|
|
|
composer_cache_key:
|
|
required: false
|
|
default: ''
|
|
description: A key to version the composer cache. Can be incremented if you need to bust the cache.
|
|
|
|
composer_auth:
|
|
required: false
|
|
description: "Composer Authentication Credentials"
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Set PHP Version
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ inputs.php_version }}
|
|
|
|
- run: composer self-update --${{ inputs.composer_version }}
|
|
name: Pin to Composer Version ${{ inputs.composer_version }}
|
|
shell: bash
|
|
|
|
- run: composer create-project --repository-url="${{ inputs.magento_repository }}" "${{ inputs.magento_version }}" ${{ inputs.magento_directory }} --no-install
|
|
shell: bash
|
|
env:
|
|
COMPOSER_AUTH: ${{ inputs.composer_auth }}
|
|
name: Create Magento ${{ inputs.magento_version }} Project
|
|
|
|
- name: Get Composer Cache Directory
|
|
shell: bash
|
|
working-directory: ${{ inputs.magento_directory }}
|
|
id: composer-cache
|
|
run: |
|
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- name: "Cache Composer Packages"
|
|
uses: actions/cache@v3
|
|
with:
|
|
key: "composer | v4 | ${{ inputs.composer_cache_key }} | ${{ hashFiles('composer.lock') }} | ${{ runner.os }} | ${{ inputs.composer_version }} | ${{ inputs.php_version }} | ${{ inputs.magento_version }}"
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
|
|
- run: composer config repositories.local path ${{ inputs.source_folder }}
|
|
name: Add Github Repo for Testing
|
|
working-directory: ${{ inputs.magento_directory }}
|
|
shell: bash
|
|
|
|
- run: |
|
|
composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
|
|
composer config --no-interaction allow-plugins.laminas/laminas-dependency-plugin true
|
|
composer config --no-interaction allow-plugins.magento/* true
|
|
name: Fixup Composer Plugins
|
|
shell: bash
|
|
working-directory: ${{ inputs.magento_directory }}
|
|
if: ${{ !startsWith(inputs.composer_version, '1') }}
|
|
|
|
- run: composer require ${{ inputs.package_name }} "@dev" --no-update && composer install
|
|
name: Require and attempt install
|
|
working-directory: ${{ inputs.magento_directory }}
|
|
shell: bash
|
|
env:
|
|
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
|
|
COMPOSER_AUTH: ${{ inputs.composer_auth }}
|
|
|
|
branding:
|
|
icon: "code"
|
|
color: "green"
|