mirror of
https://github.com/xbgmsharp/postgsail.git
synced 2025-09-17 19:27:49 +00:00
Add github actions test
This commit is contained in:
56
.github/workflows/test.yml
vendored
Normal file
56
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
name: Test PostgSail docker & schema
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
smoketest:
|
||||||
|
name: smoketest
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out the source
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Pull Docker image
|
||||||
|
run: docker pull xbgmsharp/timescaledb-postgis
|
||||||
|
|
||||||
|
- name: Set env
|
||||||
|
run: cp .env.example .env
|
||||||
|
|
||||||
|
- name: Run PostgSail
|
||||||
|
# Environment variables
|
||||||
|
env:
|
||||||
|
# The hostname used to communicate with the PostgreSQL service container
|
||||||
|
POSTGRES_HOST: localhost
|
||||||
|
POSTGRES_PORT: 5432
|
||||||
|
POSTGRES_USER: username
|
||||||
|
POSTGRES_PASSWORD: password
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
docker-compose container stop || true
|
||||||
|
docker-compose container rm || true
|
||||||
|
docker-compose up -d db && sleep 15 && docker-compose up -d api
|
||||||
|
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
|
||||||
|
curl ${PGSAIL_API_URL}
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
if ! psql -c "select 1"
|
||||||
|
then
|
||||||
|
echo "Cannot connect to PostgreSQL"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Show the logs
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
docker-compose logs
|
Reference in New Issue
Block a user