-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.87 KB
/
unit-tests.yml
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
name: Unit tests
on:
push:
paths:
- '**workflows/unit-tests.yml'
- '**.php'
- '**composer.json'
- '**phpunit.xml.dist'
pull_request:
paths:
- '**workflows/unit-tests.yml'
- '**.php'
- '**composer.json'
- '**phpunit.xml.dist'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-ver: [ '8.3', '8.4' ]
steps:
- name: Set "USE_COVERAGE" env var based on matrix
run: echo "USE_COVERAGE=${{ matrix.php-ver == '8.3' }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-ver }}
ini-values: zend.assertions=1, error_reporting=E_ALL, display_errors=On
coverage: ${{ ((env.USE_COVERAGE == 'yes') && 'xdebug') || 'none' }}
- name: Adjust Composer dependencies
run: composer remove --dev --no-update inpsyde/php-coding-standards phpcompatibility/php-compatibility vimeo/psalm
- name: Install dependencies
uses: ramsey/composer-install@v3
- name: Run unit tests
run: ./vendor/bin/phpunit ${{ ((env.USE_COVERAGE == 'yes') && '--coverage-clover coverage.xml') || '--no-coverage' }}
- name: Update coverage
if: ${{ env.USE_COVERAGE == 'yes' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml