Skip to content

Commit fd21542

Browse files
authored
Improve Workflow Caches
1 parent 9916773 commit fd21542

File tree

7 files changed

+178
-34
lines changed

7 files changed

+178
-34
lines changed

.github/workflows/pint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Fix PHP code style issues
2727
uses: aglipanci/laravel-pint-action@latest
2828

29-
- name: Commit changes
29+
- name: Commit styling changes
3030
uses: stefanzweifel/git-auto-commit-action@v5
3131
with:
3232
commit_message: Fix styling
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: run-phpstan-pull
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'master'
7+
- 'development'
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
os: [ubuntu-latest]
16+
php: [8.3]
17+
laravel: [11]
18+
stability: [prefer-dist]
19+
20+
name: PHPStan - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
21+
env:
22+
extensionKey: phpextensions-${{ matrix.os }}-P${{ matrix.php }}
23+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pcov, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
24+
25+
steps:
26+
- name: Wait for tests to finish
27+
uses: lewagon/[email protected]
28+
with:
29+
ref: ${{ github.ref }}
30+
running-workflow-name: 'Run Tests Pull'
31+
repo-token: ${{ secrets.GITHUB_TOKEN }}
32+
wait-interval: 20
33+
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Setup cache environment
38+
id: extcache
39+
uses: shivammathur/cache-extensions@v1
40+
with:
41+
php-version: ${{ matrix.php }}
42+
extensions: ${{ env.extensions }}
43+
key: ${{ env.extensionKey }}
44+
45+
- name: Cache extensions
46+
uses: actions/cache@v4
47+
with:
48+
path: ${{ steps.extcache.outputs.dir }}
49+
key: ${{ steps.extcache.outputs.key }}
50+
restore-keys: ${{ steps.extcache.outputs.key }}
51+
52+
- name: Setup PHP
53+
uses: shivammathur/setup-php@v2
54+
with:
55+
php-version: ${{ matrix.php }}
56+
extensions: ${{ env.extensions }}
57+
coverage: pcov
58+
tools: phpunit:9.5
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- name: Setup problem matchers for PHP
63+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
64+
65+
- name: Get composer cache directory
66+
id: composer-cache
67+
run: |
68+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
69+
70+
- uses: actions/cache@v4
71+
with:
72+
path: ${{ steps.composer-cache.outputs.dir }}
73+
key: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
74+
restore-keys: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-
75+
76+
- name: Add token
77+
run: |
78+
composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
79+
80+
- name: Install dependencies
81+
if: steps.composer-cache.outputs.cache-hit != 'true'
82+
run: composer require "laravel/framework:${{ matrix.laravel }}.*" --no-interaction --no-update
83+
84+
- name: Update dependencies
85+
if: steps.composer-cache.outputs.cache-hit != 'true'
86+
run: composer update --${{ matrix.stability }} --no-interaction
87+
88+
- name: Install PHPStan
89+
run: composer require larastan/larastan:^2.0 --no-interaction
90+
91+
- uses: actions/cache/restore@v4
92+
id: larastan-restore
93+
with:
94+
path: ./build/phpstan
95+
key: phpstan-${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}
96+
97+
- name: Run PHPStan Tests
98+
run: ./vendor/bin/phpstan analyse
99+
100+
- uses: actions/cache/save@v4
101+
id: larastan-save
102+
with:
103+
path: ./build/phpstan
104+
key: phpstan-${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}

.github/workflows/run-phpstan.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: run-phpstan
22

33
on:
4-
pull_request:
5-
branches:
6-
- 'master'
7-
- 'development'
84
push:
95
branches:
106
- '*' # matches every branch that doesn't contain a '/'
@@ -26,10 +22,18 @@ jobs:
2622

2723
name: PHPStan - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2824
env:
29-
extensionKey: phpextensions
25+
extensionKey: phpextensions-${{ matrix.os }}-P${{ matrix.php }}
3026
extensions: dom, curl, libxml, mbstring, zip, pcntl, pcov, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
3127

3228
steps:
29+
- name: Wait for tests to finish
30+
uses: lewagon/[email protected]
31+
with:
32+
ref: ${{ github.ref }}
33+
running-workflow-name: 'Run Standard Tests'
34+
repo-token: ${{ secrets.GITHUB_TOKEN }}
35+
wait-interval: 20
36+
3337
- name: Checkout code
3438
uses: actions/checkout@v4
3539

