forked from opendp/smartnoise-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (95 loc) · 3.09 KB
/
postgres.yml
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: PostgreSQL Integration Tests
on:
pull_request:
paths:
- 'sql/tests/**'
- 'sql/snsql/**'
- 'sql/pyproject.toml'
workflow_dispatch:
jobs:
container-job:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.9]
max-parallel: 5
steps:
- uses: actions/checkout@v2
- name: Generate random password
shell: bash -l {0}
run: |
export RANDPASS=pgpass$RANDOM
echo "export PGPASSWORD=$RANDPASS" >> pass.sh
echo "export POSTGRES_PASSWORD=$RANDPASS" >> pass.sh
- name: Install postgres
shell: bash -l {0}
run: |
sudo apt-get update
sudo apt-get --yes install postgresql-client postgresql
sudo service postgresql start
- name: Set up miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
auto-update-conda: true
auto-activate-base: true
python-version: ${{ matrix.python-version }}
- name: Configure postgres password
shell: bash -l {0}
run: |
source pass.sh
sudo -u postgres psql -U postgres -d postgres -c "alter user postgres with password '$PGPASSWORD';"
- name: Upgrade pip
shell: bash -l {0}
run: |
conda install pip
conda update pip
- name: Setup SDK
shell: bash -l {0}
run: |
cd sql
pip install --no-cache-dir -r tests/requirements.txt
pip install --no-cache-dir -r tests/setup/postgres/requirements.txt
pip install --no-cache-dir .
pip install --no-cache-dir opendp-smartnoise-core # temporary
- name: Download test datasets
shell: bash -l {0}
run: |
cd sql
python tests/setup/download.py
- name: Install PUMS
shell: bash -l {0}
run: |
source pass.sh
cd sql
cd tests/setup/postgres/PUMS
source install.sh
env:
POSTGRES_HOST: localhost
- name: Verify database counts
shell: bash -l {0}
run: |
source pass.sh
psql -U postgres -h $POSTGRES_HOST -d pums -c "select count(*) FROM pums.pums"
psql -U postgres -h $POSTGRES_HOST -d pums -c "select count(*) FROM pums.pums_large"
psql -U postgres -h $POSTGRES_HOST -d pums_pid -c "select count(*) FROM pums.pums"
psql -U postgres -h $POSTGRES_HOST -d pums_dup -c "select count(*) FROM pums.pums"
psql -U postgres -h $POSTGRES_HOST -d pums_null -c "select count(*) FROM pums.pums"
env:
POSTGRES_HOST: localhost
- name: Check database connections test fixture
shell: bash -l {0}
run: |
source pass.sh
cd sql
mkdir ~/.smartnoise
cp tests/setup/postgres/connections-unit.yaml ~/.smartnoise
python tests/setup/download.py
- name: Test SDK
shell: bash -l {0}
run: |
source pass.sh
cd sql
export SKIP_PANDAS=1
pytest tests