-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (94 loc) · 3.25 KB
/
Copy pathtests.yml
File metadata and controls
113 lines (94 loc) · 3.25 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
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
name: Tests
on:
push:
branches: [main]
pull_request:
# So a run can be asked for without pushing something to ask for it.
workflow_dispatch:
jobs:
tests:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
# The Redis tests skip themselves where there is nothing to talk to, which keeps the suite
# runnable on a machine without one — and would quietly test nothing here. So here there
# is one.
services:
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: ${{ matrix.php }}
extensions: redis
coverage: none
- uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
- name: There is a Redis to test against
run: |
php -r 'exit((new Redis())->connect("127.0.0.1", 6379) ? 0 : 1);'
- name: Unit tests
run: vendor/bin/unit-tests
env:
REDIS_URL: tcp://127.0.0.1:6379
coverage:
name: Coverage
runs-on: ubuntu-latest
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
services:
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: '8.3'
extensions: redis
coverage: none
- uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
- name: Unit tests with coverage
run: phpdbg -qrr vendor/bin/unit-tests
env:
REDIS_URL: tcp://127.0.0.1:6379
# Only where the token is there, so a fork or a repository without it still passes.
- name: SonarCloud
if: env.SONAR_TOKEN != ''
# Reporting, not a gate: a token which has expired should not turn a green suite red.
continue-on-error: true
uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1
env:
SONAR_HOST_URL: https://sonarcloud.io
static-analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: '8.3'
# Without it there is no Redis class, and RedisQueue is a file full of unknown types.
extensions: redis
coverage: none
- uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
- name: PHPStan
run: vendor/bin/phpstan analyse --no-progress