Skip to content

Commit

Permalink
Release v0
Browse files Browse the repository at this point in the history
Co-authored-by: Nizamov Timur <abc@nizamovtimur.ru>
Co-authored-by: Ivanov Nikita <nikita.ivanov.778@gmail.com>
Co-authored-by: Iogan Maksim <maksiamiogan@gmail.com>
Co-authored-by: Fazlyev Albert <albert.fz@yandex.ru>
  • Loading branch information
5 people committed Oct 30, 2024
0 parents commit 2e1bfe2
Show file tree
Hide file tree
Showing 85 changed files with 15,194 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[bumpversion]
current_version = 0.0.3-dev
commit = False
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?
serialize =
{major}.{minor}.{patch}-{release}
{major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = prod
first_value = dev
values =
dev
prod

[bumpversion:file:./src/llamator/__version__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'
15 changes: 15 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[run]
branch = True
source =
src

omit =
*__init__*
*__version__*
*/thirdparty/**

[report]
exclude_lines =
pragma: no cover
if __name__ == .__main__.
show_missing = True
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/venv/
docs/
tests/
ci/
.vscode/
.idea/
.pytest_cache/
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This is a standard to preconfigure editors
# check: https://editorconfig.org/
root = true

# 4 space indentation
[*.py]
charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = false
end_of_line = lf
12 changes: 12 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[flake8]
ignore=
# line too long - is to be checked by black
E501,
# E203 (spaces around :)
E203,
# and W503 (line break before binary operator) are output as a result of Black formatting
W503

dictionaries=en_US,python,technical
docstring-convention=google
spellcheck-targets=comments
200 changes: 200 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
name: Continuous Integration

on:
push:
branches: [main, master]
pull_request:

jobs:
lints:
name: Run linters
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Cache pre-commit
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install pre-commit
run: pip3 install pre-commit

- name: Run pre-commit checks
run: pre-commit run --all-files --show-diff-on-failure --color always

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: "fs"
ignore-unfixed: true
exit-code: 0 # change if you want to fail build on vulnerabilities
severity: "CRITICAL,HIGH,MEDIUM"
format: "table"
output: "trivy-scanning-results.txt"

- name: Format trivy message
run: |
echo "Trivy scanning results." >> trivy.txt
cat trivy-scanning-results.txt >> trivy.txt
- name: Add trivy report to PR
uses: thollander/actions-comment-pull-request@v2
continue-on-error: true
if: ${{ github.event_name == 'pull_request' }}
with:
filePath: trivy.txt
reactions: ""
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
comment_tag: trivy

- name: Create venv
run: . ./setup_dev_env.sh

- name: Check licenses
run: ./check_licenses.sh

- name: Generate pip freeze
run: |
source venv/bin/activate
pip freeze > requirements-freeze.txt
- name: Publish Artefacts
uses: actions/upload-artifact@v3
if: always()
continue-on-error: true
with:
name: results
path: |
requirements-freeze.txt
licenses.txt
trivy-scanning-results.txt
retention-days: 30

- name: Publish Test Report
uses: actions/upload-artifact@v3
if: always()
continue-on-error: true
with:
name: test-report
path: report.xml
retention-days: 10

- name: Validate package build
run: |
source venv/bin/activate
python -m pip install -U build
python -m build
- name: Publish Package
uses: actions/upload-artifact@v3
continue-on-error: true
if: success()
with:
name: packages
path: dist/**
retention-days: 3

tests:
name: Run tests
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
checks: write
pull-requests: write
contents: write # required for advanced coverage reporting (to keep branch)
strategy:
fail-fast: false # do not stop all jobs if one fails
matrix:
include:
- python-version: "3.10"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache Dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Dependencies
run: pip install -r requirements-dev.txt

- name: Run Tests With Coverage
run: |
# run with coverage to not execute tests twice
coverage run -m pytest -v -p no:warnings --junitxml=report.xml tests/
coverage report
coverage xml
- name: Test Report
uses: mikepenz/action-junit-report@v4
continue-on-error: true
if: always()
with:
report_paths: 'report.xml'

- name: Publish Test Report
uses: actions/upload-artifact@v3
continue-on-error: true
if: always()
with:
name: test-report
path: report.xml
retention-days: 10

# simpler version for code coverage reporting
# - name: Produce Coverage report
# uses: 5monkeys/cobertura-action@v13
# continue-on-error: true
# with:
# path: coverage.xml
# minimum_coverage: 70
# fail_below_threshold: false

# more complex version for better coverage reporting
- name: Produce the coverage report
uses: insightsengineering/coverage-action@v2
continue-on-error: true
with:
# Path to the Cobertura XML report.
path: coverage.xml
# Minimum total coverage, if you want to the
# workflow to enforce it as a standard.
# This has no effect if the `fail` arg is set to `false`.
threshold: 60
# Fail the workflow if the minimum code coverage
# reuqirements are not satisfied.
fail: false
# Publish the rendered output as a PR comment
publish: true
# Create a coverage diff report.
diff: true
# Branch to diff against.
# Compare the current coverage to the coverage
# determined on this branch.
diff-branch: ${{ github.event.repository.default_branch }}
# make report togglable
togglable-report: true
# This is where the coverage reports for the
# `diff-branch` are stored.
# Branch is created if it doesn't already exist'.
diff-storage: _xml_coverage_reports
# A custom title that can be added to the code
# coverage summary in the PR comment.
coverage-summary-title: "Code Coverage Summary"
36 changes: 36 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build documentation

on:
push:
branches: [main, master]

jobs:
pages:
runs-on: ubuntu-latest
container: python:3.10
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: Cache Dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# for best results, it is better to generate
# documentation within development environment
- name: Create venv
run: . ./setup_dev_env.sh

- name: Build docs
run: ./build_docs.sh

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
89 changes: 89 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Directories
.vscode/
.idea/
.neptune/
.pytest_cache/
.mypy_cache/
[.][v]env/
[.][v]env
__pycache__/
**.egg-info/

# Logs
*.log

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# Sphinx documentation
docs/_build/
public/
# autogenerated package license table
docs/licenses_table.rst

# license dump file
licenses.txt

# File formats
*.onnx
*.pyc
*.pt
*.pth
*.pkl
*.mar
*.torchscript
**/.ipynb_checkpoints
**/dist/
**/checkpoints/
**/outputs/

# Other env files
.python-version
pyvenv.cfg
pip-selfcheck.json


# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# dotenv
.env

# coverage and pytest reports
coverage.xml
report.xml

# CMake
cmake-build-*/
*/artifacts/
Loading

0 comments on commit 2e1bfe2

Please sign in to comment.