also deploy release #742
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 🧪 Test and build Docker image | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'website/**' | |
- '.github/workflows/website.yml' | |
pull_request: | |
branches: | |
- master | |
paths-ignore: | |
- 'website/**' | |
- '.github/workflows/website.yml' | |
workflow_dispatch: | |
jobs: | |
docker-tests: | |
name: Run tests and deploy demo data | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "build dockerfile" | |
run: docker build -f .docker/Dockerfile --tag opengisch/signalo:unstable . | |
- name: "initialize container" | |
run: | | |
docker run -d -p 5432:5432 --name signalo -v $(pwd):/src opengisch/signalo:unstable | |
docker exec signalo init_db.sh wait | |
docker exec -e PGSERVICE=pg_signalo_demo signalo init_db.sh build -d | |
docker exec -e PGSERVICE=pg_signalo_demo signalo /src/scripts/all-signs.py | |
# - uses: actions/setup-node@v3 | |
# with: | |
# node-version: '18' | |
- name: "test data model" | |
run: docker exec signalo pytest | |
- name: "test images" | |
run: docker exec signalo /src/test/official_sign_images.sh | |
- name: "test changelog" | |
run: docker exec signalo /src/test/test-changelog.sh | |
# - name: "schema lint" | |
# run: | | |
# npm i --no-fund -g schemalint | |
# cp .schemalintrc.js.template .schemalintrc.js | |
# schemalint | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: "push to dockerhub" | |
if: github.event_name != 'pull_request' | |
run: | | |
docker push opengisch/signalo:unstable | |
- name: Deploy Demo DB | |
if: github.event_name != 'pull_request' | |
env: | |
DEMO_DB_HOST: ${{ secrets.DEMO_DB_HOST }} | |
DEMO_DB_USER: ${{ secrets.DEMO_DB_USER }} | |
DEMO_DB_PORT: ${{ secrets.DEMO_DB_PORT }} | |
DEMO_DB_TESTING: ${{ secrets.DEMO_DB_TESTING }} | |
DEMO_DB_PASSWORD: ${{ secrets.DEMO_DB_PASSWORD }} | |
run: | | |
BACKUP_FILE=signalo-testing-db-dump-with-demo.backup | |
CONNECTION="--host=${DEMO_DB_HOST} --username=${DEMO_DB_USER} --port=${DEMO_DB_PORT} --dbname=${DEMO_DB_TESTING}" | |
export PGPASSWORD=${DEMO_DB_PASSWORD} | |
docker exec signalo pg_dump --format custom --exclude-schema=public --blobs --compress 5 --file ${BACKUP_FILE} signalo | |
psql ${CONNECTION} -c "DROP SCHEMA IF EXISTS signalo_app CASCADE; DROP SCHEMA IF EXISTS signalo_db CASCADE;" | |
pg_restore ${CONNECTION} --exit-on-error --clean --if-exists --no-owner ${BACKUP_FILE} | |
psql ${CONNECTION} -v EXIT_ON_ERROR=on -f ./datamodel/roles/setup.sql | |
- name: "failure logs" | |
if: failure() | |
run: | | |
docker logs signalo |