-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (55 loc) · 1.7 KB
/
build-deploy.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
name: Build and deploy project
on: [push, pull_request]
jobs:
build:
environment: Testing
env:
DATABASE_HOSTNAME: ${{secrets.DATABASE_HOSTNAME}}
DATABASE_PORT: ${{secrets.DATABASE_PORT}}
DATABASE_NAME: ${{secrets.DATABASE_NAME}}
DATABASE_USERNAME: ${{secrets.DATABASE_USERNAME}}
DATABASE_PASSWORD: ${{secrets.DATABASE_PASSWORD}}
JWT_ALGORITHM: ${{secrets.JWT_ALGORITHM}}
JWT_SECRET_KEY: ${{secrets.JWT_SECRET_KEY}}
JWT_EXPIRATION_TIME: ${{secrets.JWT_EXPIRATION_TIME}}
services:
postgres:
image: postgres
env:
POSTGRES_DB: ${{secrets.DATABASE_NAME}}-test
POSTGRES_PASSWORD: ${{secrets.DATABASE_PASSWORD}}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
runs-on: ubuntu-latest
steps:
- name: Pulling repo
uses: actions/checkout@v2
- name: Install python
uses: actions/setup-python@v2
with:
python-version: "3.10.1"
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install python dependencies
run: pip install -r requirements.txt
- name: Run Pytest
run: pytest
deploy:
runs-on: ubuntu-latest
needs: [build]
environment:
name: Production
steps:
- name: Pulling repo
uses: actions/checkout@v2
- name: Deploy to Heroku
uses: akhileshns/[email protected]
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{secrets.HEROKU_APP_NAME}}
heroku_email: ${{secrets.HEROKU_EMAIL}}