From abdb14dd6461415c2018b7eafa2877ee97dde93e Mon Sep 17 00:00:00 2001 From: Andreu Codina <30506301+AndreuCodina@users.noreply.github.com> Date: Tue, 13 May 2025 16:55:56 +0200 Subject: [PATCH 01/12] Update README --- README.md | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 308b66f..6762da6 100644 --- a/README.md +++ b/README.md @@ -3,30 +3,18 @@ Python monorepo + uv + Vertical Slice Architecture # Projects +`api` and `transcriber`. -## API - -RESTful API. +# Execute project ```bash -uv run -- fastapi dev api/src/api/main.py +docker compose --file docker-compose-dev.yaml up --detach ``` ```bash -docker build \ - --file api/src/api/Dockerfile \ - --tag python-monorepo:0.1.0 \ - --platform=linux/amd64 \ - . +uv run -- fastapi dev api/src/api/main.py ``` ```bash -docker run \ - --publish 8000:8000 \ - --env COMMON__ENVIRONMENT=Development \ - python-monorepo:0.1.0 +docker compose --file docker-compose-dev.yaml down --volumes ``` - -# Transcriber - -Audio transcriber reading from a queue. \ No newline at end of file From 98db6643c3cb54da3781a7b21e7a2738b35439f1 Mon Sep 17 00:00:00 2001 From: Andreu Codina <30506301+AndreuCodina@users.noreply.github.com> Date: Tue, 13 May 2025 16:57:06 +0200 Subject: [PATCH 02/12] Add changes --- transcriber/src/transcriber/transcriber_printer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transcriber/src/transcriber/transcriber_printer.py b/transcriber/src/transcriber/transcriber_printer.py index 8a1c8d7..fbd8ec2 100644 --- a/transcriber/src/transcriber/transcriber_printer.py +++ b/transcriber/src/transcriber/transcriber_printer.py @@ -1,3 +1,3 @@ class TranscriberPrinter: def print(self) -> None: - print("Transcriber printer") + print("Transcriber printer") # noqa: T201 From ef5babef758a3a86a7670acbbaaf7de1e22a742f Mon Sep 17 00:00:00 2001 From: Andreu Codina <30506301+AndreuCodina@users.noreply.github.com> Date: Tue, 13 May 2025 17:02:21 +0200 Subject: [PATCH 03/12] Add changes --- domain/tests/__init__.py | 0 scripts/__init__.py | 0 scripts/script.py | 6 ++++++ 3 files changed, 6 insertions(+) create mode 100644 domain/tests/__init__.py create mode 100644 scripts/__init__.py diff --git a/domain/tests/__init__.py b/domain/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/script.py b/scripts/script.py index e69de29..ea28b48 100644 --- a/scripts/script.py +++ b/scripts/script.py @@ -0,0 +1,6 @@ +def main() -> None: + print("Hello, World!") # noqa: T201 + + +if __name__ == "__main__": + main() From 35dfd0615e51a39de92ef0bb77e200c0c81fbf9f Mon Sep 17 00:00:00 2001 From: Andreu Codina <30506301+AndreuCodina@users.noreply.github.com> Date: Tue, 13 May 2025 17:03:59 +0200 Subject: [PATCH 04/12] Add changes --- .github/workflows/pull_request.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 73e33ff..6373469 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -45,9 +45,9 @@ jobs: run: uv run --frozen -- pytest -m unit shell: bash - - name: Integration tests - run: uv run --frozen -- pytest -m integration - shell: bash + # - name: Integration tests + # run: uv run --frozen -- pytest -m integration + # shell: bash release: needs: continuous-integration From ab735acdd2d25c4314bbcbe3205238005ed270db Mon Sep 17 00:00:00 2001 From: Andreu Codina <30506301+AndreuCodina@users.noreply.github.com> Date: Tue, 13 May 2025 17:05:27 +0200 Subject: [PATCH 05/12] Add changes --- .github/workflows/pull_request.yaml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 6373469..d4ba372 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -49,7 +49,23 @@ jobs: # run: uv run --frozen -- pytest -m integration # shell: bash - release: + release-api: + needs: continuous-integration + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Install uv + uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1 + with: + version: ${{ env.UV_VERSION}} + + - name: Install Python packages + run: uv sync --locked --no-dev + shell: bash + + release-transcriber: needs: continuous-integration runs-on: ubuntu-22.04 steps: From 735f0b5531f234f39521645e20800cc277bfc073 Mon Sep 17 00:00:00 2001 From: Andreu Codina <30506301+AndreuCodina@users.noreply.github.com> Date: Wed, 14 May 2025 11:34:39 +0200 Subject: [PATCH 06/12] Update GitHub Action --- .github/workflows/_deploy_api.yaml | 27 +++++++++++++++++++ .github/workflows/pull_request.yaml | 41 +++++------------------------ 2 files changed, 34 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/_deploy_api.yaml diff --git a/.github/workflows/_deploy_api.yaml b/.github/workflows/_deploy_api.yaml new file mode 100644 index 0000000..86f4a17 --- /dev/null +++ b/.github/workflows/_deploy_api.yaml @@ -0,0 +1,27 @@ +name: Deploy API + +on: + workflow_call: + inputs: + environment: + required: true + type: string + uv_version: + required: true + type: string + +jobs: + deploy: + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Install uv + uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1 + with: + version: ${{ vars.UV_VERSION }} + + - name: Install Python packages + run: uv sync --locked --no-dev + shell: bash diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index d4ba372..ba929d1 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -9,9 +9,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false -env: - UV_VERSION: "0.7.3" - jobs: continuous-integration: if: github.actor != 'dependabot[bot]' @@ -25,7 +22,7 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1 with: - version: ${{ env.UV_VERSION}} + version: ${{ vars.UV_VERSION }} - name: Install Python uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 @@ -49,34 +46,10 @@ jobs: # run: uv run --frozen -- pytest -m integration # shell: bash - release-api: + deploy-api-dev: needs: continuous-integration - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Install uv - uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1 - with: - version: ${{ env.UV_VERSION}} - - - name: Install Python packages - run: uv sync --locked --no-dev - shell: bash - - release-transcriber: - needs: continuous-integration - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Install uv - uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1 - with: - version: ${{ env.UV_VERSION}} - - - name: Install Python packages - run: uv sync --locked --no-dev - shell: bash + uses: ./.github/workflows/_deploy_api.yaml + with: + environment: dev + uv_version: ${{ vars.UV_VERSION }} + secrets: inherit From 57b9907e29baf2772e4c0f1244488a576a3baf80 Mon Sep 17 00:00:00 2001 From: Andreu Codina <30506301+AndreuCodina@users.noreply.github.com> Date: Wed, 14 May 2025 11:36:01 +0200 Subject: [PATCH 07/12] Update GitHub Action --- .github/workflows/_deploy_api.yaml | 3 --- .github/workflows/pull_request.yaml | 1 - 2 files changed, 4 deletions(-) diff --git a/.github/workflows/_deploy_api.yaml b/.github/workflows/_deploy_api.yaml index 86f4a17..bb6efd9 100644 --- a/.github/workflows/_deploy_api.yaml +++ b/.github/workflows/_deploy_api.yaml @@ -6,9 +6,6 @@ on: environment: required: true type: string - uv_version: - required: true - type: string jobs: deploy: diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index ba929d1..98ac960 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -51,5 +51,4 @@ jobs: uses: ./.github/workflows/_deploy_api.yaml with: environment: dev - uv_version: ${{ vars.UV_VERSION }} secrets: inherit From 42f92969f038d2eebe96988518093becb74ab181 Mon Sep 17 00:00:00 2001 From: Andreu Codina <30506301+AndreuCodina@users.noreply.github.com> Date: Wed, 14 May 2025 11:36:58 +0200 Subject: [PATCH 08/12] Update GitHub Action --- .github/workflows/_deploy_api.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/_deploy_api.yaml b/.github/workflows/_deploy_api.yaml index bb6efd9..13cf9ba 100644 --- a/.github/workflows/_deploy_api.yaml +++ b/.github/workflows/_deploy_api.yaml @@ -10,6 +10,7 @@ on: jobs: deploy: runs-on: ubuntu-22.04 + environment: ${{ inputs.environment }} steps: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 From 00f583a3bad67d5101b2f2e65da1e2e3e3287f84 Mon Sep 17 00:00:00 2001 From: Andreu Codina <30506301+AndreuCodina@users.noreply.github.com> Date: Wed, 14 May 2025 11:44:50 +0200 Subject: [PATCH 09/12] Update GitHub Action --- .github/workflows/_deploy_transcriber.yaml | 25 ++++++++++++++++++++++ .github/workflows/pull_request.yaml | 7 ++++++ 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/_deploy_transcriber.yaml diff --git a/.github/workflows/_deploy_transcriber.yaml b/.github/workflows/_deploy_transcriber.yaml new file mode 100644 index 0000000..bf226a7 --- /dev/null +++ b/.github/workflows/_deploy_transcriber.yaml @@ -0,0 +1,25 @@ +name: Deploy Transcriber + +on: + workflow_call: + inputs: + environment: + required: true + type: string + +jobs: + deploy: + runs-on: ubuntu-22.04 + environment: ${{ inputs.environment }} + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Install uv + uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1 + with: + version: ${{ vars.UV_VERSION }} + + - name: Install Python packages + run: uv sync --locked --no-dev + shell: bash diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 98ac960..acce88b 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -52,3 +52,10 @@ jobs: with: environment: dev secrets: inherit + + deploy-transcriber-dev: + needs: continuous-integration + uses: ./.github/workflows/_deploy_transcriber.yaml + with: + environment: dev + secrets: inherit From 186868ee1c1ae371526987d49ba495a00458c579 Mon Sep 17 00:00:00 2001 From: Andreu Codina <30506301+AndreuCodina@users.noreply.github.com> Date: Wed, 14 May 2025 11:47:10 +0200 Subject: [PATCH 10/12] Update GitHub Action --- .github/workflows/pull_request.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index acce88b..6879efe 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -59,3 +59,31 @@ jobs: with: environment: dev secrets: inherit + + deploy-api-stg: + needs: continuous-integration + uses: ./.github/workflows/_deploy_api.yaml + with: + environment: stg + secrets: inherit + + deploy-transcriber-stg: + needs: continuous-integration + uses: ./.github/workflows/_deploy_transcriber.yaml + with: + environment: pro + secrets: inherit + + deploy-api-pro: + needs: continuous-integration + uses: ./.github/workflows/_deploy_api.yaml + with: + environment: pro + secrets: inherit + + deploy-transcriber-pro: + needs: continuous-integration + uses: ./.github/workflows/_deploy_transcriber.yaml + with: + environment: pro + secrets: inherit From df265ec5b43fa3af6d11917e33db5b6cc21bf367 Mon Sep 17 00:00:00 2001 From: Andreu Codina <30506301+AndreuCodina@users.noreply.github.com> Date: Wed, 14 May 2025 11:49:08 +0200 Subject: [PATCH 11/12] Update GitHub Action --- .github/workflows/pull_request.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 6879efe..baa4155 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -61,28 +61,28 @@ jobs: secrets: inherit deploy-api-stg: - needs: continuous-integration + needs: [deploy-api-dev, deploy-transcriber-dev] uses: ./.github/workflows/_deploy_api.yaml with: environment: stg secrets: inherit deploy-transcriber-stg: - needs: continuous-integration + needs: [deploy-api-dev, deploy-transcriber-dev] uses: ./.github/workflows/_deploy_transcriber.yaml with: environment: pro secrets: inherit deploy-api-pro: - needs: continuous-integration + needs: [deploy-api-stg, deploy-transcriber-stg] uses: ./.github/workflows/_deploy_api.yaml with: environment: pro secrets: inherit deploy-transcriber-pro: - needs: continuous-integration + needs: [deploy-api-stg, deploy-transcriber-stg] uses: ./.github/workflows/_deploy_transcriber.yaml with: environment: pro From fd0663a65b55a3c678c0dc555c9c1cb0b69e0bc8 Mon Sep 17 00:00:00 2001 From: Andreu Codina <30506301+AndreuCodina@users.noreply.github.com> Date: Wed, 14 May 2025 11:51:12 +0200 Subject: [PATCH 12/12] Update GitHub Action --- .github/workflows/pull_request.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index baa4155..df34c0e 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -71,7 +71,7 @@ jobs: needs: [deploy-api-dev, deploy-transcriber-dev] uses: ./.github/workflows/_deploy_transcriber.yaml with: - environment: pro + environment: stg secrets: inherit deploy-api-pro: