-
Notifications
You must be signed in to change notification settings - Fork 24
137 lines (115 loc) · 4.55 KB
/
main.yml
File metadata and controls
137 lines (115 loc) · 4.55 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: CI
on: [push, pull_request]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php: [8.2, 8.3, 8.4, 8.5]
symfony: ["5.4.*", "6.4.*", "6.4wApi", "7.3.*", "7.4.*"]
env:
only_sf_latest: &only_sf_latest ${{ matrix.symfony == '7.4.*' }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup PHP != 8.5
if: ${{ matrix.php != '8.5' }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
extensions: ctype, iconv, intl, json, mbstring, pdo, pdo_sqlite
coverage: none
- name: Setup PHP 8.5
if: ${{ matrix.php == '8.5' }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
extensions: ctype, iconv, intl, json, mbstring, pdo, pdo_sqlite
coverage: none
# this ini directive seems to be off by default in PHP 8.5
# see https://github.com/php/php-src/issues/20279
# enable it because codeception relies on it.
ini-values: register_argc_argv=1
- name: Set Symfony version reference
env:
MATRIX_SYMFONY: ${{ matrix.symfony }}
run: |
if [[ "$MATRIX_SYMFONY" == *'*' ]]; then
echo "SF_REF=${MATRIX_SYMFONY%.*}" >> "$GITHUB_ENV"
else
echo "SF_REF=$MATRIX_SYMFONY" >> "$GITHUB_ENV"
fi
- name: Set Composer Symfony constraint
env:
MATRIX_SYMFONY: ${{ matrix.symfony }}
run: |
if [[ "$MATRIX_SYMFONY" == "6.4wApi" ]]; then
echo "COMP_SYMFONY=6.4.*" >> "$GITHUB_ENV"
else
echo "COMP_SYMFONY=$MATRIX_SYMFONY" >> "$GITHUB_ENV"
fi
- name: Checkout Symfony ${{ env.SF_REF }} sample
uses: actions/checkout@v4
with:
repository: Codeception/symfony-module-tests
path: framework-tests
ref: ${{ env.SF_REF }}
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.{json,lock}') }}
restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-composer-
- name: Install PHPUnit 10
run: composer require --dev --no-update phpunit/phpunit:^10.0
- name: Install dependencies
env:
MATRIX_SYMFONY: ${{ matrix.symfony }}
run: |
composer require --no-update \
symfony/{finder,yaml,console,event-dispatcher,css-selector,dom-crawler,browser-kit}:${{ env.COMP_SYMFONY }} \
vlucas/phpdotenv \
codeception/module-asserts:"3.*" \
codeception/module-doctrine:"3.*"
if [[ "$MATRIX_SYMFONY" == "6.4wApi" ]]; then
composer require codeception/module-rest="3.*" --no-update
fi
composer update --prefer-dist --no-progress
- name: Run PHPStan (max)
if: *only_sf_latest
run: composer phpstan
- name: Run PHP-CS-Fixer
if: *only_sf_latest
run: composer cs-check
- name: Run Composer Audit
if: *only_sf_latest
run: composer audit
- name: Validate Composer files
run: composer validate --strict
working-directory: framework-tests
- name: Install PHPUnit in framework-tests
run: composer require --dev --no-update phpunit/phpunit:^10.0
working-directory: framework-tests
- name: Prepare Symfony sample
run: |
composer remove codeception/codeception codeception/module-asserts codeception/module-doctrine codeception/lib-innerbrowser codeception/module-symfony --dev --no-update
composer update --no-progress
working-directory: framework-tests
- name: Setup Database
run: |
php bin/console doctrine:schema:update --force
php bin/console doctrine:fixtures:load --quiet
working-directory: framework-tests
- name: Generate JWT keypair
if: ${{ matrix.symfony == '6.4wApi' }}
run: php bin/console lexik:jwt:generate-keypair --skip-if-exists
working-directory: framework-tests
- name: Run tests
run: |
php vendor/bin/codecept build -c framework-tests
php vendor/bin/codecept run Functional -c framework-tests