diff --git a/.github/workflows/_deploy_api.yaml b/.github/workflows/_deploy_api.yaml new file mode 100644 index 0000000..13cf9ba --- /dev/null +++ b/.github/workflows/_deploy_api.yaml @@ -0,0 +1,25 @@ +name: Deploy API + +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/_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 73e33ff..df34c0e 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 @@ -45,22 +42,48 @@ 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: + deploy-api-dev: needs: continuous-integration - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: ./.github/workflows/_deploy_api.yaml + with: + environment: dev + secrets: inherit - - name: Install uv - uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1 - with: - version: ${{ env.UV_VERSION}} + deploy-transcriber-dev: + needs: continuous-integration + uses: ./.github/workflows/_deploy_transcriber.yaml + with: + environment: dev + secrets: inherit - - name: Install Python packages - run: uv sync --locked --no-dev - shell: bash + deploy-api-stg: + needs: [deploy-api-dev, deploy-transcriber-dev] + uses: ./.github/workflows/_deploy_api.yaml + with: + environment: stg + secrets: inherit + + deploy-transcriber-stg: + needs: [deploy-api-dev, deploy-transcriber-dev] + uses: ./.github/workflows/_deploy_transcriber.yaml + with: + environment: stg + secrets: inherit + + deploy-api-pro: + needs: [deploy-api-stg, deploy-transcriber-stg] + uses: ./.github/workflows/_deploy_api.yaml + with: + environment: pro + secrets: inherit + + deploy-transcriber-pro: + needs: [deploy-api-stg, deploy-transcriber-stg] + uses: ./.github/workflows/_deploy_transcriber.yaml + with: + environment: pro + secrets: inherit 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 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() 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