-
Notifications
You must be signed in to change notification settings - Fork 7
66 lines (65 loc) · 2.28 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
59
60
61
62
63
64
65
66
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.9
- 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: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: sa-east-1
- name: Run Python Tests
env:
CACHE_BUCKET_NAME: ${{ secrets.CACHE_BUCKET_NAME }}
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.9
- 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