-
Notifications
You must be signed in to change notification settings - Fork 7
58 lines (57 loc) · 1.94 KB
/
deploy-prod.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
name: Deploy Production
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11.6
env:
POSTGRES_USER: postgres
POSTGRES_DB: noharm
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Setup Python
run: |
python -m pip install --upgrade pip
pip install -q -r requirements.txt
- name: Setup PostgreSQL
run: |
git clone https://github.com/noharm-ai/database
psql -h localhost -U postgres -d noharm -a -f database/noharm-public.sql -v ON_ERROR_STOP=1
psql -h localhost -U postgres -d noharm -a -f database/noharm-create.sql -v ON_ERROR_STOP=1
psql -h localhost -U postgres -d noharm -a -f database/noharm-newuser.sql -v ON_ERROR_STOP=1
psql -h localhost -U postgres -d noharm -a -f database/noharm-triggers.sql -v ON_ERROR_STOP=1
psql -h localhost -U postgres -d noharm -a -f database/noharm-insert.sql -v ON_ERROR_STOP=1
- name: Run Python Tests
run: python -m pytest -v
deploy:
needs: [build]
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Config Zappa
run: |
echo '${{ secrets.ZAPPA_PROD_SETTINGS }}' > zappa_settings.json
mkdir ~/.aws/
echo "[default]
aws_access_key_id = ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key = ${{ secrets.AWS_SECRET_ACCESS_KEY }}
region = sa-east-1" > ~/.aws/credentials
- name: Deploy Zappa
run: |
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements-prod.txt
zappa update homolog -q