|
1 |
| -name: PHP Composer |
| 1 | +name: Tests |
2 | 2 |
|
3 |
| -on: |
4 |
| - push: |
5 |
| - branches: [ "master" ] |
6 |
| - pull_request: |
7 |
| - branches: [ "master" ] |
8 |
| - |
9 |
| -permissions: |
10 |
| - contents: read |
| 3 | +on: [push, pull_request] |
11 | 4 |
|
12 | 5 | jobs:
|
13 |
| - build: |
| 6 | + php-tests: |
| 7 | + runs-on: ${{ matrix.os }} |
| 8 | + strategy: |
| 9 | + fail-fast: true |
| 10 | + matrix: |
| 11 | + php: [8.4] |
| 12 | + dependency-version: [prefer-stable] |
| 13 | + os: [ubuntu-latest, windows-latest] |
14 | 14 |
|
15 |
| - runs-on: ubuntu-latest |
| 15 | + name: ${{ matrix.os }} - PHP${{ matrix.php }} - ${{ matrix.dependency-version }} |
16 | 16 |
|
17 | 17 | steps:
|
18 |
| - - uses: actions/checkout@v3 |
| 18 | + - name: Checkout code |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Cache dependencies |
| 22 | + uses: actions/cache@v4 |
| 23 | + with: |
| 24 | + path: ~/.composer/cache/files |
| 25 | + key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} |
19 | 26 |
|
20 |
| - - name: Validate composer.json and composer.lock |
21 |
| - run: composer validate --strict |
| 27 | + - name: Setup PHP |
| 28 | + uses: shivammathur/setup-php@v2 |
| 29 | + with: |
| 30 | + php-version: ${{ matrix.php }} |
| 31 | + extensions: dom, curl, libxml, mbstring, zip, intl, pdo_sqlite |
| 32 | + coverage: none |
22 | 33 |
|
23 |
| - - name: Cache Composer packages |
24 |
| - id: composer-cache |
25 |
| - uses: actions/cache@v3 |
26 |
| - with: |
27 |
| - path: vendor |
28 |
| - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} |
29 |
| - restore-keys: | |
30 |
| - ${{ runner.os }}-php- |
| 34 | + - name: Install dependencies |
| 35 | + run: | |
| 36 | + composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction |
31 | 37 |
|
32 |
| - - name: Install dependencies |
33 |
| - run: composer install --prefer-dist --no-progress |
| 38 | + - name: Execute tests |
| 39 | + run: vendor/bin/phpunit |
34 | 40 |
|
35 |
| - # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" |
36 |
| - # Docs: https://getcomposer.org/doc/articles/scripts.md |
| 41 | + - name: Coveralls GitHub Action |
| 42 | + uses: coverallsapp/[email protected] |
37 | 43 |
|
38 |
| - - name: Run test suite |
39 |
| - run: composer run-script test |
|
0 commit comments