Skip to content

Commit

Permalink
improve github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
miiu96 committed Mar 28, 2022
1 parent 143e53f commit c61acb5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/pr-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ jobs:
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Integration tests
run: make integration-tests
- name: Run integration tests with Elasticsearch v7.16.2
run: make integration-tests 7.16.2
- name: Run integration tests with Elasticsearch v8.1.1
run: make integration-tests 8.1.1
- name: Run integration tests with Elasticsearch latest version
run: make integration-tests latest
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test:

integration-tests:
@echo " > Running integration tests"
cd scripts && ./script.sh start
cd scripts && ./script.sh start ${ES_VERSION}
go test -v ./integrationtests -tags integrationtests
cd scripts && ./script.sh delete
cd scripts && ./script.sh stop
Expand Down
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ services:
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
environment:
- "discovery.type=single-node"
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
networks:
- es-net
ports:
Expand Down
10 changes: 8 additions & 2 deletions scripts/script.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
IMAGE_NAME=elastic-container
DEFAULT_ES_VERSION=7.16.2

start() {
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.16.2
ES_VERSION=$1
if [ -z "${ES_VERSION}" ]; then
ES_VERSION=${DEFAULT_ES_VERSION}
fi

docker pull docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION}

docker rm ${IMAGE_NAME} 2> /dev/null
docker run -d --name "${IMAGE_NAME}" -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.10.0
docker run -d --name "${IMAGE_NAME}" -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION}

# Wait elastic cluster to start
echo "Waiting Elasticsearch cluster to start..."
Expand Down

0 comments on commit c61acb5

Please sign in to comment.