mirror of
https://github.com/xbgmsharp/postgsail.git
synced 2025-09-17 19:27:49 +00:00
Update github action test
This commit is contained in:
33
.github/workflows/test.yml
vendored
33
.github/workflows/test.yml
vendored
@@ -18,41 +18,36 @@ jobs:
|
|||||||
- name: Pull Docker image
|
- name: Pull Docker image
|
||||||
run: docker pull xbgmsharp/timescaledb-postgis
|
run: docker pull xbgmsharp/timescaledb-postgis
|
||||||
|
|
||||||
|
- name: Install psql
|
||||||
|
run: sudo apt install postgresql-client
|
||||||
|
|
||||||
- name: Set env
|
- name: Set env
|
||||||
run: cp .env.example .env
|
run: cp .env.example .env
|
||||||
|
|
||||||
- name: Run PostgSail
|
- name: Run PostgSail
|
||||||
# Environment variables
|
# Environment variables
|
||||||
env:
|
#env:
|
||||||
# The hostname used to communicate with the PostgreSQL service container
|
# # The hostname used to communicate with the PostgreSQL service container
|
||||||
POSTGRES_HOST: localhost
|
# POSTGRES_HOST: localhost
|
||||||
POSTGRES_PORT: 5432
|
# POSTGRES_PORT: 5432
|
||||||
POSTGRES_USER: username
|
# POSTGRES_USER: username
|
||||||
POSTGRES_PASSWORD: password
|
# POSTGRES_PASSWORD: password
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
source .env
|
source .env
|
||||||
docker-compose stop || true
|
docker-compose stop || true
|
||||||
docker-compose rm || true
|
docker-compose rm || true
|
||||||
docker-compose up -d db && sleep 15 && docker-compose up -d api && sleep 5
|
docker-compose up -d db && sleep 15 && docker-compose up -d api && sleep 5
|
||||||
for _ in {1..120}
|
|
||||||
do
|
|
||||||
if [ -z "$(docker container ls -q --filter name=api)" ]
|
|
||||||
then
|
|
||||||
echo "REST API container is not running"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
docker-compose ps -a
|
docker-compose ps -a
|
||||||
echo ${PGSAIL_API_URL}
|
echo ${PGSAIL_API_URL}
|
||||||
curl ${PGSAIL_API_URL}
|
curl ${PGSAIL_API_URL}
|
||||||
sleep 1
|
if psql -c "select 1"
|
||||||
done
|
|
||||||
if ! psql -c "select 1"
|
|
||||||
then
|
then
|
||||||
echo "Cannot connect to PostgreSQL"
|
echo "Test PostgreSQL"
|
||||||
exit 1
|
psql -c "SELECT version();"
|
||||||
|
psql -c "SELECT value is not null FROM app_settings WHERE name = 'app.version';"
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Show the logs
|
- name: Show the logs
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
|
Reference in New Issue
Block a user