From b2600950416ad03aaca2dc002ec4d29f2d113d3b Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Fri, 27 Oct 2023 16:07:50 +0200 Subject: [PATCH] Add migration test --- .github/workflows/qwc-base-db.yml | 13 +++++++++++++ test/docker-compose.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 test/docker-compose.yml diff --git a/.github/workflows/qwc-base-db.yml b/.github/workflows/qwc-base-db.yml index 1c3260e..30abe6d 100644 --- a/.github/workflows/qwc-base-db.yml +++ b/.github/workflows/qwc-base-db.yml @@ -4,7 +4,20 @@ on: [push] jobs: + test: + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@master + + - name: Set up demo database and run migrations + run: | + cd ${GITHUB_WORKSPACE}/test + docker-compose up -d qwc-postgis + docker-compose up --exit-code-from qwc-config-db-migrate + build: + needs: test runs-on: ubuntu-latest if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') steps: diff --git a/test/docker-compose.yml b/test/docker-compose.yml new file mode 100644 index 0000000..57f0f01 --- /dev/null +++ b/test/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3.4' + + +services: + + qwc-postgis: + image: sourcepole/qwc-base-db:15 # 15 refers to the Postgres major version + environment: + POSTGRES_PASSWORD: 'uefah5WateiWai1e' # TODO: Set your postgres password here! + volumes: + - ./volumes/db:/var/lib/postgresql/docker + # If you don't want/need the demo data, you can remove this line + - ./volumes/demo-data/setup-demo-data.sh:/docker-entrypoint-initdb.d/2_setup-demo-data.sh + ports: + - "127.0.0.1:5439:5432" + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 10s + + qwc-config-db-migrate: + build: + context: .. + dockerfile: Dockerfile.migrate + depends_on: + qwc-postgis: + condition: service_healthy