-
Notifications
You must be signed in to change notification settings - Fork 80
116 lines (100 loc) · 3.25 KB
/
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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: CI
on:
push:
pull_request:
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
check_composer:
name: Check composer.json
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: '8.2'
- run: composer validate --strict --no-check-lock
static_analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: '8.2'
- name: Install dependencies
run: composer update --ansi --no-progress --prefer-dist --no-interaction
- run: vendor/bin/phpstan analyze
tests:
name: Tests on PHP ${{ matrix.php }} with ${{ matrix.implementation }}${{ matrix.name_suffix }}
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
minimum_stability: [ 'stable' ]
name_suffix: [ '' ]
implementation: [ 'http_kernel' ]
include:
- php: '8.2'
minimum_stability: dev
implementation: 'http_kernel'
name_suffix: ' and dev deps'
- php: '8.2'
implementation: http_client
- php: '8.2'
minimum_stability: dev
implementation: 'http_client'
name_suffix: ' and dev deps'
fail-fast: false
env:
MATRIX_PHP: ${{ matrix.php }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "xdebug"
php-version: "${{ matrix.php }}"
tools: composer
- name: Configure for minimum stability
if: "${{ matrix.minimum_stability == 'dev' }}"
run: |
composer config minimum-stability dev
- name: Install dependencies
run: |
composer update --no-interaction --prefer-dist
- name: Setup Mink test server
if: "${{ matrix.implementation == 'http_client'}}"
run: |
mkdir ./logs
./vendor/bin/mink-test-server &> ./logs/mink-test-server.log &
- name: Wait for browser & PHP to start
if: "${{ matrix.implementation == 'http_client'}}"
run: |
while ! nc -z localhost 8002 </dev/null; do echo Waiting for PHP server to start...; sleep 1; done
- name: Run tests
if: "${{ matrix.implementation == 'http_kernel'}}"
run: |
vendor/bin/phpunit -v --coverage-clover=coverage.clover --log-junit junit.xml
- name: Run tests
if: "${{ matrix.implementation == 'http_client'}}"
run: |
vendor/bin/phpunit -c phpunit.http_client.xml -v --coverage-clover=coverage.clover --log-junit junit.xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.clover
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}