Skip to content

Commit

Permalink
ci: start integrate cz to github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dpr-0 committed Dec 1, 2023
1 parent 005cd02 commit 33f253a
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 8 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/bumpversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Bump version

on:
push:
branches:
- main

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/checkout@v3
with:
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
fetch-depth: 0
- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
changelog_increment_filename: body.md
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: "body.md"
tag_name: ${{ env.REVISION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Run Ruff
run: poetry run ruff check .
- name: Run Mypy
run: poetry run mypy app
run: poetry run mypy app
- name: Test with pytest
run: poetry run pytest --cov=app --cov-report=xml
- name: Upload coverage reports to Codecov
Expand Down
15 changes: 9 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.5.1"
rev: "v1.7.1"
hooks:
- id: mypy
args: [--ignore-missing-imports]
additional_dependencies: ["types-redis"]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.5
rev: v0.1.6
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/commitizen-tools/commitizen
rev: 3.12.0
hooks:
- id: commitizen
- id: commitizen-branch
stages: [push]
Empty file added CHANGELOG.md
Empty file.
21 changes: 21 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.11-slim-bookworm as builder

RUN pip install poetry==1.7.1

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

COPY pyproject.toml poetry.lock ./

RUN poetry install --no-dev --no-root && rm -rf $POETRY_CACHE_DIR


FROM python:3.11-slim-bookworm as runtime

COPY --from=builder .venv .venv

COPY app ./app

CMD [".venv/bin/uvicorn", "app.main:app", "--timeout-graceful-shutdown", "1"]
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ types-redis = "^4.6.0.7"
asgi-lifespan = "^2.1.0"
asyncpg-stubs = "^0.28.0"


[tool.aerich]
tortoise_orm = "db.settings.TORTOISE_ORM"
location = "./migrations"
Expand Down Expand Up @@ -91,3 +90,7 @@ exclude_also = [
# Don't complain about abstract methods, they aren't run:
"@(abc\\.)?abstractmethod",
]

[tool.commitizen]
update_changelog_on_bump = true
version_provider = "poetry"

0 comments on commit 33f253a

Please sign in to comment.