Skip to content

Enable declare_strict_types option and apply @PHP80Migration set with… #1077

Enable declare_strict_types option and apply @PHP80Migration set with…

Enable declare_strict_types option and apply @PHP80Migration set with… #1077

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