Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
; * Основные настройки * ;
max-line-length = 127

; * Кавычки * ;
inline-quotes = single
docstring-quotes = double
multiline-quotes = single
avoid-escape = True
47 changes: 24 additions & 23 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
name: Publish to PyPI

on:
release:
types: [created]
workflow_dispatch:
release:
types: [created]

jobs:
build-and-publish:
runs-on: ubuntu-latest
build-and-publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: |
python -m build
- name: Build package
run: |
python -m build

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m twine upload dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m twine upload dist/*
44 changes: 22 additions & 22 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
name: Publish to TestPyPI

on:
workflow_dispatch:
workflow_dispatch:

jobs:
build-and-publish:
runs-on: ubuntu-latest
build-and-publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: |
python -m build
- name: Build package
run: |
python -m build

- name: Publish package to TestPyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
python -m twine upload --repository testpypi dist/*
- name: Publish package to TestPyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
python -m twine upload --repository testpypi dist/*
24 changes: 8 additions & 16 deletions .github/workflows/python-lint-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,28 @@ name: Python Package
on:
workflow_dispatch:
push:
branches:
- main
pull_request:

jobs:
tests:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pyrogram tgcrypto pytest pytest-asyncio mock
shell: bash
pip install flake8 flake8-quotes bandit

- name: Lint with flake8
- name: Run flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 PyroArgs tests --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 PyroArgs tests --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
shell: bash
flake8 .

- name: Run tests
- name: Run bandit
run: |
python -m unittest discover tests
shell: bash
bandit -r .
Loading