-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
117 lines (107 loc) · 4.16 KB
/
action.yml
File metadata and controls
117 lines (107 loc) · 4.16 KB
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
name: Setup PHP and Composer Dependencies
description: Setup PHP, install Composer dependencies when available, and expose a deterministic DevTools runtime.
inputs:
php-version:
description: PHP version passed to setup-php.
required: true
extensions:
description: Comma-separated PHP extensions to enable.
required: false
default: ''
coverage:
description: Coverage driver passed to setup-php.
required: false
default: none
cache-dir:
description: Composer cache directory.
required: false
default: /tmp/composer-cache
root-version:
description: Value exported as COMPOSER_ROOT_VERSION during install.
required: false
default: ''
install-options:
description: Extra options passed to composer install.
required: false
default: --prefer-dist --no-progress --no-interaction --no-scripts
safe-directories:
description: Additional newline-separated directories to mark as safe for git.
required: false
default: ''
dev-tools-source-directory:
description: Checked-out DevTools workflow source used to resolve the fallback runtime when the consumer does not install DevTools locally.
required: false
default: .dev-tools-actions
outputs:
dev-tools-binary:
description: Absolute path to the resolved DevTools binary.
value: ${{ steps.expose-dev-tools.outputs.binary }}
dev-tools-autoload:
description: Absolute path to the runtime autoload file used by packaged workflow helpers.
value: ${{ steps.expose-dev-tools.outputs.autoload }}
dev-tools-source:
description: Runtime source selected for this job, either `local` or `workflow`.
value: ${{ steps.expose-dev-tools.outputs.source }}
runs:
using: composite
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version }}
extensions: ${{ inputs.extensions }}
coverage: ${{ inputs.coverage }}
- name: Mark workspace as safe for git
shell: bash
env:
INPUT_SAFE_DIRECTORIES: ${{ inputs.safe-directories }}
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
if [ -n "${INPUT_SAFE_DIRECTORIES}" ]; then
printf '%s\n' "${INPUT_SAFE_DIRECTORIES}" | while IFS= read -r directory; do
if [ -n "${directory}" ]; then
git config --global --add safe.directory "${directory}"
fi
done
fi
- name: Detect consumer Composer manifest
id: consumer-composer
shell: bash
run: |
if [ -f composer.json ]; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
echo "present=false" >> "$GITHUB_OUTPUT"
fi
- name: Install consumer dependencies
if: steps.consumer-composer.outputs.present == 'true'
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"} }'
COMPOSER_CACHE_DIR: ${{ inputs.cache-dir }}
COMPOSER_ROOT_VERSION: ${{ inputs.root-version }}
with:
composer-options: ${{ inputs.install-options }}
- name: Resolve DevTools runtime source
id: resolve-dev-tools
shell: bash
env:
INPUT_DEV_TOOLS_SOURCE_DIRECTORY: ${{ inputs.dev-tools-source-directory }}
run: ${{ github.action_path }}/detect-dev-tools-runtime.sh
- name: Install fallback DevTools runtime
if: steps.resolve-dev-tools.outputs.needs-fallback == 'true'
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"} }'
COMPOSER_CACHE_DIR: ${{ inputs.cache-dir }}
with:
working-directory: ${{ inputs.dev-tools-source-directory }}
composer-options: --prefer-dist --no-plugins --no-scripts
require-lock-file: 'true'
custom-cache-suffix: dev-tools-runtime
- name: Expose DevTools runtime
id: expose-dev-tools
shell: bash
env:
INPUT_DEV_TOOLS_SOURCE_DIRECTORY: ${{ inputs.dev-tools-source-directory }}
run: ${{ github.action_path }}/expose-dev-tools-runtime.sh