diff --git a/.github/workflows/container_check.yml b/.github/workflows/container_check.yml new file mode 100644 index 0000000..d084f97 --- /dev/null +++ b/.github/workflows/container_check.yml @@ -0,0 +1,50 @@ +name: Container collection check + +on: + push: + paths: + - 'env_file' + - 'Dockerfile' + - 'docker-compose.yml' + - 'src/**' + workflow_run: + workflows: [ PEP8 Style Guide Enforcement & Requirements check ] + types: [ completed ] + +jobs: + docker_check: + runs-on: ubuntu-22.04 + 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}/g" .env + + - 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 30 + + - 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)." + 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 -e "\nCHECK COMPLETE" + exit 0 + else + echo -e "\nCHECK FAILED" + exit 1 + fi diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 7f71ba8..274af42 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -1,27 +1,32 @@ -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 - - 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') diff --git a/docker-compose.yml b/docker-compose.yml index 35c6ce6..7c31740 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,6 +39,11 @@ services: container_name: "whisper-asr-webservice" restart: unless-stopped env_file: .env + environment: + - ASR_MODEL_PATH=/data/whisper + volumes: + - whisper-data:/data/whisper/ + zookeeper: image: wurstmeister/zookeeper @@ -55,3 +60,4 @@ services: volumes: db-data: + whisper-data: diff --git a/env_file b/env_file index 35bf246..8d4cec0 100644 --- a/env_file +++ b/env_file @@ -13,4 +13,4 @@ KAFKA_CREATE_TOPICS=stt:1:1,tts:1:1 KAFKA_LISTENERS=INTERNAL://0.0.0.0:9092,OUTSIDE://0.0.0.0:9094 KAFKA_ADVERTISED_LISTENERS=INTERNAL://kafka:9092,OUTSIDE://localhost:9094 KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,OUTSIDE:PLAINTEXT -KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL \ No newline at end of file +KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL diff --git a/src/requirements.txt b/src/requirements.txt index 4c7c420..844bcae 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