Skip to content

Commit

Permalink
Merge pull request #23 from Studio-Yandex-Practicum/bug/fix_workflow_…
Browse files Browse the repository at this point in the history
…deployment

Bug/fix workflow deployment
  • Loading branch information
Marker-bit authored Aug 17, 2024
2 parents 2a8a134 + b4ade82 commit 710b8ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 49 deletions.
50 changes: 3 additions & 47 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,8 @@ on:
- dev

jobs:
# test:
# runs-on: ubuntu-24.04

# services:
# postgres:
# image: postgres:16
# env:
# POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
# POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
# POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
# ports:
# - 5432:5432
# options: >-
# --health-cmd "pg_isready -U ${{ secrets.POSTGRES_USER }}"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5

# adminer:
# image: adminer:4.8.1
# ports:
# - 8080:8080

# steps:
# - name: Checkout code
# uses: actions/checkout@v3

# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: '3.12'

# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r requirements.txt

# - name: Run tests
# env:
# DATABASE_URL: postgres://postgres:${{ secrets.POSTGRES_PASSWORD }}@localhost:5432/${{ secrets.POSTGRES_DB }}
# run: |
# pytest

deploy:
runs-on: ubuntu-24.04
# needs: test
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -64,13 +20,13 @@ jobs:
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
script: |
cd /Privet_Logoped_team_4/
cd /home/yc-user/Privet_Logoped_team_4/
git pull origin dev
source /Privet_Logoped_team_4/src/telegram_bot/venv/bin/activate
source /home/yc-user/Privet_Logoped_team_4/src/telegram_bot/venv/bin/activate
pip install -r src/telegram_bot/requirements.txt
alembic upgrade head
deactivate
source /Privet_Logoped_team_4/src/vk_bot/venv/bin/activate
source /home/yc-user/Privet_Logoped_team_4/src/vk_bot/venv/bin/activate
pip install -r src/vk_bot/requirements.txt
deactivate
sudo systemctl restart docker-compose-db.service
Expand Down
12 changes: 10 additions & 2 deletions alembic/versions/2fa551197c57_add_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ def upgrade() -> None:
)
op.add_column(
"tg_users",
sa.Column("notifications_enabled", sa.Boolean(), nullable=False, default=False),
sa.Column("notifications_enabled", sa.Boolean(), default=False),
)
op.execute(
'UPDATE tg_users SET notifications_enabled = False WHERE notifications_enabled IS NULL'
)
op.alter_column('tg_users', 'notifications_enabled', nullable=False)
op.add_column(
"vk_users", sa.Column("notificate_at", sa.Integer(), nullable=True)
)
Expand All @@ -71,8 +75,12 @@ def upgrade() -> None:
)
op.add_column(
"vk_users",
sa.Column("notifications_enabled", sa.Boolean(), nullable=False, default=False),
sa.Column("notifications_enabled", sa.Boolean(), default=False),
)
op.execute(
'UPDATE vk_users SET notifications_enabled = False WHERE notifications_enabled IS NULL'
)
op.alter_column('vk_users', 'notifications_enabled', nullable=False)
# ### end Alembic commands ###


Expand Down

0 comments on commit 710b8ae

Please sign in to comment.