Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ jobs:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
outputs:
python-template-docker-tag: ${{ steps.python-template-docker-tag.outputs.python-template-docker-tag }}
docker-tag: ${{ steps.docker-tag.outputs.docker-tag }}
env:
PYTHON_APP_ENVIRONMENT: Development
PYTHON_APP_ENVIRONMENT: development
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Install uv
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v6.6.1
uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
with:
version: 0.9.0
version-file: pyproject.toml
resolution-strategy: lowest

- name: Install Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
Expand Down Expand Up @@ -52,36 +53,36 @@ jobs:
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1

- name: Set docker tag
id: python-template-docker-tag
run: echo "python-template-docker-tag=myregistry/python-template:${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
id: docker-tag
run: echo "docker-tag=myregistry/python-template:${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT

- name: Build and push
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
file: src/python_template/api/Dockerfile
tags: ${{ steps.python-template-docker-tag.outputs.python-template-docker-tag }}
tags: ${{ steps.docker-tag.outputs.docker-tag }}
push: false

deploy-dev:
needs: continuous-integration
uses: ./.github/workflows/_deploy.yaml
with:
environment: dev
docker_tag: ${{ needs.continuous-integration.outputs.python-template-docker-tag }}
docker_tag: ${{ needs.continuous-integration.outputs.docker-tag }}
secrets: inherit

deploy-stg:
needs: [continuous-integration, deploy-dev]
uses: ./.github/workflows/_deploy.yaml
with:
environment: stg
docker_tag: ${{ needs.continuous-integration.outputs.python-template-docker-tag }}
docker_tag: ${{ needs.continuous-integration.outputs.docker-tag }}
secrets: inherit

deploy-pro:
needs: [continuous-integration, deploy-stg]
uses: ./.github/workflows/_deploy.yaml
with:
environment: pro
docker_tag: ${{ needs.continuous-integration.outputs.python-template-docker-tag }}
docker_tag: ${{ needs.continuous-integration.outputs.docker-tag }}
secrets: inherit
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ dev = [
]

[build-system]
requires = ["uv_build>=0.9.0,<0.10.0"]
requires = ["uv_build"]
build-backend = "uv_build"

[tool.uv]
required-version = ">=0.9.2,<0.10.0"

[tool.pyright]
typeCheckingMode = "strict"

Expand Down
4 changes: 2 additions & 2 deletions src/python_template/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 0.9.0-python3.13-bookworm-slim
FROM astral/uv@sha256:3cb1f6710acffab0693c9efaaa32ab21ff10a4f8e38efaa5f2688abb49f35687 AS builder
# 0.9.2-python3.13-bookworm-slim
FROM astral/uv@sha256:7072fbb9cf84e6b76bee43905c27a1cf4afa48bfa49de3cb2b57f748ada6cc10 AS builder

ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PYTHON_DOWNLOADS=0

Expand Down
Empty file added tests/unit/domain/__init__.py
Empty file.
Empty file.
8 changes: 8 additions & 0 deletions tests/unit/domain/entities/test_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from decimal import Decimal

from python_template.domain.entities.product import Product


class TestProduct:
def test_publish_product(self) -> None:
Product(name="Product name", price=Decimal("1.0"), is_discontinued=False)
Loading