-
Notifications
You must be signed in to change notification settings - Fork 2
172 lines (147 loc) · 7.6 KB
/
tests.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Tests
on:
push:
pull_request:
schedule:
- cron: '30 7 * * 1'
jobs:
tests:
if: (github.event_name == 'schedule' && github.repository == 'e-commit/messenger-supervisor-bundle') || (github.event_name != 'schedule')
strategy:
fail-fast: false
matrix:
include:
#Mini (for each Symfony version)
- php-version: '8.1'
symfony-version: '5.4.*'
composer-flags: '--prefer-stable --prefer-lowest'
description: 'with SF 5.4.* lowest'
- php-version: '8.1'
symfony-version: '6.4.*'
composer-flags: '--prefer-stable --prefer-lowest'
description: 'with SF 6.3.* lowest'
- php-version: '8.2'
symfony-version: '7.0.*'
composer-flags: '--prefer-stable --prefer-lowest'
description: 'with SF 7.0.* lowest'
- php-version: '8.2'
symfony-version: '7.1.*'
composer-flags: '--prefer-stable --prefer-lowest'
description: 'with SF 7.1.* lowest'
#Symfony versions
- php-version: '8.3'
symfony-version: '5.4.*'
description: 'with SF 5.4.*'
- php-version: '8.3'
symfony-version: '5.4.*@dev'
description: 'with SF 5.4.* dev'
- php-version: '8.3'
symfony-version: '6.4.*'
description: 'with SF 6.4.*'
- php-version: '8.3'
symfony-version: '6.4.*@dev'
description: 'with SF 6.4.* dev'
- php-version: '8.3'
symfony-version: '7.0.*'
description: 'with SF 7.0.*'
- php-version: '8.3'
symfony-version: '7.0.*@dev'
description: 'with SF 7.0.* dev'
- php-version: '8.3'
symfony-version: '7.1.*'
description: 'with SF 7.1.*'
- php-version: '8.3'
symfony-version: '7.1.*@dev'
description: 'with SF 7.1.* dev'
- php-version: '8.3'
symfony-version: '7.2.*@dev'
description: 'with SF 7.2.* dev'
#PHP versions
- php-version: '8.1'
- php-version: '8.2'
- php-version: '8.3'
#CS
- php-version: '8.2'
description: 'with Coding Standards'
coding-standards: true
#Static Analysis (min PHP version)
- php-version: '8.1'
description: 'with Static Analysis'
static-analysis: true
name: PHP ${{ matrix.php-version }} ${{ matrix.description }}
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install system dependencies
if: matrix.coding-standards != true && matrix.static-analysis != true
run: |
sudo apt-get update
sudo apt-get install -y supervisor
sudo cp tests/Functional/App/config/messenger-supervisor-bundle.conf /etc/supervisor/conf.d/messenger-supervisor-bundle.conf
sudo sed -i 's|<phpPath>|'"`which php`"'|g' /etc/supervisor/conf.d/messenger-supervisor-bundle.conf
sudo sed -i 's|<AppPath>|'"`pwd`"'|g' /etc/supervisor/conf.d/messenger-supervisor-bundle.conf
sudo sed -i 's|<user>|'"`whoami`"'|g' /etc/supervisor/conf.d/messenger-supervisor-bundle.conf
sudo service supervisor restart && sleep 2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: "pdo_sqlite"
coverage: none
tools: flex
env:
update: true
- name: Display versions
run: |
php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;'
php -i
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}-${{ matrix.composer-flags }}
restore-keys: composer-${{ runner.os }}-${{ matrix.php-version }}-
- name: Configure minimum stability
if: matrix.symfony-version && contains(matrix.symfony-version, '@dev')
run: composer config minimum-stability dev
- name: Remove friendsofphp/php-cs-fixer
if: matrix.coding-standards != true
run: composer remove friendsofphp/php-cs-fixer --dev --no-update
- name: Remove vimeo/psalm
if: matrix.static-analysis != true
run: composer remove vimeo/psalm --dev --no-update
- name: Configure Symfony Flex
if: matrix.symfony-version
run: composer config extra.symfony.require ${{ matrix.symfony-version }}
- name: Install dependencies
run: composer update --no-interaction --no-progress ${{ matrix.composer-flags }}
- name: Run PHPUnit
if: matrix.coding-standards != true && matrix.static-analysis != true
run: php vendor/phpunit/phpunit/phpunit
- name: Display Supervisor status
if: matrix.coding-standards != true && matrix.static-analysis != true
run: |
echo "Supervisor status :"
sudo supervisorctl status || true
echo "Supervisor worker stdout :"
sudo supervisorctl tail program_async:program_async_00 stdout || true
echo "Supervisor worker stderr :"
sudo supervisorctl tail program_async:program_async_00 stderr || true
- name: Run PHP CS Fixer
if: matrix.coding-standards
run: php vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --diff --dry-run -v
- name: Analyze composer dependencies
if: matrix.coding-standards
run: |
curl -LSs https://github.com/maglnet/ComposerRequireChecker/releases/latest/download/composer-require-checker.phar > composer-require-checker.phar
php composer-require-checker.phar check composer.json
- name: Check license year
if: matrix.coding-standards
run: cat LICENSE |grep -E "\(c\) ([0-9]+\-)*`date +%G`"
- name: Run Psalm
if: matrix.static-analysis
run: php vendor/bin/psalm --stats --output-format=github