-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (74 loc) · 2.84 KB
/
python-app.yml
File metadata and controls
82 lines (74 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
TOKEN: ${{ secrets.TOKEN }}
chat_id: ${{ secrets.CHAT_ID }}
host: ${{ secrets.HOST }}
user: ${{ secrets.USER }}
password: ${{ secrets.PASSWORD }}
db_name: ${{ secrets.DB_NAME }}
port: ${{ secrets.PORT }}
api_id: ${{ secrets.API_ID }}
api_hash: ${{ secrets.API_HASH }}
session_string: ${{ secrets.API_SESSION }}
api_id2: ${{ secrets.API_ID2 }}
api_hash2: ${{ secrets.API_HASH2 }}
session_string2: ${{ secrets.API_SESSION2 }}
bot_id: ${{ secrets.BOT_ID }}
PGPASSWORD: postgres
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Set up PostgreSQL DB
run: |
psql -U postgres -h localhost -p ${{ job.services.postgres.ports['5432'] }} -c 'CREATE DATABASE queue_db
WITH
OWNER = postgres
ENCODING = 'UTF8'
TABLESPACE = pg_default
CONNECTION LIMIT = -1
IS_TEMPLATE = False;'
psql -U postgres -h localhost -p ${{ job.services.postgres.ports['5432'] }} -d queue_db -a -f DbUtils/create_db_structure.sql
- name: Run Unit tests
run: |
pytest -m unit
- name: Run Integration tests
run: |
pytest -m integration
- name: Run tg-bot
run: |
python Src/queueBot.py &
- name: Run System tests
run: |
pytest -m system
- name: Stop tg-bot
run: |
pkill -f queueBot.py