forked from mage-os/github-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
122 lines (100 loc) · 3.93 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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"
use_local_source:
required: false
default: "true"
description: "Whether or not you want to test your local package or not."
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 }}
if: contains(inputs.composer_version, '.') == true
shell: bash
- run: composer self-update --${{ inputs.composer_version }}
name: Pin to Composer Version ${{ inputs.composer_version }} (Range)
if: contains(inputs.composer_version, '.') == false
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 "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache Composer Packages"
uses: actions/cache@v3
with:
key: "composer | v5 | ${{ 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
if: ${{ inputs.use_local_source == 'true' }}
- 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"