Skip to content

Commit

Permalink
Run functional tests on github action (#1885)
Browse files Browse the repository at this point in the history
* Run functional tests on github action

* Add changelog
  • Loading branch information
deguif authored Dec 3, 2020
1 parent a4c96fd commit a0f01fc
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 59 deletions.
31 changes: 25 additions & 6 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ jobs:
tools: 'composer-normalize:2.11.0, php-cs-fixer:2.16.7'

- name: 'Check PHP code'
run: 'php-cs-fixer fix --diff --dry-run --allow-risky=yes --using-cache=false'
run: |
php-cs-fixer fix --diff --dry-run --allow-risky=yes --using-cache=false
- name: 'Check composer.json'
run: 'composer-normalize --diff --dry-run --indent-size=4 --indent-style=space --no-update-lock'
run: |
composer-normalize --diff --dry-run --indent-size=4 --indent-style=space --no-update-lock
phpunit:
runs-on: 'ubuntu-20.04'
Expand Down Expand Up @@ -55,7 +57,8 @@ jobs:

- name: 'Get composer cache directory'
id: 'composer_cache'
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: 'Cache dependencies'
uses: 'actions/cache@v2'
Expand All @@ -67,7 +70,23 @@ jobs:
${{ runner.os }}-composer-
- name: 'Update dependencies'
run: 'composer update --prefer-dist --no-interaction --no-progress --ansi ${{ matrix.composer_flags }}'
run: |
composer update --prefer-dist --no-interaction --no-progress --ansi ${{ matrix.composer_flags }}
- name: 'Run tests'
run: 'vendor/bin/phpunit --group unit'
- name: 'Run unit tests'
run: |
vendor/bin/phpunit --group unit
- name: 'Setup 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
ES_VERSION=${{ matrix.elasticsearch }} 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'
run: |
vendor/bin/phpunit --group functional
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Allow float values for connection timeout and connection connect-timeout, providing ms precision for those. Previous precision was second. [#1868](https://github.com/ruflin/Elastica/pull/1868)
* Run coding styles check on github action [#1878](https://github.com/ruflin/Elastica/pull/1878)
* Run unit tests on github action [#1882](https://github.com/ruflin/Elastica/pull/1882)
* Run functional tests on github action [#1885](https://github.com/ruflin/Elastica/pull/1885)
### Deprecated
* Deprecated `Elastica\Aggregation\Range::setKeyedResponse()`, use `setKeyed()` instead [#1848](https://github.com/ruflin/Elastica/pull/1848)
* Deprecated `Elastica\Exception\ResponseException::getElasticsearchException()`, use `getResponse()::getFullError()` instead [#1829](https://github.com/ruflin/Elastica/pull/1829)
Expand Down
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Default version to start ES on Docker, overide with `ES_VERSION=75 make start-docker` for ES 7.5
ES_VERSION?=73

.PHONY: clean
clean:
rm -fr tools vendor build composer.lock .php_cs.cache
Expand Down Expand Up @@ -75,15 +72,14 @@ docker-start:
docker-compose --file=docker/docker-compose.yml \
--file=docker/docker-compose.proxy.yml \
--file=docker/docker-compose.es.yml \
--file=docker/docker-compose.es${ES_VERSION}.yml \
--file=docker/docker-compose.es.yml \
up ${DOCKER_OPTIONS}

.PHONY: docker-stop
docker-stop:
docker-compose --file=docker/docker-compose.yml \
--file=docker/docker-compose.proxy.yml \
--file=docker/docker-compose.es.yml \
--file=docker/docker-compose.es${ES_VERSION}.yml \
down

.PHONY: docker-run-phpunit
Expand Down
18 changes: 7 additions & 11 deletions docker/docker-compose.es.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
version: '3.4'

# Template docker-compose file: the ES services are not valid, as there is no `:latest` tag on those images.
#
# This is done on purpose as the ES version can be chosen when starting docker
# As an example: see docker-compose.es75.yml
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:latest
image: docker.elastic.co/elasticsearch/elasticsearch-oss:${ES_VERSION:-7.3.2}
command: >
/bin/sh -c "./bin/elasticsearch-plugin list | grep -q ingest-attachment
|| ./bin/elasticsearch-plugin install --batch ingest-attachment;
Expand All @@ -15,8 +11,8 @@ services:
environment:
- node.name=es01
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es02
- cluster.initial_master_nodes=es01,es02
- cluster.initial_master_nodes=es01
- discovery.seed_hosts=es01
- bootstrap.memory_lock=true
- processors=1
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
Expand All @@ -29,11 +25,11 @@ services:
- data01:/usr/share/elasticsearch/data
- esrepo:/usr/share/elasticsearch/repository
ports:
- 127.0.0.1:9200:9200
- 9200:9200
networks:
- elastic
es02:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:latest
image: docker.elastic.co/elasticsearch/elasticsearch-oss:${ES_VERSION:-7.3.2}
command: >
/bin/sh -c "./bin/elasticsearch-plugin list | grep -q ingest-attachment
|| ./bin/elasticsearch-plugin install --batch ingest-attachment;
Expand All @@ -42,8 +38,8 @@ services:
environment:
- node.name=es02
- cluster.name=es-docker-cluster
- cluster.initial_master_nodes=es01
- discovery.seed_hosts=es01
- cluster.initial_master_nodes=es01,es02
- bootstrap.memory_lock=true
- processors=1
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
Expand All @@ -64,4 +60,4 @@ volumes:

networks:
elastic:
driver: bridge
driver: bridge
7 changes: 0 additions & 7 deletions docker/docker-compose.es71.yml

This file was deleted.

7 changes: 0 additions & 7 deletions docker/docker-compose.es72.yml

This file was deleted.

7 changes: 0 additions & 7 deletions docker/docker-compose.es73.yml

This file was deleted.

7 changes: 0 additions & 7 deletions docker/docker-compose.es74.yml

This file was deleted.

7 changes: 0 additions & 7 deletions docker/docker-compose.es75.yml

This file was deleted.

4 changes: 2 additions & 2 deletions docker/docker-compose.proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ services:
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- 127.0.0.1:8000:8000
- 127.0.0.1:8001:8001
- 8000:8000
- 8001:8001
networks:
- elastic

Expand Down

0 comments on commit a0f01fc

Please sign in to comment.