@@ -69,8 +73,8 @@ jobs:
6973
- uses: actions/cache@v4
7074
with:
7175
path: ${{ steps.composer-cache.outputs.dir }}
72-
key: ${{ runner.os }}-PHPStan-P${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
73-
restore-keys: ${{ runner.os }}-PHPStan-P${{ matrix.php }}-L${{ matrix.laravel }}-composer-
76+
key: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
77+
restore-keys: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-
7478

7579
- name: Add token
7680
run: |
@@ -87,5 +91,17 @@ jobs:
8791
- name: Install PHPStan
8892
run: composer require larastan/larastan:^2.0 --dev --no-interaction
8993

94+
- uses: actions/cache/restore@v4
95+
id: larastan-restore
96+
with:
97+
path: ./build/phpstan
98+
key: phpstan-${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}
99+
90100
- name: Run PHPStan Tests
91101
run: ./vendor/bin/phpstan analyse
102+
103+
- uses: actions/cache/save@v4
104+
id: larastan-save
105+
with:
106+
path: ./build/phpstan
107+
key: phpstan-${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}

.github/workflows/run-tests-pcov-pull.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ jobs:
2626
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pcov,pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
2727

2828
steps:
29+
- name: Wait for tests to finish
30+
uses: lewagon/[email protected]
31+
with:
32+
ref: ${{ github.ref }}
33+
running-workflow-name: 'Run Tests Pull'
34+
repo-token: ${{ secrets.GITHUB_TOKEN }}
35+
wait-interval: 20
36+
2937
- name: Checkout code
3038
uses: actions/checkout@v4
3139

@@ -66,8 +74,8 @@ jobs:
6674
- uses: actions/cache@v4
6775
with:
6876
path: ${{ steps.composer-cache.outputs.dir }}
69-
key: ${{ runner.os }}-PCOV-PULL-PHP${{ matrix.php }}-Laravel${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
70-
restore-keys: ${{ runner.os }}-PCOV-PULL-PHP${{ matrix.php }}-Laravel${{ matrix.laravel }}-composer-
77+
key: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
78+
restore-keys: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-
7179

7280
- name: Add token
7381
run: |

.github/workflows/run-tests-pull.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: run-tests-pull
1+
name: Run Tests Pull
22

33
on:
44
pull_request:
@@ -20,7 +20,7 @@ jobs:
2020

2121
name: PULL PHP-${{ matrix.php }} - Laravel-10
2222
env:
23-
extensionKey: phpextensions-${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}
23+
extensionKey: phpextensions-${{ matrix.os }}-P${{ matrix.php }}
2424
extensions: dom, curl, libxml, mbstring, zip, pcntl, pcov, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, :psr
2525

2626
steps:
@@ -39,8 +39,8 @@ jobs:
3939
uses: actions/cache@v4
4040
with:
4141
path: ${{ steps.extcache.outputs.dir }}
42-
key: ${{ runner.os }}-${{ steps.extcache.outputs.key }}
43-
restore-keys: ${{ runner.os }}-${{ steps.extcache.outputs.key }}
42+
key: ${{ matrix.os }}-${{ steps.extcache.outputs.key }}
43+
restore-keys: ${{ matrix.os }}-${{ steps.extcache.outputs.key }}
4444

4545
- name: Setup PHP
4646
uses: shivammathur/setup-php@v2
@@ -64,8 +64,8 @@ jobs:
6464
- uses: actions/cache@v4
6565
with:
6666
path: ${{ steps.composer-cache.outputs.dir }}
67-
key: ${{ runner.os }}-STDPUSH-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
68-
restore-keys: ${{ runner.os }}-STDPUSH-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-
67+
key: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
68+
restore-keys: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-
6969

7070
- name: Add token
7171
run: |
@@ -118,8 +118,8 @@ jobs:
118118
uses: actions/cache@v4
119119
with:
120120
path: ${{ steps.extcache.outputs.dir }}
121-
key: ${{ runner.os }}-${{ steps.extcache.outputs.key }}
122-
restore-keys: ${{ runner.os }}-${{ steps.extcache.outputs.key }}
121+
key: ${{ matrix.os }}-${{ steps.extcache.outputs.key }}
122+
restore-keys: ${{ matrix.os }}-${{ steps.extcache.outputs.key }}
123123

124124
- name: Setup PHP
125125
uses: shivammathur/setup-php@v2
@@ -143,8 +143,8 @@ jobs:
143143
- uses: actions/cache@v4
144144
with:
145145
path: ${{ steps.composer-cache.outputs.dir }}
146-
key: ${{ runner.os }}-STDPUSH-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
147-
restore-keys: ${{ runner.os }}-STDPUSH-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-
146+
key: ${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
147+
restore-keys: ${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}-composer-
148148

149149
- name: Add token
150150
run: |
@@ -162,4 +162,4 @@ jobs:
162162
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
163163

164164
- name: Run Unit Tests
165-
run: php ./vendor/bin/paratest --no-coverage
165+
run: php ./vendor/bin/phpunit --no-coverage

.github/workflows/run-tests.yml

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: run-tests
1+
name: Run Standard Tests
22

33
on:
44
push:
@@ -22,10 +22,18 @@ jobs:
2222

2323
name: PHP-${{ matrix.php }} - Laravel-10
2424
env:
25-
extensionKey: phpextensions-${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}
25+
extensionKey: phpextensions-${{ matrix.os }}-P${{ matrix.php }}
2626
extensions: dom, curl, libxml, mbstring, zip, pcntl, pcov, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, :psr
2727

2828
steps:
29+
- name: Wait for styling to finish
30+
uses: lewagon/[email protected]
31+
with:
32+
ref: ${{ github.ref }}
33+
running-workflow-name: 'Fix PHP code style issues'
34+
repo-token: ${{ secrets.GITHUB_TOKEN }}
35+
wait-interval: 20
36+
2937
- name: Checkout code
3038
uses: actions/checkout@v4
3139

@@ -41,8 +49,8 @@ jobs:
4149
uses: actions/cache@v4
4250
with:
4351
path: ${{ steps.extcache.outputs.dir }}
44-
key: ${{ runner.os }}-${{ steps.extcache.outputs.key }}
45-
restore-keys: ${{ runner.os }}-${{ steps.extcache.outputs.key }}
52+
key: ${{ matrix.os }}-${{ steps.extcache.outputs.key }}
53+
restore-keys: ${{ matrix.os }}-${{ steps.extcache.outputs.key }}
4654

4755
- name: Setup PHP
4856
uses: shivammathur/setup-php@v2
@@ -66,8 +74,8 @@ jobs:
6674
- uses: actions/cache@v4
6775
with:
6876
path: ${{ steps.composer-cache.outputs.dir }}
69-
key: ${{ runner.os }}-STDPUSH-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
70-
restore-keys: ${{ runner.os }}-STDPUSH-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-
77+
key: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
78+
restore-keys: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-
7179

7280
- name: Add token
7381
run: |
@@ -101,10 +109,18 @@ jobs:
101109

102110
name: PHP-${{ matrix.php }} - Laravel-11
103111
env:
104-
extensionKey: phpextensions-${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}
112+
extensionKey: phpextensions-${{ matrix.os }}-P${{ matrix.php }}
105113
extensions: dom, curl, libxml, mbstring, zip, pcntl, pcov, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, :psr
106114

107115
steps:
116+
- name: Wait for styling to finish
117+
uses: lewagon/[email protected]
118+
with:
119+
ref: ${{ github.ref }}
120+
running-workflow-name: 'Fix PHP code style issues'
121+
repo-token: ${{ secrets.GITHUB_TOKEN }}
122+
wait-interval: 20
123+
108124
- name: Checkout code
109125
uses: actions/checkout@v4
110126

@@ -120,8 +136,8 @@ jobs:
120136
uses: actions/cache@v4
121137
with:
122138
path: ${{ steps.extcache.outputs.dir }}
123-
key: ${{ runner.os }}-${{ steps.extcache.outputs.key }}
124-
restore-keys: ${{ runner.os }}-${{ steps.extcache.outputs.key }}
139+
key: ${{ matrix.os }}-${{ steps.extcache.outputs.key }}
140+
restore-keys: ${{ matrix.os }}-${{ steps.extcache.outputs.key }}
125141

126142
- name: Setup PHP
127143
uses: shivammathur/setup-php@v2
@@ -145,8 +161,8 @@ jobs:
145161
- uses: actions/cache@v4
146162
with:
147163
path: ${{ steps.composer-cache.outputs.dir }}
148-
key: ${{ runner.os }}-STDPUSH-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
149-
restore-keys: ${{ runner.os }}-STDPUSH-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-
164+
key: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
165+
restore-keys: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-
150166

151167
- name: Add token
152168
run: |
@@ -164,4 +180,4 @@ jobs:
164180
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
165181

166182
- name: Run Unit Tests
167-
run: php ./vendor/bin/paratest --no-coverage
183+
run: php ./vendor/bin/phpunit --no-coverage

src/LaravelLivewireTablesServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function boot(): void
2424
__DIR__.'/../config/livewire-tables.php', 'livewire-tables'
2525
);
2626

27-
// Load Default Translations
27+
// Load Default Translations
2828
$this->loadJsonTranslationsFrom(
2929
__DIR__.'/../resources/lang'
3030
);

0 commit comments

Comments
 (0)