Skip to content

Create vw_reaches_with_blank_connections.sql #634

Create vw_reaches_with_blank_connections.sql

Create vw_reaches_with_blank_connections.sql #634

name: Docker
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
release:
types: ['prereleased', 'released']
jobs:
docker-tests:
name: Docker
runs-on: ubuntu-22.04
strategy:
matrix:
# postgres-postgis version, see available tags https://hub.docker.com/r/postgis/postgis/tags
pgis:
# WARNING: if changing this, make sure tu update `pgis_stable` below
- 13-3.2
- 14-3.2
#- 15-3.3 # Postgis 3.3 requires QGEP datamodel adaptations
# See https://github.com/QGEP/QGEP/issues/825
fail-fast: false
env:
# which pgis version to use for :tag images and to generate the dumps attached to the release (must be in the matrix above)
pgis_stable: "14-3.2"
steps:
- uses: actions/checkout@v3
- name: "assert version is up to date"
run: |
LAST_VERSION=$(ls delta | sort -r | sed '/^delta_/!d' | head -n 1 | cut -d_ -f2)
CUR_VERSION=$(cat system/CURRENT_VERSION.txt)
[[ "${LAST_VERSION}" == "${CUR_VERSION}" ]] || (echo "Version mismatch ${LAST_VERSION} != ${CUR_VERSION}" && exit 1)
- name: "build dockerfile"
run: docker build -f .docker/Dockerfile --build-arg POSTGIS_VERSION=${{ matrix.pgis }} --tag opengisch/qgep_datamodel:${GITHUB_REF##*/}-${{ matrix.pgis }} .
- name: "initialize qgep container"
run: docker run -d -p 5432:5432 --name qgep opengisch/qgep_datamodel:${GITHUB_REF##*/}-${{ matrix.pgis }}
- name: "wait for qgep container"
run: docker exec qgep init_qgep.sh wait
timeout-minutes: 10
- name: "run tests on qgep_build (structure)"
run: |
docker start qgep
# Run tests that depend on data model. Tests that require demo data are ignored and run below in qgep_prod
docker exec -e PGSERVICE=qgep_build qgep pytest --ignore test/test_import.py --ignore test/test_swmm.py
- name: "run tests on qgep_prod (production)"
run: |
docker start qgep
docker exec -e PGSERVICE=qgep_prod qgep pytest
- name: "dockerhub login"
if: github.event_name != 'pull_request'
run: |
docker login --username "${{ secrets.DOCKERHUB_USERNAME }}" --password "${{ secrets.DOCKERHUB_PASSWORD }}"
- name: "push to dockerhub"
if: github.event_name != 'pull_request'
run: |
docker push opengisch/qgep_datamodel:${GITHUB_REF##*/}-${{ matrix.pgis }}
- name: "push to dockerhub (:tag)"
if: github.event_name != 'pull_request' && matrix.pgis == env.pgis_stable && github.ref != 'refs/heads/master'
run: |
docker tag opengisch/qgep_datamodel:${GITHUB_REF##*/}-${{ matrix.pgis }} opengisch/qgep_datamodel:${GITHUB_REF##*/}
docker push opengisch/qgep_datamodel:${GITHUB_REF##*/}
- name: "push to dockerhub (:latest)"
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
run: |
docker tag opengisch/qgep_datamodel:${GITHUB_REF##*/}-${{ matrix.pgis }} opengisch/qgep_datamodel:latest
docker push opengisch/qgep_datamodel:latest
- name: "create dumps"
if: github.event_name != 'pull_request' && matrix.pgis == env.pgis_stable
run: |
CI_TAG=${GITHUB_REF#refs/*/} .deploy/create-dumps.py
ls artifacts
env:
PGHOST: localhost
PGPASSWORD: postgres
PGUSER: postgres
- uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release' && matrix.pgis == env.pgis_stable
with:
file: artifacts/*
file_glob: true
overwrite: true
- name: "failure logs"
if: failure()
run: |
docker logs qgep
# TMATE disabled for now as it hangs process, we should do this instead :
# https://github.com/marketplace/actions/debugging-with-tmate#manually-triggered-debug
# - name: Setup tmate session
# if: failure()
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true