-
Notifications
You must be signed in to change notification settings - Fork 1
132 lines (122 loc) · 4.44 KB
/
pr-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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# The MIT License (MIT).
#
# Copyright (c) 2018-2025 Almaz Ilaletdinov <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
# OR OTHER DEALINGS IN THE SOFTWARE.
name: Check pull request
on:
pull_request:
branches: [ "master" ]
push:
branches: [ "master" ]
permissions:
contents: read
jobs:
setup:
uses: blablatdinov/tg-quranbot/.github/workflows/installing-dependencies.yml@master
tests:
needs: setup
runs-on: ubuntu-24.04
env:
TZ: "Europe/Moscow"
services:
postgres:
image: postgres:13.19
env:
POSTGRES_USER: almazilaletdinov
POSTGRES_DB: postgres
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis:6
ports:
- 6379:6379
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
rabbitmq:
image: rabbitmq:3.13.7
ports:
- 5672:5672
- 15672:15672
env:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
options: --health-cmd "rabbitmqctl status" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12.7"
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: create .env file
run: echo '${{ secrets.E2E_ENV_SETUP }}' > .env
- name: Run tests with pytest
run: .venv/bin/pytest src --ignore=src/tests/e2e --doctest-modules --cov --cov-report xml --cov-fail-under=95
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
# fail_ci_if_error: true
- name: Check dependencies relevance
run: .venv/bin/deltaver poetry.lock --format lock
gotemir:
runs-on: ubuntu-24.04
name: Src and tests structure check
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run gotemir
run: |
VERSION="0.0.3"
curl -O -L -C - https://github.com/blablatdinov/gotemir/releases/download/$VERSION/gotemir-linux-amd64.tar
tar xzf gotemir-linux-amd64.tar
./gotemir-linux-amd64 --ext .py src src/tests/unit,src/tests/it
shell: bash
lint:
needs: setup
uses: blablatdinov/tg-quranbot/.github/workflows/lint.yml@master
check-duplicates:
runs-on: ubuntu-24.04
name: Check duplicated code
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install jscpd
run: npm i jscpd -g
- name: Run jscpd
run: jscpd -p '**/*.py' -t 33 --ignore-pattern "from.*import\s"
check-spelling:
runs-on: ubuntu-24.04
name: Check spelling
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install cspell
run: npm i [email protected] @cspell/[email protected] -g
- name: Run cspell
run: find . -type f \( -iname \*.py -o -iname \*.md \) | xargs cspell --no-progress --show-suggestions --show-context