BTHLABS-61: Service layer refactoring

A journey to fix `ValidationError` in Pocket imports turned service
layer refactoring :D
This commit is contained in:
2025-10-12 18:37:32 +00:00
parent ac7a8dd90e
commit 8b86145519
45 changed files with 1023 additions and 337 deletions

View File

@@ -11,14 +11,64 @@ on:
- "public"
jobs:
setup:
name: "Setup"
runs-on: "ubuntu-latest"
outputs:
SHORT_SHA: ${{ steps.get-build-options.outputs.SHORT_SHA }}
BUILD_ARCH: ${{ steps.get-build-options.outputs.BUILD_ARCH }}
BUILD_PLATFORM: ${{ steps.get-build-options.outputs.BUILD_PLATFORM }}
HOTPOCKET_BACKEND_VERSION: ${{ steps.get-backend-version.outputs.HOTPOCKET_BACKEND_VERSION }}
HOTPOCKET_BACKEND_BUILD: ${{ steps.get-backend-version.outputs.HOTPOCKET_BACKEND_BUILD }}
steps:
- name: "Checkout the code"
uses: "actions/checkout@v2"
- name: "Get build options"
id: "get-build-options"
run: |
set -x
SHORT_SHA="${GITHUB_SHA::8}"
BUILD_ARCH="amd64"
BUILD_PLATFORM="linux/amd64"
if [ "${RUNNER_ARCH}" = "ARM64" ];then
BUILD_ARCH="arm64"
BUILD_PLATFORM="linux/arm64"
fi
echo "SHORT_SHA=$SHORT_SHA" >> $GITHUB_OUTPUT
echo "BUILD_ARCH=$BUILD_ARCH" >> $GITHUB_OUTPUT
echo "BUILD_PLATFORM=$BUILD_PLATFORM" >> $GITHUB_OUTPUT
- name: "Get `backend` version"
id: "get-backend-version"
run: |
set -x
if [ "${GITHUB_REF_NAME}" = "development" ]; then
VERSION="${GITHUB_SHA::8}"
BUILD="${GITHUB_RUN_NUMBER}"
else
VERSION="v$(grep -Po '(?<=^version\s=\s")[^"]+' services/backend/pyproject.toml)"
BUILD="01"
fi
echo "HOTPOCKET_BACKEND_VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "HOTPOCKET_BACKEND_BUILD=$BUILD" >> $GITHUB_OUTPUT
run-checks:
name: "Checks"
runs-on: "ubuntu-latest"
needs:
- "setup"
steps:
- name: "Checkout the code"
uses: "actions/checkout@v2"
- name: "Set up Docker Buildx"
id: "setup-docker-buildx"
uses: "docker/setup-buildx-action@v3"
with:
driver: "remote"
endpoint: "tcp://builder-01.bthlab:2375"
platforms: "linux/amd64"
append: |
- endpoint: "tcp://builder-mac-01.bthlab:2375"
platforms: "linux/arm64"
- name: "Build `postgres` image"
uses: docker/build-push-action@v6
with:
@@ -27,6 +77,7 @@ jobs:
push: false
load: true
tags: "docker-hosted.nexus.bthlabs.pl/hotpocket/postgres:15.13-local"
platforms: "${{ needs.setup.outputs.BUILD_PLATFORM }}"
- name: "Build `keycloak` image"
uses: docker/build-push-action@v6
with:
@@ -35,6 +86,7 @@ jobs:
push: false
load: true
tags: "docker-hosted.nexus.bthlabs.pl/hotpocket/keycloak:22.0.3-local"
platforms: "${{ needs.setup.outputs.BUILD_PLATFORM }}"
- name: "Build `rabbitmq` image"
uses: docker/build-push-action@v6
with:
@@ -43,6 +95,7 @@ jobs:
push: false
load: true
tags: "docker-hosted.nexus.bthlabs.pl/hotpocket/rabbitmq:3.10.8-local"
platforms: "${{ needs.setup.outputs.BUILD_PLATFORM }}"
- name: "Build `backend-ci` image"
uses: docker/build-push-action@v6
with:
@@ -52,6 +105,7 @@ jobs:
push: false
load: true
tags: "docker-hosted.nexus.bthlabs.pl/hotpocket/backend:ci-local"
platforms: "${{ needs.setup.outputs.BUILD_PLATFORM }}"
- name: "Build `packages-ci` image"
uses: docker/build-push-action@v6
with:
@@ -61,6 +115,7 @@ jobs:
push: false
load: true
tags: "docker-hosted.nexus.bthlabs.pl/hotpocket/packages:ci-local"
platforms: "${{ needs.setup.outputs.BUILD_PLATFORM }}"
- name: "Build `extension-ci` image"
uses: docker/build-push-action@v6
with:
@@ -70,6 +125,7 @@ jobs:
push: false
load: true
tags: "docker-hosted.nexus.bthlabs.pl/hotpocket/extension:ci-local"
platforms: "${{ needs.setup.outputs.BUILD_PLATFORM }}"
- name: "Build `apple-ci` image"
uses: docker/build-push-action@v6
with:
@@ -79,6 +135,7 @@ jobs:
push: false
load: true
tags: "docker-hosted.nexus.bthlabs.pl/hotpocket/apple:ci-local"
platforms: "${{ needs.setup.outputs.BUILD_PLATFORM }}"
- name: "Run `backend` checks"
run: |
set -x