-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
97 lines (84 loc) · 2.91 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
name: Build Symfony bundle
description: 'Builds a Symfony bundle and tests it'
inputs:
repository:
description: 'Repository to fetch'
required: false
default: '${{ github.repository }}'
bundle-name:
description: 'Full bundle name with vendor and name: {vendor}/{name}'
required: false
default: '${{ github.repository }}'
run-tests:
description: 'Whether to run tests with PHPUnit or not'
required: false
default: 'true'
php-version:
description: 'PHP version to use'
required: false
default: '8.2'
php-extensions:
description: 'PHP extensions to install'
required: false
default: 'mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, filter, gd, json'
composer-options:
description: 'Additional Composer options'
required: false
default: '--prefer-dist'
composer-additional-dependencies:
description: 'Additional Composer dependencies to install on build.'
required: false
default: ''
symfony-version:
description: 'Symfony version to use'
required: false
default: '6.3.*'
runs:
using: 'composite'
steps:
# Setup PHP
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version }}
extensions: ${{ inputs.php-extensions }}
tools: composer, symfony
# Create blank Symfony app
- run: composer create-project symfony/skeleton:${{ inputs.symfony-version }} ./ --ansi --no-interaction --no-scripts --no-progress --remove-vcs
shell: bash
# Fetch the repo
- uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
path: bundle
# Cache Composer
- id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
# Configure Composer
- run: |
mv "${{ github.action_path }}/configure-composer.php" "${{ github.workspace }}/configure-composer.php";
php configure-composer.php
shell: bash
- run: symfony composer require --no-install ${{ inputs.bundle-name }}:@dev
shell: bash
# Install dependencies with Composer
- run: symfony composer install --no-interaction --no-progress --ansi ${{ inputs.composer-options }}
shell: bash
# Install additional dependencies
- if: ${{ inputs.composer-additional-dependencies != '' }}
run: symfony composer require ${{ inputs.composer-additional-dependencies }}
shell: bash
# Install Test-Pack, if required
- if: ${{ inputs.run-tests == 'true' }}
run: symfony composer require test
shell: bash
# Run tests with PHPUnit
- if: ${{ inputs.run-tests == 'true' }}
run: symfony php bin/phpunit bundle/tests/
shell: bash