-
Notifications
You must be signed in to change notification settings - Fork 577
187 lines (160 loc) · 5.5 KB
/
main.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
180
181
182
183
184
185
186
187
name: Tests
on:
push:
branches:
- 3.x
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Checking for prtodo's.
run: |
if grep --exclude-dir={.git,.github,vendor} -rE "PRtodo"; then
exit 1
else
echo "All good"
fi
- name: Checking for leftover "ray" usages.
run: |
if grep --exclude-dir={.git,.github,vendor} -rE "ray("; then
exit 1
else
echo "All good"
fi
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none
- name: Install dependencies
run: |
composer require "laravel/framework:11.*" --no-interaction --no-update
composer install
- name: Execute tests
run: vendor/bin/phpstan
- name: Check code style
run: vendor/bin/phpcs
test:
name: PHP ${{ matrix.php }} - LARAVEL ${{ matrix.laravel }} - DBAL ${{ matrix.dbal }}
timeout-minutes: 30
runs-on: ${{ matrix.os }}
services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: twill_testing_3x
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [8.3, 8.2, 8.1, 8.0]
laravel: [9.*, 10.*, 11.*]
dbal: [3.*, 4.*]
exclude:
- laravel: 9.*
dbal: 4.*
- laravel: 10.*
dbal: 4.*
- laravel: 10.*
php: 8.0
- laravel: 11.*
php: 8.0
- laravel: 11.*
php: 8.1
- laravel: 11.*
dbal: 3.*
include:
- laravel: 9.*
testbench: 7.*
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
steps:
- name: Set timezone?
uses: szenius/[email protected]
with:
timezoneLinux: "Europe/Paris"
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, mysql
coverage: xdebug
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.os }}-${{ matrix.laravel }}-${{ matrix.php }}-${{ matrix.dbal }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.laravel }}-${{ matrix.php }}-${{ matrix.dbal }}-composer-
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "doctrine/dbal:${{ matrix.dbal }}" --no-interaction --no-update
composer install --prefer-dist --no-interaction --no-plugins
- name: Patch TestCase files for PHP < 8.1
run: |
if php -r 'exit(version_compare(PHP_VERSION, "8.1.0", "<") ? 0 : 1);'; then
for file in tests/integration/TestCase.php tests/Browser/BrowserTestCase.php; do
sed -i 's/protected function onNotSuccessfulTest(Throwable \$t): never/protected function onNotSuccessfulTest(Throwable \$t): void/' "$file";
echo "Patched $file for PHP < 8.1";
done
fi
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '20.x'
- name: Build npm dependencies.
run: |
npm ci
- name: Create blocks dir
run: |
mkdir ./frontend/js/components/blocks/customs
- name: Build twill.
run: ./vendor/bin/testbench twill:build --forTesting
env:
CACHE_STORE: array
- name: Upgrade Chrome
uses: browser-actions/setup-chrome@latest
- name: Upgrade Chrome Driver
run: ./vendor/bin/testbench dusk:chrome-driver --detect
- name: Prepare Testbench Dusk
run: ./vendor/bin/testbench-dusk package:discover
- name: Set PHPUnit config for Laravel 9
if: matrix.laravel == '9.*'
run: |
cp phpunit-legacy.xml phpunit.xml
- name: Execute all tests
run: vendor/bin/phpunit --stop-on-error
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
- uses: codecov/codecov-action@v2
with:
files: .github/clover.xml
- uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots
path: |
tests/Browser/screenshots/
tests/Browser/console/