7
7
branches : [dev, staging, production]
8
8
9
9
jobs :
10
- lighthouse-ci :
10
+ check-diff :
11
11
runs-on : ubuntu-latest
12
- strategy :
13
- matrix :
14
- php : [8.4]
15
-
12
+ outputs :
13
+ diff : ${{ steps.git-diff.outputs.diff }}
16
14
steps :
17
15
- uses : actions/checkout@v4
18
- with :
19
- ref : ${{ github.event.pull_request.head.sha }} # https://github.com/GoogleChrome/lighthouse-ci/issues/172
20
16
- uses : greguintow/get-diff-action@v7
21
17
id : git-diff
22
18
with :
23
- patterns : |
19
+ PATTERNS : |
24
20
composer.json
25
21
composer.lock
26
22
**/*.php
27
23
package.json
28
24
package-lock.json
29
25
**/*.css
30
26
**/*.js"
27
+
28
+ lighthouse-ci :
29
+ runs-on : ubuntu-latest
30
+ needs : check-diff
31
+ if : ${{ needs.check-diff.outputs.diff != '[]' && needs.check-diff.outputs.diff != '' }}
32
+ strategy :
33
+ matrix :
34
+ php : [8.4]
35
+
36
+ steps :
37
+ - uses : actions/checkout@v4
38
+ with :
39
+ ref : ${{ github.event.pull_request.head.sha }} # https://github.com/GoogleChrome/lighthouse-ci/issues/172
31
40
- name : Set up PHP
32
- if : steps.git-diff.outputs.diff
33
41
uses : shivammathur/setup-php@v2
34
42
with :
35
43
php-version : ${{ matrix.php }}
@@ -44,52 +52,35 @@ jobs:
44
52
key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
45
53
restore-keys : ${{ runner.os }}-composer-
46
54
- name : Install Dependencies
47
- if : steps.git-diff.outputs.diff
48
55
run : composer install -q --no-dev --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
49
- - uses : actions/setup-node@v4
50
- if : steps.git-diff.outputs.diff
56
+ - name : Set up Node
57
+ uses : actions/setup-node@v4
51
58
with :
52
59
node-version-file : " .nvmrc"
53
- - name : Cache node modules
54
- if : steps.git-diff.outputs.diff
55
- uses : actions/cache@v4
56
- with :
57
- path : node_modules
58
- key : ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
60
+ cache : npm
59
61
- name : Install dependencies
60
- if : steps.git-diff.outputs.diff
61
62
run : npm install
62
63
env :
63
64
CI : true
64
- - name : Copy .env
65
- if : steps.git-diff.outputs.diff
66
- run : php -r "file_exists('.env') || copy('.env.example', '.env');"
67
65
- name : Create test database
68
- if : steps.git-diff.outputs.diff
69
66
run : |
70
67
sudo systemctl start mysql.service
71
68
mysqladmin create accessibilityexchange --user="root" --password="root"
69
+ - name : Copy .env
70
+ run : php -r "file_exists('.env') || copy('.env.example', '.env');"
72
71
- name : Generate keys
73
- if : steps.git-diff.outputs.diff
74
72
run : |
75
73
echo "CIPHERSWEET_KEY=\"$(openssl rand -hex 32)\"" >> .env
76
74
php artisan key:generate
77
- - name : Run database migration
78
- if : steps.git-diff.outputs.diff
75
+ - name : Run Laravel Server
79
76
run : |
80
77
php artisan migrate
81
78
php artisan storage:link
82
79
php artisan serve &
83
80
env :
84
81
DB_PASSWORD : root
85
82
DB_HOST : localhost
86
- - name : Use Node from .nvmrc file
87
- if : steps.git-diff.outputs.diff
88
- uses : actions/setup-node@v4
89
- with :
90
- node-version-file : " .nvmrc"
91
83
- name : Run Lighthouse CI
92
- if : steps.git-diff.outputs.diff
93
84
run : |
94
85
npm install -g @lhci/[email protected]
95
86
lhci autorun
0 commit comments