-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #310 from noharm-ai/develop
Add deploy config
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Deploy Test (Manual) | ||
on: workflow_dispatch | ||
|
||
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@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Setup Python | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -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@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Config Zappa | ||
run: | | ||
echo '${{ secrets.ZAPPA_TEST_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 test -q |
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