-
-
Notifications
You must be signed in to change notification settings - Fork 452
95 lines (79 loc) · 3.43 KB
/
ci.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: CI
on:
pull_request:
push:
branches:
- master
- release/**
permissions:
contents: read
# Cancel in progress workflows on pull_requests.
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
tests:
name: Tests (${{ matrix.os }}, ${{ matrix.php.version }}, ${{ matrix.dependencies }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
php:
- { version: '7.2', phpunit: '^8.5.40' }
- { version: '7.3', phpunit: '^9.6.21' }
- { version: '7.4', phpunit: '^9.6.21' }
- { version: '8.0', phpunit: '^9.6.21' }
- { version: '8.1', phpunit: '^9.6.21' }
- { version: '8.2', phpunit: '^9.6.21' }
- { version: '8.3', phpunit: '^9.6.21' }
- { version: '8.4', phpunit: '^9.6.21' }
dependencies:
- lowest
- highest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php.version }}
coverage: xdebug
- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Determine Composer cache directory
id: composer-cache
run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT"
shell: bash
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.directory }}
key: ${{ runner.os }}-${{ matrix.php.version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.php.version }}-${{ matrix.dependencies }}-composer-
# These dependencies are not used running the tests but can cause deprecation warnings so we remove them before running the tests
- name: Remove unused dependencies
run: composer remove vimeo/psalm phpstan/phpstan friendsofphp/php-cs-fixer --dev --no-interaction --no-update
- name: Set phpunit/phpunit version constraint
run: composer require phpunit/phpunit:'${{ matrix.php.phpunit }}' --dev --no-interaction --no-update
- name: Install highest dependencies
run: composer update --no-progress --no-interaction --prefer-dist
if: ${{ matrix.dependencies == 'highest' }}
- name: Install lowest dependencies
run: composer update --no-progress --no-interaction --prefer-dist --prefer-lowest
if: ${{ matrix.dependencies == 'lowest' }}
- name: Run unit tests
run: vendor/bin/phpunit --testsuite unit --coverage-clover=coverage.xml
# The reason for running some OOM tests without coverage is that because the coverage information collector can cause another OOM event invalidating the test
- name: Run out of memory tests (without coverage)
run: vendor/bin/phpunit --testsuite oom --no-coverage
- name: Upload code coverage
uses: codecov/codecov-action@v3
- name: Check benchmarks
run: vendor/bin/phpbench run --revs=1 --iterations=1
if: ${{ matrix.dependencies == 'highest' && matrix.php.version == '8.3' }}