Repository navigation
77 lines (72 loc) · 2.82 KB
/
Copy pathci.yml
File metadata and controls
77 lines (72 loc) · 2.82 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
# Тесты на всех поддерживаемых версиях PHP, проверка работы без Composer, статический анализ и стиль.
# Настоящий API здесь не вызывается: тесты идут на MockTransport, подменном PSR-18 клиенте и встроенном
# сервере PHP на 127.0.0.1.
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@v7
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, json, mbstring
coverage: none
tools: composer:v2
- name: Syntax of every file
run: find src tests scripts autoload.php -name '*.php' -print0 | xargs -0 -n1 php -l
- name: Works without Composer
run: php tests/standalone.php
- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-progress
- name: PHPUnit
run: vendor/bin/phpunit
static:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: curl, json, mbstring
coverage: none
tools: composer:v2
- name: Validate composer.json
run: composer validate --no-check-lock
- name: Install dependencies
id: deps
run: composer update --prefer-dist --no-interaction --no-progress
- name: PHPStan (level max, PHP 7.4)
run: vendor/bin/phpstan analyse --no-progress --memory-limit=1G
# Стиль проверяется и при замечаниях PHPStan: одна прогонка показывает обе проблемы.
- name: PHP-CS-Fixer (PSR-12)
if: ${{ !cancelled() && steps.deps.outcome == 'success' }}
run: vendor/bin/php-cs-fixer fix --dry-run --diff
generated:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '3.13'
# Сгенерированный код должен совпадать с тем, что даёт генератор из закоммиченных спек.
- name: Generated code is up to date
run: |
python scripts/generate.py
if [ -n "$(git status --porcelain -- src)" ]; then
git status
git diff
echo "Сгенерированный код устарел: запустите python scripts/generate.py и закоммитьте результат."
exit 1
fi