From 7297eef3112c022f512ed341d918de1c74734170 Mon Sep 17 00:00:00 2001 From: feyhoa Date: Thu, 25 Apr 2024 01:18:15 +0300 Subject: [PATCH 01/15] update requests --- src/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/requirements.txt b/src/requirements.txt index f3cd12c..3d8fe09 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -5,7 +5,7 @@ pymongo==3.11.3 pymystem3==0.2.0 python-telegram-bot==13.4.1 pytz==2024.1 -Requests==2.30.0 +Requests==2.31.0 schedule==1.1.0 scipy==1.13.0 pip==23.1.2 \ No newline at end of file From c702ecb2a6fe2629f6f87f1c5936497654bcd40e Mon Sep 17 00:00:00 2001 From: feyhoa Date: Thu, 25 Apr 2024 01:37:13 +0300 Subject: [PATCH 02/15] add asr to volume --- docker-compose.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 0079639..a0134e6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,6 +34,12 @@ services: container_name: "whisper-asr-webservice" restart: unless-stopped env_file: .env + environment: + - ASR_MODEL_PATH=/data/whisper + volumes: + - whisper-data:/data/whisper/ + volumes: db-data: + whisper-data: From afa6b4487449dddeade5e4f1095e99232a5137c9 Mon Sep 17 00:00:00 2001 From: feyhoa Date: Fri, 17 May 2024 13:11:09 +0300 Subject: [PATCH 03/15] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=81=D0=BE=D0=B1=D0=B8=D1=80=D0=B0=D0=B5=D0=BC?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B8=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B5=D0=B9?= =?UTF-8?q?=D0=BD=D0=B5=D1=80=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/container_check.yml | 29 ++++++++++++++++++++ .github/workflows/linter.yml | 39 ++++++++++++++------------- 2 files changed, 49 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/container_check.yml diff --git a/.github/workflows/container_check.yml b/.github/workflows/container_check.yml new file mode 100644 index 0000000..7c55d82 --- /dev/null +++ b/.github/workflows/container_check.yml @@ -0,0 +1,29 @@ +name: Container collection check + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Create .env + env: + TELEGRAM_TOKEN: ${{ secrets.TEST_BOT_TOKEN }} + run: | + cp env_file .env + sed -i -e 's/PasteYourTelegramToken/$TELEGRAM_TOKEN' .env + cat .env + +# - name: Build images +# run: | +# docker compose build +# +# - name: Start containers +# run: | +# docker compose up -d +# sleep 20 +# +# - name: Check containers +# run: | diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 7f71ba8..9ada78b 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -6,22 +6,23 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.10 - uses: actions/setup-python@v2 - with: - python-version: "3.10" - - name: Installation of testing utilities (Pipreqs, Pylint) - run: | - python -m pip install --upgrade pip - pip install pipreqs pylint - - name: Dependency check (Run Pipreqs) - run: | - pipreqs --savepath src/reqs-check.txt --mode no-pin src/ - python requirements_check.py src/requirements.txt src/reqs-check.txt - - name: Install Dependencies - run: | - pip install -r src/requirements.txt - - name: Style check (Run Pylint) - run: | - pylint $(git ls-files 'src/*.py') + - uses: actions/checkout@v2 + + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Installation of testing utilities (Pipreqs, Pylint) + run: | + python -m pip install --upgrade pip + pip install pipreqs pylint + - name: Dependency check (Run Pipreqs) + run: | + pipreqs --savepath src/reqs-check.txt --mode no-pin src/ + python requirements_check.py src/requirements.txt src/reqs-check.txt + - name: Install Dependencies + run: | + pip install -r src/requirements.txt + - name: Style check (Run Pylint) + run: | + pylint $(git ls-files 'src/*.py') From ee172e365783544da59d083962b2df4d22eda903 Mon Sep 17 00:00:00 2001 From: feyhoa Date: Fri, 17 May 2024 13:16:28 +0300 Subject: [PATCH 04/15] update check --- .github/workflows/container_check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/container_check.yml b/.github/workflows/container_check.yml index 7c55d82..48dbf5c 100644 --- a/.github/workflows/container_check.yml +++ b/.github/workflows/container_check.yml @@ -13,7 +13,7 @@ jobs: TELEGRAM_TOKEN: ${{ secrets.TEST_BOT_TOKEN }} run: | cp env_file .env - sed -i -e 's/PasteYourTelegramToken/$TELEGRAM_TOKEN' .env + sed -i 's/PasteYourTelegramToken/$TELEGRAM_TOKEN' .env cat .env # - name: Build images From 070493588e92db0fb46b5ab9274a48a872f2fb58 Mon Sep 17 00:00:00 2001 From: feyhoa Date: Fri, 17 May 2024 13:26:05 +0300 Subject: [PATCH 05/15] add sed to os --- .github/workflows/container_check.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/container_check.yml b/.github/workflows/container_check.yml index 48dbf5c..eb3f46d 100644 --- a/.github/workflows/container_check.yml +++ b/.github/workflows/container_check.yml @@ -8,6 +8,10 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Install utilities + run: | + sudo apt-get install sed + - name: Create .env env: TELEGRAM_TOKEN: ${{ secrets.TEST_BOT_TOKEN }} From a7aabf36de1d46e859f71ac910ea7cf855bbdeee Mon Sep 17 00:00:00 2001 From: feyhoa Date: Fri, 17 May 2024 13:30:03 +0300 Subject: [PATCH 06/15] update actions --- .github/workflows/container_check.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/container_check.yml b/.github/workflows/container_check.yml index eb3f46d..767325e 100644 --- a/.github/workflows/container_check.yml +++ b/.github/workflows/container_check.yml @@ -8,16 +8,12 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install utilities - run: | - sudo apt-get install sed - - name: Create .env env: TELEGRAM_TOKEN: ${{ secrets.TEST_BOT_TOKEN }} run: | cp env_file .env - sed -i 's/PasteYourTelegramToken/$TELEGRAM_TOKEN' .env + sed -i.bak "s/PasteYourTelegramToken/${TELEGRAM_TOKEN}" .env cat .env # - name: Build images From 5091dd4c98b46a1679478ad25e7e56cf16c9b2f0 Mon Sep 17 00:00:00 2001 From: feyhoa Date: Fri, 17 May 2024 13:42:38 +0300 Subject: [PATCH 07/15] test action --- .github/workflows/container_check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/container_check.yml b/.github/workflows/container_check.yml index 767325e..5467f42 100644 --- a/.github/workflows/container_check.yml +++ b/.github/workflows/container_check.yml @@ -10,10 +10,10 @@ jobs: - name: Create .env env: - TELEGRAM_TOKEN: ${{ secrets.TEST_BOT_TOKEN }} + TELEGRAM_TOKEN: abcd run: | cp env_file .env - sed -i.bak "s/PasteYourTelegramToken/${TELEGRAM_TOKEN}" .env + sed -i -e "s/PasteYourTelegramToken/${TELEGRAM_TOKEN}/g" .env cat .env # - name: Build images From 9ccd565aca03e71d7ee42d371140f3d79e5e44eb Mon Sep 17 00:00:00 2001 From: feyhoa Date: Fri, 17 May 2024 13:46:50 +0300 Subject: [PATCH 08/15] add secrets, fix pylint --- .github/workflows/container_check.yml | 26 +++++++++++++------------- src/databases/db.py | 1 + 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/container_check.yml b/.github/workflows/container_check.yml index 5467f42..82ef595 100644 --- a/.github/workflows/container_check.yml +++ b/.github/workflows/container_check.yml @@ -10,20 +10,20 @@ jobs: - name: Create .env env: - TELEGRAM_TOKEN: abcd + TELEGRAM_TOKEN: ${{ secrets.TEST_BOT_TOKEN }} run: | cp env_file .env sed -i -e "s/PasteYourTelegramToken/${TELEGRAM_TOKEN}/g" .env - cat .env -# - name: Build images -# run: | -# docker compose build -# -# - name: Start containers -# run: | -# docker compose up -d -# sleep 20 -# -# - name: Check containers -# run: | + - name: Build images + run: | + docker compose build + + - name: Start containers + run: | + docker compose up -d + sleep 20 + + - name: Check containers + run: | + echo "Some checks needed" \ No newline at end of file diff --git a/src/databases/db.py b/src/databases/db.py index e857a4a..2840b9e 100644 --- a/src/databases/db.py +++ b/src/databases/db.py @@ -447,6 +447,7 @@ def get_users_not_finish_survey(): survey_progress = get_survey_progress(user, last_focus) if survey_progress.need_answer: list_survey_progress = SurveyProgress.objects.raw({'survey_id': last_focus}) + start_time, time_not_finish = None, None for i in list_survey_progress: if i.user.id == user.id and i.survey_step == 0: start_time = i.time_send_question From bf3c7f7f97cb7772d432ee6bc7ee948fb4a67e81 Mon Sep 17 00:00:00 2001 From: feyhoa Date: Fri, 17 May 2024 13:56:40 +0300 Subject: [PATCH 09/15] update pulling --- .github/workflows/container_check.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/container_check.yml b/.github/workflows/container_check.yml index 82ef595..66b2f97 100644 --- a/.github/workflows/container_check.yml +++ b/.github/workflows/container_check.yml @@ -15,9 +15,10 @@ jobs: cp env_file .env sed -i -e "s/PasteYourTelegramToken/${TELEGRAM_TOKEN}/g" .env - - name: Build images + - name: Pull and Build images run: | - docker compose build + docker compose pull -q + docker compose build -q - name: Start containers run: | From 7632578dc86dc9be84f8553e0b5351be635375b9 Mon Sep 17 00:00:00 2001 From: feyhoa Date: Fri, 17 May 2024 14:02:21 +0300 Subject: [PATCH 10/15] disable quiet mode --- .github/workflows/container_check.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/container_check.yml b/.github/workflows/container_check.yml index 66b2f97..7cafc2f 100644 --- a/.github/workflows/container_check.yml +++ b/.github/workflows/container_check.yml @@ -15,10 +15,13 @@ jobs: cp env_file .env sed -i -e "s/PasteYourTelegramToken/${TELEGRAM_TOKEN}/g" .env - - name: Pull and Build images + - name: Pull images run: | - docker compose pull -q - docker compose build -q + docker compose pull --ignore-buildable + + - name: Build images + run: | + docker compose build - name: Start containers run: | From 01abccadd109096bc628f7af17258caa6133f7d3 Mon Sep 17 00:00:00 2001 From: feyhoa Date: Fri, 17 May 2024 14:08:32 +0300 Subject: [PATCH 11/15] start with build, update wait time --- .github/workflows/container_check.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/container_check.yml b/.github/workflows/container_check.yml index 7cafc2f..43b9651 100644 --- a/.github/workflows/container_check.yml +++ b/.github/workflows/container_check.yml @@ -15,18 +15,18 @@ jobs: cp env_file .env sed -i -e "s/PasteYourTelegramToken/${TELEGRAM_TOKEN}/g" .env - - name: Pull images - run: | - docker compose pull --ignore-buildable - - name: Build images run: | docker compose build + - name: Pull images + run: | + docker compose pull --ignore-buildable + - name: Start containers run: | docker compose up -d - sleep 20 + sleep 30 - name: Check containers run: | From 786a78465094a646e97402fe8e83a4f4ebfc76bf Mon Sep 17 00:00:00 2001 From: feyhoa Date: Fri, 17 May 2024 14:38:23 +0300 Subject: [PATCH 12/15] update runs on statement --- .github/workflows/container_check.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/container_check.yml b/.github/workflows/container_check.yml index 43b9651..9f7bc82 100644 --- a/.github/workflows/container_check.yml +++ b/.github/workflows/container_check.yml @@ -1,9 +1,18 @@ name: Container collection check -on: [push] +on: + push: + paths: + - 'env_file' + - 'Dockerfile' + - 'docker-compose.yml' + - 'src/**' + workflow_run: + workflows: [PEP8 Style Guide Enforcement \ Requirements check] + types: [completed] jobs: - build: + docker_check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From c7f4df9c67729436d5eadf76905a042b453a9610 Mon Sep 17 00:00:00 2001 From: feyhoa Date: Thu, 13 Jun 2024 21:56:33 +0300 Subject: [PATCH 13/15] add docker ps check --- .github/workflows/container_check.yml | 16 ++++++++++++---- .github/workflows/linter.yml | 8 ++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/container_check.yml b/.github/workflows/container_check.yml index 9f7bc82..888b99b 100644 --- a/.github/workflows/container_check.yml +++ b/.github/workflows/container_check.yml @@ -8,12 +8,12 @@ on: - 'docker-compose.yml' - 'src/**' workflow_run: - workflows: [PEP8 Style Guide Enforcement \ Requirements check] - types: [completed] + workflows: [ PEP8 Style Guide Enforcement & Requirements check ] + types: [ completed ] jobs: docker_check: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 @@ -39,4 +39,12 @@ jobs: - name: Check containers run: | - echo "Some checks needed" \ No newline at end of file + echo "Running containers <$(docker ps -a --filter "status=running" --format "{{.ID}}" | wc -l)> of $(docker ps -a --format "{{.ID}}" | wc -l)" + docker ps -a --filter "status=running" --format "{{.ID}}\t{{.Names}}" + if [[ "$(docker ps -a --filter "status=running" --format "{{.ID}}" | wc -l)" -eq "$(docker ps -a --format "{{.ID}}" | wc -l)" ]]; then + echo "CHECK COMPLETE" + exit 0 + else + echo "CHECK FAILED" + exit 1 + fi diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 9ada78b..274af42 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -1,9 +1,9 @@ -name: PEP8 Style Guide Enforcement \ Requirements check +name: PEP8 Style Guide Enforcement & Requirements check on: [push] jobs: - build: + base_check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -12,17 +12,21 @@ jobs: uses: actions/setup-python@v2 with: python-version: "3.10" + - name: Installation of testing utilities (Pipreqs, Pylint) run: | python -m pip install --upgrade pip pip install pipreqs pylint + - name: Dependency check (Run Pipreqs) run: | pipreqs --savepath src/reqs-check.txt --mode no-pin src/ python requirements_check.py src/requirements.txt src/reqs-check.txt + - name: Install Dependencies run: | pip install -r src/requirements.txt + - name: Style check (Run Pylint) run: | pylint $(git ls-files 'src/*.py') From 8412ba2cc1a00a8ffa07e022f097c9321b970562 Mon Sep 17 00:00:00 2001 From: feyhoa Date: Thu, 13 Jun 2024 21:59:54 +0300 Subject: [PATCH 14/15] action check --- env_file | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env_file b/env_file index 7d95099..753a1d1 100644 --- a/env_file +++ b/env_file @@ -7,4 +7,4 @@ LANGUAGE=ru SAMPLE_RATE=48000 SPEAKER=baya ASR_ENGINE=openai_whisper -ASR_MODEL=base \ No newline at end of file +ASR_MODEL=base From bc25816bc3b0290c5780782da5ef4c01f1770419 Mon Sep 17 00:00:00 2001 From: feyhoa Date: Thu, 13 Jun 2024 22:05:03 +0300 Subject: [PATCH 15/15] fix strings --- .github/workflows/container_check.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/container_check.yml b/.github/workflows/container_check.yml index 888b99b..d084f97 100644 --- a/.github/workflows/container_check.yml +++ b/.github/workflows/container_check.yml @@ -39,12 +39,12 @@ jobs: - name: Check containers run: | - echo "Running containers <$(docker ps -a --filter "status=running" --format "{{.ID}}" | wc -l)> of $(docker ps -a --format "{{.ID}}" | wc -l)" + echo "Running containers <$(docker ps -a --filter "status=running" --format "{{.ID}}" | wc -l)> of $(docker ps -a --format "{{.ID}}" | wc -l)." docker ps -a --filter "status=running" --format "{{.ID}}\t{{.Names}}" if [[ "$(docker ps -a --filter "status=running" --format "{{.ID}}" | wc -l)" -eq "$(docker ps -a --format "{{.ID}}" | wc -l)" ]]; then - echo "CHECK COMPLETE" + echo -e "\nCHECK COMPLETE" exit 0 else - echo "CHECK FAILED" + echo -e "\nCHECK FAILED" exit 1 fi