-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (55 loc) · 2.14 KB
/
python.yaml
File metadata and controls
65 lines (55 loc) · 2.14 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
name: Build python app
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.11", "3.12" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
find . -name "requirements.txt" -type f -exec pip install -r '{}' ';'
pip install wemake-python-styleguide flake8-html mypy pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --exit-zero --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --exit-zero --format=html --htmldir=.flake-report
- name: Test with pytest
run: |
# we need tests with __init__.py in it
tests=($(find . -name "__init__.py" -type f | grep -oP '^.*/tests/__init__\.py' | sed 's/__init__.py//'))
for i in "${tests[@]}"
do
if [[ $i =~ (cache|functional)* ]]; then continue; fi
echo "Running tests in $i"
pytest $i --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
done
- name: Run mypy
run: |
projects=($(ls -d */))
for i in "${projects[@]}"
do
if [[ $i =~ (docs|infra|\.flake-report)* ]]; then continue; fi
echo "$i"
mypy $i/*/*.py
done
- name: Notify telegram
run: |
curl -X POST \
-H 'Content-Type: application/json' \
-d '{"chat_id": "${{ secrets.TELEGRAM_BOT_CHAT_ID }}", "text": "$GITHUB_REF ${{github.event.pull_request.number}} succeed", "disable_notification": true}' \
https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage