Fix 152 #1029
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
name: Check app | |
on: | |
pull_request: | |
branches: | |
- develop | |
- master | |
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 |