Skip to content

Commit 66dd545

Browse files
committed
Modify the PHPUnit action, ensuring we only run when PHP files change
1 parent 8ef2bc4 commit 66dd545

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

.github/workflows/test.yml .github/workflows/phpunit.yml

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
name: PHPUnit Tests
22

3-
env:
4-
COMPOSER_VERSION: "2"
5-
COMPOSER_CACHE: "${{ github.workspace }}/.composer-cache"
6-
73
on:
8-
schedule:
9-
- cron: '0 0 * * *'
104
push:
115
branches:
126
- develop
137
- trunk
8+
paths:
9+
- "**.php"
1410
pull_request:
1511
branches:
1612
- develop
13+
paths:
14+
- "**.php"
1715

1816
jobs:
1917
phpunit:
@@ -29,19 +27,20 @@ jobs:
2927
- name: Checkout
3028
uses: actions/checkout@v4
3129

32-
- name: Set standard 10up cache directories
33-
run: |
34-
composer config -g cache-dir "${{ env.COMPOSER_CACHE }}"
30+
- name: Get composer cache directory
31+
id: composer-cache
32+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
3533

36-
- name: Prepare composer cache
34+
- name: Cache dependencies
35+
id: cache-composer
3736
uses: actions/cache@v4
37+
env:
38+
cache-name: cache-composer
3839
with:
39-
path: ${{ env.COMPOSER_CACHE }}
40-
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
41-
restore-keys: |
42-
composer-${{ env.COMPOSER_VERSION }}-
40+
path: ${{ steps.composer-cache.outputs.dir }}
41+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }}
4342

44-
- uses: getong/mariadb-action@v1.1
43+
- uses: getong/mariadb-action@v1
4544

4645
- name: Set PHP version
4746
uses: shivammathur/setup-php@v2

0 commit comments

Comments
 (0)