This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 6
127 lines (108 loc) · 3.64 KB
/
run-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
name: run-tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.2, 8.1]
laravel: [10.0]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 10.0
testbench: 8.*
name: Test P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit == 'false' }}
name: List the state of node modules
continue-on-error: true
run: npm list
- name: "Install locked dependencies with npm"
run: |
npm ci --ignore-scripts
- name: Build package
run: |
npm run build
npm pack
rm -rf node_modules
- 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, mysql, mysqli, pdo_mysql
coverage: none
- name: Prepare L10
if: ${{ matrix.laravel == '10.0' }}
run: |
cd app
composer require illuminate/contracts:">10.27" spatie/phpunit-snapshot-assertions:^5.1 phpunit/phpunit:^10.4 nunomaduro/collision:^7.10 --no-interaction --no-progress --prefer-dist --optimize-autoloader
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress --prefer-dist --optimize-autoloader
- name: Prepare demo app
run: |
cd app
npm upgrade
cp .env.example .env
touch database/database.sqlite
php artisan key:generate --force
php artisan storage:link
php artisan config:clear
npm run build
php artisan dusk:chrome-driver --detect
- name: Execute Feature/Unit tests
run: |
cd app
php artisan test
- name: Start Chrome Driver
run: |
cd app
./vendor/laravel/dusk/bin/chromedriver-linux &
- name: Run Laravel Server
run: |
cd app
php artisan serve --no-reload &
- name: Execute Dusk tests
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 3
command: cd app && php artisan dusk --stop-on-failure --stop-on-error
- name: Upload Screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: screenshots
path: app/tests/Browser/screenshots
- name: Upload Snapshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: snapshots
path: app/tests/Browser/__snapshots__
- name: Upload Console Logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: console
path: app/tests/Browser/console
- name: Upload Logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs
path: app/storage/logs