-
Notifications
You must be signed in to change notification settings - Fork 21
74 lines (71 loc) · 1.81 KB
/
healthcheck.yaml
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
name: Check app
on:
pull_request:
branches:
- develop
- master
- experimental
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: lomaya_baryery_db_local
POSTGRES_USER: postgres
DB_HOST: localhost
DB_PORT: 5432
APPLICATION_URL: 'http://localhost:8080/'
HEALTHCHECK_API_URL: 'http://localhost:8080/ping'
HEALTHCHECK_URL: 'http://localhost:8080/healthcheck'
jobs:
healthcheck:
name: Check app
runs-on: ubuntu-latest
environment:
name: healthcheck
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: ${{env.POSTGRES_PASSWORD}}
POSTGRES_DB: ${{env.POSTGRES_DB}}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
-
name: Check out the repo
uses: actions/checkout@v3
-
name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
-
name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.2
-
name: Install Dependencies
run: poetry install
-
name: Create .env file
run: |
touch .env
echo BOT_TOKEN=${{ secrets.TELEGRAM_BOT_TOKEN }} >> .env
echo APPLICATION_URL=$APPLICATION_URL >> .env
echo HEALTHCHECK_API_URL=$HEALTHCHECK_API_URL >> .env
-
name: Alembic Upgrade
run: poetry run alembic upgrade head
-
name: Run App
run: timeout 20 poetry run python run.py &
-
name: Request healthcheck endpoint
uses: im-open/[email protected]
with:
url: ${{env.HEALTHCHECK_URL}}
fail-on-bad-status: true