Skip to content

Commit 297424c

Browse files
feat: Добавлен ci/cd, pre-commit.
1 parent 4e8e280 commit 297424c

19 files changed

+1353
-30
lines changed

.bandit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[bandit]
2+
exclude = tests
3+
tests = B201,B301
4+
skips = B101,B601,B403

.github/workflows/codeql.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: '39 11 * * 3'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
language: ['python']
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
- name: Initialize CodeQL
27+
uses: github/codeql-action/init@v3
28+
with:
29+
languages: ${{ matrix.language }}
30+
setup-python-dependencies: false
31+
- name: Autobuild
32+
uses: github/codeql-action/autobuild@v3
33+
- name: Perform CodeQL Analysis
34+
uses: github/codeql-action/analyze@v3

.github/workflows/publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Upload Python Package to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Install Python
14+
uses: actions/setup-python@v5
15+
- name: Install poetry
16+
uses: abatilo/actions-poetry@v4
17+
- name: Publish package
18+
env:
19+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
20+
run: |
21+
poetry publish \
22+
--build \
23+
--username "__token__" \
24+
--password "${{ env.PYPI_API_TOKEN }}"
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
types:
6+
- "opened"
7+
- "synchronize"
8+
push:
9+
branches: ["main"]
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.11", "3.12", "3.13"]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install poetry
26+
uses: abatilo/actions-poetry@v4
27+
- name: Install dependencies
28+
run: poetry install
29+
- name: Run unit tests
30+
run: poetry run pytest
31+
32+
lint:
33+
runs-on: ubuntu-latest
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
python-version: ["3.11", "3.12", "3.13"]
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
- name: Set up Python ${{ matrix.python-version }}
42+
id: setup-python
43+
uses: actions/setup-python@v5
44+
with:
45+
python-version: ${{ matrix.python-version }}
46+
- name: cache poetry install
47+
uses: actions/cache@v4
48+
with:
49+
path: ~/.local
50+
key: poetry-${{ steps.setup-python.outputs.python-version }}-1.7.1-0
51+
- uses: snok/install-poetry@v1
52+
with:
53+
version: 1.7.1
54+
virtualenvs-create: true
55+
virtualenvs-in-project: true
56+
- name: Load cached venv
57+
id: cached-poetry-dependencies
58+
uses: actions/cache@v4
59+
with:
60+
path: .venv
61+
key: venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-0
62+
- name: Install dependencies
63+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
64+
run: poetry install
65+
- name: Run pre-commit
66+
run: |
67+
source .venv/bin/activate
68+
pre-commit run --all-files

.gitignore

Lines changed: 177 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,177 @@
1-
.idea
1+
Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# UV
98+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
#uv.lock
102+
103+
# poetry
104+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105+
# This is especially recommended for binary packages to ensure reproducibility, and is more
106+
# commonly ignored for libraries.
107+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108+
#poetry.lock
109+
110+
# pdm
111+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112+
#pdm.lock
113+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114+
# in version control.
115+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116+
.pdm.toml
117+
.pdm-python
118+
.pdm-build/
119+
120+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121+
__pypackages__/
122+
123+
# Celery stuff
124+
celerybeat-schedule
125+
celerybeat.pid
126+
127+
# SageMath parsed files
128+
*.sage.py
129+
130+
# Environments
131+
.env
132+
.venv
133+
env/
134+
venv/
135+
ENV/
136+
env.bak/
137+
venv.bak/
138+
139+
# Spyder project settings
140+
.spyderproject
141+
.spyproject
142+
143+
# Rope project settings
144+
.ropeproject
145+
146+
# mkdocs documentation
147+
/site
148+
149+
# mypy
150+
.mypy_cache/
151+
.dmypy.json
152+
dmypy.json
153+
154+
# Pyre type checker
155+
.pyre/
156+
157+
# pytype static type analyzer
158+
.pytype/
159+
160+
# Cython debug symbols
161+
cython_debug/
162+
163+
# PyCharm
164+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166+
# and can be added to the global gitignore or merged into this file. For a more nuclear
167+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
168+
.idea/
169+
170+
# Ruff stuff:
171+
.ruff_cache/
172+
173+
# PyPI configuration file
174+
.pypirc
175+
176+
# vscode settings
177+
.vscode/

.pre-commit-config copy.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: flynt
5+
name: "flynt"
6+
entry: flynt
7+
args: [--fail-on-change]
8+
types: [python]
9+
language: system
10+
- id: ruff-format
11+
name: "ruff format"
12+
entry: ruff format
13+
types: [python]
14+
language: system
15+
- id: ruff-lint
16+
name: "ruff lint"
17+
entry: ruff check
18+
args:
19+
- --fix
20+
types: [python]
21+
language: system
22+
- id: bandit
23+
name: "bandit"
24+
entry: bandit
25+
language: system
26+
types: [python]
27+
args: [--ini, .bandit]
28+
- id: mypy
29+
name: "mypy"
30+
entry: mypy
31+
args: ["--config-file", "pyproject.toml"]
32+
types: [python]
33+
language: system
34+
exclude: tests
35+
36+
- repo: https://github.com/pre-commit/pre-commit-hooks
37+
rev: v4.6.0
38+
hooks:
39+
- id: end-of-file-fixer
40+
exclude: .*(min.js|min.css|html|svg|css.map|js.map)
41+
- id: trailing-whitespace

.pre-commit-config.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: flynt
5+
name: "flynt"
6+
entry: flynt
7+
args: [--fail-on-change]
8+
types: [python]
9+
language: system
10+
- id: ruff-format
11+
name: "ruff format"
12+
entry: ruff format
13+
types: [python]
14+
language: system
15+
- id: ruff-lint
16+
name: "ruff lint"
17+
entry: ruff check
18+
args:
19+
- --fix
20+
types: [python]
21+
language: system
22+
- id: bandit
23+
name: "bandit"
24+
entry: bandit
25+
language: system
26+
types: [python]
27+
args: [--ini, .bandit]
28+
- id: mypy
29+
name: "mypy"
30+
entry: mypy
31+
args: ["--config-file", "pyproject.toml"]
32+
types: [python]
33+
language: system
34+
exclude: tests
35+
36+
- repo: https://github.com/pre-commit/pre-commit-hooks
37+
rev: v4.6.0
38+
hooks:
39+
- id: end-of-file-fixer
40+
exclude: .*(min.js|min.css|html|svg|css.map|js.map)
41+
- id: trailing-whitespace

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# FastAPI Django

0 commit comments

Comments
 (0)