Skip to content

Commit

Permalink
feat(all): 🚀 INIT
Browse files Browse the repository at this point in the history
  • Loading branch information
shepilov-vladislav committed Dec 9, 2024
0 parents commit 67b033d
Show file tree
Hide file tree
Showing 101 changed files with 11,421 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# DATABASE
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=fh_user
POSTGRES_PASSWORD=fh_password
POSTGRES_DATABASE=test_fh_db
POSTGRES_DSN=postgres://fh_user:fh_password@localhost:5432/test_fh_db

# REDIS
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_USER=default
REDIS_PASSWORD=password
REDIS_DATABASE=0
REDIS_DSN=redis://default:password@localhost:6379/0

# RABBITMQ
RABBITMQ_HOST=localhost
RABBITMQ_PORT=5672
RABBITMQ_USER=user
RABBITMQ_PASSWORD=password
RABBITMQ_VHOST=test
RABBITMQ_DSN=amqp://user:password@localhost:5672/test

# KAFKA
KAFKA_BOOTSTRAP_SERVERS=localhost:9094,localhost:9095

# MONGO
MONGO_HOST=localhost
MONGO_PORT=27017
MONGO_USER=root
MONGO_PASSWORD=root
MONGO_AUTH_SOURCE=admin
MONGO_DATABASE=test
MONGO_DSN=mongodb://root:root@localhost:27017/test?authSource=admin
105 changes: 105 additions & 0 deletions .github/workflows/1_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Tests

on:
workflow_dispatch:
push:
branches: ["main"]
tags-ignore: ["**"]
pull_request:

concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true

jobs:

pre-commit:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
steps:

- uses: actions/[email protected]

- name: Install uv
uses: astral-sh/[email protected]

- name: Set up Python 3.10
run: uv python install 3.10

- name: Install the project
run: uv sync --all-extras --dev

- uses: tox-dev/[email protected]
env:
SKIP: "detect-aws-credentials,no-commit-to-branch"

unit-tests:
needs: [pre-commit]
name: test with ${{ matrix.python-version }} on ${{ matrix.os }} with ${{ matrix.pydantic-version }}
runs-on: ${{ matrix.os }}
if: github.event.repository.fork == false
strategy:
fail-fast: false
matrix:
python-version:
- "3.13"
- "3.12"
- "3.11"
- "3.10"
pydantic-version:
- "pydantic-v1"
- "pydantic-v2"
os:
- ubuntu-latest
# - macos-latest
- windows-latest

steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Install the latest version of uv

uses: astral-sh/[email protected]
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Add .local/bin to Windows PATH
if: runner.os == 'Windows'
shell: bash
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Run Imports Tests
run: |
uv sync
uv pip install pytest pytest-asyncio pytest-cov greenlet
uv run pytest --cov --cov-append -m 'imports' tests/unit/test_imports.py
uv sync --group=dev --all-extras
- name: Install Pydantic v1
if: matrix.pydantic-version == 'pydantic-v1'
run: uv pip install "pydantic>=1.10.19,<2.0.0"

- name: Install Pydantic v2
if: matrix.pydantic-version == 'pydantic-v2'
run: uv pip install "pydantic>=2.10.3,<3.0.0"

- name: Run Unit Tests
run: |
uv run pytest --cov --cov-append -m 'unit'
uv run coverage xml
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,PYTHON
fail_ci_if_error: true
flags: unittests
name: codecov-umbrella
verbose: true
29 changes: 29 additions & 0 deletions .github/workflows/2_bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Bump version

on:
workflow_dispatch:

jobs:
bump-version:
if: "!startsWith(github.event.head_commit.message, 'bump:')"
runs-on: ubuntu-latest
name: "Bump version and create changelog with commitizen"
steps:
- name: Check out
uses: actions/[email protected]
with:
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
fetch-depth: 0

- name: Create bump and changelog
uses: commitizen-tools/[email protected]
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: "CHANGELOG.md"
tag_name: ${{ env.REVISION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/3_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Docs

on:
push:
tags:
- "*.*.*"
paths:
- 'docs/**'
- 'CHANGELOG.md'
- 'mkdocs.yml'
- 'requirements-docs.txt'

jobs:
build:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
steps:

- uses: actions/[email protected]

- name: Install uv
uses: astral-sh/[email protected]

- name: Set up Python 3.13
run: uv python install 3.13

- run: uv sync --group=docs

- name: Deploy to GitHub Pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: uv run mkdocs gh-deploy --force
30 changes: 30 additions & 0 deletions .github/workflows/4_pythonpublish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Upload Python Package

on:
push:
tags:
- "*.*.*"

jobs:
PyPi:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0

- name: Install uv
uses: astral-sh/[email protected]

- name: Set up Python 3.12
run: uv python install 3.12

- name: Install the project
run: uv sync --group=dev --group=docs --all-extras

- name: Publish To PyPi
env:
UV_PUBLISH_USERNAME: __token__
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: uv publish
Loading

0 comments on commit 67b033d

Please sign in to comment.