-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (81 loc) · 2.18 KB
/
python-check.yml
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
name: Run Python linters and tests
on:
pull_request:
paths:
- "**/*.py"
- "poetry.lock"
- "pyproject.toml"
branches:
- master
- dev
jobs:
lint:
name: Run Python linters
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
poetry-version: ["1.5.1"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Poetry ${{matrix.poetry-version}}
run: pipx install poetry==${{matrix.poetry-version}}
- name: "Setup Python ${{matrix.python-version}}"
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
cache: "poetry"
- name: Install dependencies
run: poetry install
- name: Build protobuf
run: make build-protobuf
- name: Reformat generated code
run: make format
- name: Run flake8
run: make flake
- name: Run mypy
run: make mypy
test:
name: Run Python tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
poetry-version: ["1.5.1"]
env:
DB_NAME: my_telegram_assistant
DB_USER: postgres
DB_PASSWORD: mypass
DB_HOST: "localhost:5555"
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_DB: ${{env.DB_NAME}}
POSTGRES_USER: ${{env.DB_USER}}
POSTGRES_PASSWORD: ${{env.DB_PASSWORD}}
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5555:5432
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry
- name: Setup Python ${{matrix.python-versions}}
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
cache: "poetry"
- name: Install dependencies
run: poetry install
- name: Build gRPC proto files
run: make build-protobuf
- name: Run pytest
run: make test