-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
179 lines (141 loc) · 5.4 KB
/
build.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
173
174
175
176
177
178
179
on:
pull_request:
branches-ignore: gh-pages
push:
branches-ignore: gh-pages
name: build
permissions:
contents: read
jobs:
phpcs:
name: Code style
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
ini-values: memory_limit=-1, date.timezone='UTC'
tools: phpcs
- name: Check production code style
run: composer cs-prod
- name: Check test code style
run: composer cs-tests
linux:
name: PHP ${{ matrix.php }}-${{ matrix.os }}-${{ matrix.mode }}
env:
extensions: curl, mbstring, openssl, pdo, pdo_sqlite
SYMFONY_DEPRECATIONS_HELPER: weak
COMPOSER_ROOT_VERSION: 5.0.99
COLUMNS: 120
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: ['8.1', '8.2', '8.3']
mode: ['stable', 'experimental']
exclude:
- php: '8.2'
mode: 'experimental'
- php: '8.3'
mode: 'experimental'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
ini-values: memory_limit=-1, date.timezone='UTC'
coverage: xdebug
tools: composer:v2
- name: Determine composer cache directory
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
- name: Cache dependencies installed with composer
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-${{ matrix.mode }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php }}-${{ matrix.mode }}-composer-
- name: Update composer
run: composer self-update
- name: Validate composer.json
run: composer validate
- name: Install latest versions of dependencies in stable mode
if: matrix.mode == 'stable'
run: composer update --no-interaction --no-progress --optimize-autoloader --ansi
- name: Composer install lowest versions of dependencies on PHP 8.1 in experimental mode
if: matrix.php == '8.1' && matrix.mode == 'experimental'
run: composer update --prefer-lowest --no-interaction --no-progress --optimize-autoloader --ansi
- name: Test that failing test really fails
run: if php codecept run -c tests/data/claypit/ scenario FailedCept -vvv; then echo "Test hasn't failed"; false; fi;
# - name: Run tests without code coverage on PHP 8.1
# if: matrix.php == '8.1'
# run: |
# php -S 127.0.0.1:8008 -t tests/data/app >/dev/null 2>&1 &
# php codecept build
# php codecept run cli,unit
- name: Run tests
run: |
php -S 127.0.0.1:8008 -t tests/data/app -d pcov.directory=$(pwd)/tests/data/app >/dev/null 2>&1 &
php codecept build
php codecept run cli,unit,coverage --env COVERAGE=1
- name: Run module-asserts tests
run: php codecept run -c vendor/codeception/module-asserts/
- name: Run module-filesystem tests
run: php codecept run -c vendor/codeception/module-filesystem/
- name: Run module-db sqlite tests
run: php codecept run -c vendor/codeception/module-db/ unit :Sqlite
- name: Run module-phpbrowser tests
run: |
cd vendor/codeception/module-phpbrowser/
php -S 127.0.0.1:8000 -t tests/data/app >/dev/null 2>&1 &
php -S 127.0.0.1:8010 -t tests/data/rest >/dev/null 2>&1 &
php ../../../codecept run tests/unit/Codeception/Module/PhpBrowserTest.php
windows-latest:
name: PHP ${{ matrix.php }}-${{ matrix.os }}
env:
extensions: curl, mbstring, openssl, pdo, pdo_sqlite
SYMFONY_DEPRECATIONS_HELPER: weak
COMPOSER_ROOT_VERSION: 5.0.99
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
php: ['8.1', '8.2', '8.3']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
ini-values: memory_limit=-1, date.timezone='UTC'
tools: composer:v2
- name: Determine composer cache directory
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache dependencies installed with composer
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-
- name: Update composer
run: composer self-update
- name: Validate composer.json
run: composer validate
- name: Composer install
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- name: Run tests cli
if: matrix.php != '8.2'
run: php codecept run cli --skip-group coverage
- name: Run tests unit
run: php codecept run unit -g core -g appveyor