-
Notifications
You must be signed in to change notification settings - Fork 12
/
action.yml
63 lines (54 loc) · 1.69 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
name: "Unit Test"
author: "Graycore"
description: "A Github Action that runs the Unit Tests of a Magento Package"
inputs:
php_version:
required: true
default: "8.1"
description: "PHP Version to use"
source_folder:
required: true
default: .
description: "The source folder of the package"
test_command:
required: true
default: composer run test
description: "The test command"
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 }}
- name: Get Composer Cache Directory
shell: bash
working-directory: ${{ inputs.source_folder }}
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache Composer Packages"
uses: actions/cache@v3
with:
key: "composer | v3 | ${{ hashFiles('composer.lock') }} | ${{ runner.os }} | ${{ inputs.php_version }}"
path: ${{ steps.composer-cache.outputs.dir }}
- run: composer install
name: Require and attempt install
working-directory: ${{ inputs.source_folder }}
shell: bash
env:
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
COMPOSER_AUTH: ${{ inputs.composer_auth }}
- run: ${{ inputs.test_command }}
name: Run Unit Tests
working-directory: ${{ inputs.source_folder }}
shell: bash
env:
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
COMPOSER_AUTH: ${{ inputs.composer_auth }}
branding:
icon: "code"
color: "green"