-
Notifications
You must be signed in to change notification settings - Fork 725
139 lines (119 loc) · 4.21 KB
/
Copy pathcontinuous-integration.yaml
File metadata and controls
139 lines (119 loc) · 4.21 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: 'Continuous integration'
on: ['push', 'pull_request']
jobs:
cs:
runs-on: 'ubuntu-24.04'
name: 'Coding style'
steps:
- name: 'Checkout'
uses: 'actions/checkout@v4'
- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '8.1'
coverage: 'none'
extensions: 'json, mbstring, tokenizer'
tools: 'composer-normalize:2.28.0, php-cs-fixer:3.84.0'
- name: 'Check PHP code'
run: |
php-cs-fixer fix --diff --dry-run --allow-risky=yes --using-cache=no --show-progress=dots
- name: 'Check composer.json'
run: |
composer-normalize --diff --dry-run --indent-size=4 --indent-style=space --no-update-lock
coding-standards:
runs-on: 'ubuntu-24.04'
name: 'Coding standards'
steps:
- name: 'Checkout'
uses: 'actions/checkout@v4'
- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '8.1'
tools: composer
- name: 'Install dependencies with Composer'
uses: 'ramsey/composer-install@v3'
with:
composer-options: '--prefer-dist'
- name: 'Run Rector'
run: make run-rector
phpunit:
runs-on: 'ubuntu-24.04'
name: 'PHPUnit (PHP ${{ matrix.php }}, ES ${{ matrix.elasticsearch }})'
timeout-minutes: 10
strategy:
matrix:
php:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- '8.5'
dependencies:
- 'highest'
elasticsearch:
- '9.1.0'
fail-fast: false
steps:
- name: 'Checkout'
uses: 'actions/checkout@v4'
- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php }}'
coverage: 'pcov'
tools: 'pecl, composer:v2'
extensions: 'curl, json, mbstring, openssl'
- name: 'Install dependencies with Composer'
uses: 'ramsey/composer-install@v3'
with:
dependency-versions: '${{ matrix.dependencies }}'
composer-options: '--prefer-dist'
- name: 'Run unit tests'
run: |
vendor/bin/phpunit --group unit --coverage-clover=build/coverage/unit-coverage.xml
- name: 'Setup Elasticsearch'
env:
ES_VERSION: "${{ matrix.elasticsearch }}"
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
docker compose --file=docker/compose.proxy.yaml --file=docker/compose.es.yaml up --detach
docker run --rm --network=docker_elastic curlimages/curl --max-time 120 --retry-max-time 120 --retry 120 --retry-delay 5 --retry-all-errors --show-error --silent http://es01:9200
docker run --rm --network=docker_elastic curlimages/curl --max-time 120 --retry-max-time 120 --retry 120 --retry-delay 5 --retry-all-errors --show-error --silent http://es02:9200
- name: 'Run functional tests'
env:
ES_VERSION: "${{ matrix.elasticsearch }}"
run: |
vendor/bin/phpunit --group functional --coverage-clover=build/coverage/functional-coverage.xml
- name: 'Upload coverage to Codecov'
uses: codecov/codecov-action@v2
with:
files: build/coverage/unit-coverage.xml,build/coverage/functional-coverage.xml
- name: Elasticsearch Logs
if: always()
run: |
docker compose --file=docker/compose.proxy.yaml --file=docker/compose.es.yaml logs es01 es02
phpstan:
runs-on: 'ubuntu-24.04'
name: 'PHPStan'
timeout-minutes: 10
steps:
- name: 'Checkout'
uses: 'actions/checkout@v4'
- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '8.1'
coverage: 'none'
tools: 'composer:v2'
extensions: 'curl, json, mbstring, openssl'
- name: 'Install dependencies with Composer'
uses: 'ramsey/composer-install@v3'
with:
composer-options: '--prefer-dist'
- name: 'Run phpstan'
run: |
vendor/bin/phpstan analyse --no-progress --error-format=github --memory-limit=1G