No description
  • Python 78.5%
  • Shell 21.5%
Find a file
2026-09-23 17:27:25 +04:00
scripts chore: add release helper script 2025-02-06 12:30:00 +04:00
src/pricer chore: bump version to 1.2.0 2025-02-06 15:30:00 +04:00
tests feat: enable discount engine by default 2025-02-04 06:30:00 +04:00
.gitignore chore: initial project scaffold 2025-02-03 09:30:00 +04:00
.gitlab-ci.yml ci: auto-tag releases from project version 2025-02-06 11:30:00 +04:00
CHANGELOG.md docs: add changelog for 1.2.0 2025-02-06 14:30:00 +04:00
GitLab_CI_CD_Жизненный_цикл_Workflow_marp.md doku 2026-09-23 17:27:25 +04:00
GitLab_CI_CD_Жизненный_цикл_Workflow_marp.pdf doku 2026-09-23 17:27:25 +04:00
pyproject.toml chore: bump version to 1.2.0 2025-02-06 15:30:00 +04:00
pytest.ini test: cover total calculator 2025-02-03 13:30:00 +04:00
README.md docs: document protected trunk, releases and auto-tags 2025-02-06 13:30:00 +04:00
Заметки_докладчика_Жизненный_цикл_Workflow.md doku 2026-09-23 17:27:25 +04:00

Pricer

Tiny cart-pricing demo used to showcase trunk-based development (TBD).

What this repository demonstrates

  • A single long-lived branch: main (the trunk).
  • Small, frequent, atomic commits pushed straight to trunk.
  • Short-lived branches (minutes-to-hours) that are squash-merged and deleted.
  • Incomplete work shipped behind a feature flag (DISCOUNT_ENGINE).
  • Releases are lightweight tags on trunk (v1.0.0, v1.0.1, v1.1.0).
  • CI runs on every push (.gitlab-ci.yml).

Layout

src/pricer/   package source
tests/        pytest test suite

Usage

pip install -e .
pricer --items '[{"price": 100, "qty": 1}]' --discount 10

Feature flags

  • DISCOUNT_ENGINE — enables the discount engine (default: on since v1.1.0).
export DISCOUNT_ENGINE=1

Releases

Releases are lightweight tags on the trunk. To cut a release, use the short-lived release branch (created at release time, not beforehand):

scripts/release.sh 1.2.0

This cuts release/1.2.0, bumps the version, and leaves the final merge/tag steps for you — the branch should live only a few minutes.

Protected trunk

The trunk (main) is protected in GitLab: no direct pushes, changes land through merge requests with CI passing. Configure it via the API:

curl --request POST \
  --header "PRIVATE-TOKEN: <your-token>" \
  "https://gitlab.example.com/api/v4/projects/<project-id>/protected_branches?name=main&push_access_level=40&merge_access_level=30&allow_force_push=false"

push_access_level=40 (Maintainers only) · merge_access_level=30 (Developers+).

Auto-tags

The release job in .gitlab-ci.yml reads project.version from pyproject.toml and pushes a vX.Y.Z tag on every trunk build, unless the tag already exists. It needs a masked project access token GL_TAG_TOKEN with write_repository scope.