-
Notifications
You must be signed in to change notification settings - Fork 736
156 lines (140 loc) · 5.92 KB
/
continuous-integration.yaml
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: 'Continuous integration'
on: ['push', 'pull_request']
jobs:
cs:
runs-on: 'ubuntu-20.04'
name: 'Coding style'
steps:
- name: 'Checkout'
uses: 'actions/checkout@v3'
- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '8.0'
coverage: 'none'
extensions: 'json, mbstring, tokenizer'
tools: 'composer-normalize:2.28.0, php-cs-fixer:3.13.2'
- name: 'Check PHP code'
run: |
php-cs-fixer fix --diff --dry-run --allow-risky=yes --using-cache=no
- name: 'Check composer.json'
run: |
composer-normalize --diff --dry-run --indent-size=4 --indent-style=space --no-update-lock
phpunit:
runs-on: 'ubuntu-20.04'
name: 'PHPUnit (PHP ${{ matrix.php }}, ES ${{ matrix.elasticsearch }})'
timeout-minutes: 10
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
php:
- '8.0'
- '8.1'
- '8.2'
- '8.3'
experimental:
- false
dependencies:
- 'highest'
elasticsearch:
- '7.17.9'
include:
# Test with the lowest set of dependencies
- dependencies: 'lowest'
php: '8.0'
elasticsearch: '7.17.9'
experimental: false
- php: '8.1'
elasticsearch: '8.0.1'
experimental: false
- php: '8.1'
elasticsearch: '8.1.3' # there are some bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.1.html#breaking-changes-8.1
experimental: false
- php: '8.1'
elasticsearch: '8.5.3' # there are some bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.5.html
experimental: false
- php: '8.1'
elasticsearch: '8.6.2' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.6.html
experimental: false
- php: '8.1'
elasticsearch: '8.7.1' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.7.html
experimental: false
- php: '8.1'
elasticsearch: '8.8.2' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.8.html
experimental: false
- php: '8.1'
elasticsearch: '8.9.2' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.9.html
experimental: false
- php: '8.1'
elasticsearch: '8.10.4' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.10.html
experimental: false
- php: '8.1'
elasticsearch: '8.11.4' # there are some bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.10.html
experimental: false
- php: '8.1'
elasticsearch: '8.12.0' # there are some bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.12.html
experimental: false
fail-fast: false
steps:
- name: 'Checkout'
uses: 'actions/checkout@v3'
- 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@v2'
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/docker-compose.proxy.yml --file=docker/docker-compose.es.yml 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/docker-compose.proxy.yml --file=docker/docker-compose.es.yml logs es01 es02
phpstan:
runs-on: 'ubuntu-20.04'
name: 'PHPStan'
timeout-minutes: 10
steps:
- name: 'Checkout'
uses: 'actions/checkout@v3'
- 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@v2'
with:
composer-options: '--prefer-dist'
- name: 'Run phpstan'
run: |
vendor/bin/phpstan analyse --no-progress --error-format=github