Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport of de0f077f375e25f28300cded82bec0d1f9cc677f #357

Open
wants to merge 1 commit into
base: 6.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/wait_for_es.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

use Elasticsearch\ClientBuilder;
use Elasticsearch\Common\Exceptions\NoNodesAvailableException;

require dirname(__DIR__) . '/vendor/autoload.php';

$retries = 0;
$maxRetries = 10;

while (true) {
try {
$client = ClientBuilder::create()->build();
$client->ping();
echo 'Is up and running' . PHP_EOL;
exit(0);
} catch (NoNodesAvailableException $e) {
if ($retries === $maxRetries) {
echo 'Cannot reach elasticsearch server' . PHP_EOL;
exit(1);
}

sleep(5);
$retries++;
}
}
48 changes: 48 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: PHPUnit

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
services:
elasticsearch:
image: elastic/elasticsearch:6.8.14
ports:
- 9200:9200
env:
discovery.type: single-node
strategy:
matrix:
php: ['7.0', '7.1', '7.2', '7.3', '7.4']
steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: xdebug

- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Wait for Elasticsearch
run: php ./.github/wait_for_es.php

- name: Run PHPUnit
run: vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Run PHPCS
run: vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor/ ./

- name: Upload Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
1 change: 0 additions & 1 deletion .phpunit.result.cache

This file was deleted.

24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.