-
Notifications
You must be signed in to change notification settings - Fork 4
70 lines (58 loc) · 1.89 KB
/
run-tests.yml
File metadata and controls
70 lines (58 loc) · 1.89 KB
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
name: Run tests
on:
pull_request:
workflow_dispatch:
jobs:
tests:
name: P${{ matrix.php }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: what-has-changed
# Run only if PHP files have changed
if: ${{ needs.what-has-changed.outputs.php == 'true' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [7.4]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none
- name: Install dependencies
run: composer update --no-interaction --no-progress --prefer-dist --no-scripts
- name: Execute tests
run: vendor/bin/phpunit --testsuite "Unit Test Suite"
# Job to check if certain files have changed
what-has-changed:
name: Detect file changes
runs-on: ubuntu-latest
outputs:
php: ${{ steps.filter.outputs.php }}
steps:
- name: Checkout
uses: actions/checkout@v2
# For pull requests it's not necessary to checkout the code
if: ${{ github.event_name != 'pull_request' }}
- uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.ref }}
filters: |
php:
- added|modified: 'config/**/*.php'
- added|modified: 'src/**/*.php'
- added|modified: 'tests/**/*.php'