New feature #13
Workflow file for this run
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
# Test Run the bot to start up with no exceptions. | |
name: Telegram Run Bot Test | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./ | |
strategy: | |
matrix: | |
python-version: [3.11] | |
env: | |
BOT_TOKEN: ${{secrets.BOT_TOKEN}} | |
KIWI_API_KEY_STD: ${{secrets.KIWI_API_KEY_STD}} | |
KIWI_API_KEY_MULTICITY: ${{secrets.KIWI_API_KEY_MULTICITY}} | |
DATABASE_PATH: ${{secrets.DATABASE_PATH}} | |
ADMINISTRATORS: ${{secrets.ADMINISTRATORS}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{matrix.python-version}} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ./requirements.txt | |
- name: Run Bot Test | |
run: | | |
python ./bot.py > output.log 2>&1 & | |
bot_pid=$! | |
sleep 10 | |
kill $bot_pid | |
if grep -q "telegram.ext.Application - INFO - Application started" output.log; then | |
echo "Bot started successfully with no errors." | |
exit 0 | |
elif grep -q "WARNING\|ERROR\|EXCEPTION" output.log; then | |
echo "Errors or warnings found in Bot logs." | |
exit 1 | |
else | |
echo "No relevant messages found in logs." | |
exit 1 | |
fi |