-
Notifications
You must be signed in to change notification settings - Fork 8
130 lines (106 loc) · 3.76 KB
/
test.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
name: Test
on: [push]
jobs:
feature-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
- name: Install Composer Dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Prepare The Environment
run: cp .env.example .env
- name: Generate Application Key
run: php artisan key:generate
- name: Run Feature Tests
run: php artisan test
js-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: '18.x'
- name: Install Dependencies
run: npm ci
- name: Jest
run: npm test
browser-test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Prepare The Environment
run: cp .env.dusk.ci .env
- name: Create Database
run: |
sudo systemctl start mysql
# workaround for php/mysql-8 incompatibility: https://stackoverflow.com/a/50776838
mysql --user="root" --password="root" -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'"
mysql --user="root" --password="root" -e "CREATE DATABASE dusk character set UTF8mb4 collate utf8mb4_bin;"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: '18.x'
- name: Install Dependencies
run: |
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
chmod -R 777 storage bootstrap/cache
npm install
npm run production
- name: Generate Application Key
run: |
php artisan key:generate
- name: Upgrade Chrome Driver
run: php artisan dusk:chrome-driver
# Following step is a workaround for a bug in older versions of dusk. It should be removed after dusk is updated (>=v7.x)
- name: Install Chrome
run: |
CHROME_VERSION=$(php artisan dusk:chrome-driver | sed 's/.* //' | awk '{ print substr( $0, 1, length($0)-1 ) }')"-1"
sudo wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb \
&& sudo apt install -y --allow-downgrades /tmp/chrome.deb \
&& sudo rm /tmp/chrome.deb
- name: Start Chrome Driver
run: ./vendor/laravel/dusk/bin/chromedriver-linux > /dev/null 2>&1 &
- name: Run Laravel Server
run: php artisan serve > /dev/null 2>&1 &
- name: Run Dusk Tests
run: |
chmod -R 0755 vendor/laravel/dusk/bin/
php artisan dusk
env:
APP_ENV: local
APP_URL: "http://127.0.0.1:8000"
DB_CONNECTION: mysql
DB_DATABASE: dusk
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_USER: root
DB_PASSWORD: root
- name: Upload Laravel Logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs
path: ./storage/logs
- name: Upload Screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: screenshots
path: tests/Browser/screenshots
- name: Upload Console Logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: console
path: tests/Browser/console