-
Notifications
You must be signed in to change notification settings - Fork 4
73 lines (66 loc) · 2.37 KB
/
bin-check.yml
File metadata and controls
73 lines (66 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: bin-check.yml
on:
push:
branches:
- main
tags:
- "*"
pull_request:
workflow_dispatch:
# least privilege as default, should be overridden per job if necessary
permissions:
contents: read
jobs:
dump_data:
name: Test dump_data.sh
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis:16-3.5
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up backend environment
uses: maykinmedia/setup-django-backend@a9abe0987130ed667fa09ce177a5ae0bd153aed1 # v1.3
with:
apt-packages: "postgresql-client"
python-version: "3.12"
optimize-postgres: "no"
setup-node: "no"
- name: Run setup db & dump data
run: |
createdb -h localhost -U postgres openklant
python src/manage.py migrate
src/manage.py loaddata klantinteracties contactgegevens
SCRIPTPATH=bin DUMP_FILE=dump.sql bin/dump_data.sh --combined
SCRIPTPATH=bin TAR_FILE=dump.tar bin/dump_data.sh --csv
env:
DB_PASSWORD: ""
DB_USER: postgres
DB_NAME: openklant
DB_HOST: localhost
SECRET_KEY: secret
DJANGO_SETTINGS_MODULE: openklant.conf.ci
ALLOWED_HOSTS: localhost,127.0.0.1
- name: validate dump
run: |
grep "COPY public.klantinteracties_digitaaladres" dump.sql
grep "COPY public.contactgegevens_persoon" dump.sql
! grep "COPY public.auth_group" dump.sql
- name: load into other db
run: |
createdb -h localhost -U postgres test
psql -v ON_ERROR_STOP=1 -h localhost -U postgres -d test -f dump.sql
- name: validate csv dump
run: |
tar -xf dump.tar
test -f klantinteracties_digitaaladres.csv || exit 1
! test -f auth_group.csv || exit 1
grep "id,uuid,soort_digitaal_adres,adres,omschrijving,betrokkene_id,partij_id,is_standaard_adres,referentie,verificatie_datum" klantinteracties_digitaaladres.csv