From b8b5b70700407a4eea995beb36a4022642c8c01f Mon Sep 17 00:00:00 2001 From: bogdandina Date: Fri, 24 Oct 2025 10:43:44 +0300 Subject: [PATCH 1/3] feat(62035): add CI/CD for TS and NPM + fixes --- .github/workflows/ci-cd-java.yml | 11 ++- .github/workflows/ci-cd-kotlin.yml | 14 +++- .github/workflows/ci-cd-typescript.yml | 107 +++++++++++++++++++++++++ 3 files changed, 125 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci-cd-typescript.yml diff --git a/.github/workflows/ci-cd-java.yml b/.github/workflows/ci-cd-java.yml index 80f09a2..00ed1c3 100644 --- a/.github/workflows/ci-cd-java.yml +++ b/.github/workflows/ci-cd-java.yml @@ -12,6 +12,12 @@ on: jarArtifactPath: required: false type: string + dockerUser: + required: true + type: string + dockerPassword: + required: true + type: string env: IMAGE_NAME_MIXED_CASE: "${{ github.repository }}" @@ -88,9 +94,8 @@ jobs: if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' uses: docker/login-action@v3 with: - registry: hsldevcom - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ inputs.dockerUser }} + password: ${{ inputs.dockerPassword }} - name: Build & Push Docker image if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' diff --git a/.github/workflows/ci-cd-kotlin.yml b/.github/workflows/ci-cd-kotlin.yml index c946e84..edd536f 100644 --- a/.github/workflows/ci-cd-kotlin.yml +++ b/.github/workflows/ci-cd-kotlin.yml @@ -12,6 +12,12 @@ on: jarArtifactPath: required: false type: string + dockerUser: + required: true + type: string + dockerPassword: + required: true + type: string env: IMAGE_NAME_MIXED_CASE: "${{ github.repository }}" @@ -79,13 +85,13 @@ jobs: labels: | org.opencontainers.image.title=${{ env.IMAGE_NAME }} org.opencontainers.image.vendor=hsldevcom - - name: Login to Github Container Registry + + - name: Login to Docker Hub if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' uses: docker/login-action@v3 with: - registry: hsldevcom - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ inputs.dockerUser }} + password: ${{ inputs.dockerPassword }} - name: Build & Push Docker image if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' diff --git a/.github/workflows/ci-cd-typescript.yml b/.github/workflows/ci-cd-typescript.yml new file mode 100644 index 0000000..8a5c95b --- /dev/null +++ b/.github/workflows/ci-cd-typescript.yml @@ -0,0 +1,107 @@ +name: ci-cd-typescript.yml +on: + workflow_call: + inputs: + dockerUser: + required: true + type: string + dockerPassword: + required: true + type: string + uploadJarArtifact: + required: false + type: boolean + default: false + jarArtifactName: + required: false + type: string + jarArtifactPath: + required: false + type: string + checkAndTestOutsideDocker: + required: false + type: boolean + default: false + + +env: + IMAGE_NAME_MIXED_CASE: "${{ github.repository }}" + TEST_STAGE: tester + PRODUCTION_STAGE: production + +jobs: + build-check-test-push: + name: Build, check, test, push + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + clean: 'true' + fetch-depth: 2 + + - name: Install Node + uses: actions/setup-node@v4 + with: + node-version: "lts/*" + cache: "npm" + + - name: Install NPM dependencies + run: npm ci + + - name: Check and test outside Docker + if: ${{ inputs.checkAndTestOutsideDocker }} + run: npm run check-and-build + + - name: Lowercase Docker Image Name + run: | + echo "IMAGE_NAME=${IMAGE_NAME_MIXED_CASE,,}" >> "${GITHUB_ENV}" + + - name: Extract docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + tags: | + type=edge,branch=main + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }} + type=sha,format=long + + - name: Setup Docker Buildx + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' + uses: docker/setup-buildx-action@v3 + + - name: Build and export to Docker + uses: docker/build-push-action@v6 + with: + context: . + load: true + target: "${{ env.TEST_STAGE }}" + tags: "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}" + + - name: Check and test + run: | + docker run --rm "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}" + + - name: Login to Docker Hub + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/')) + uses: docker/login-action@v3 + with: + username: ${{ inputs.dockerUser }} + password: ${{ inputs.dockerPassword }} + + - name: Build and push + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/')) + uses: docker/build-push-action@v6 + with: + context: . + push: true + target: "${{ env.PRODUCTION_STAGE }}" + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + + + From a3a9b5ac368754ef217238ce10168339621f301a Mon Sep 17 00:00:00 2001 From: bogdandina Date: Sat, 25 Oct 2025 10:16:03 +0300 Subject: [PATCH 2/3] feat(62035): fixes --- .github/workflows/ci-cd-java.yml | 15 +++++++-------- .github/workflows/ci-cd-kotlin.yml | 17 ++++++++--------- .github/workflows/ci-cd-typescript.yml | 13 ++++++------- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci-cd-java.yml b/.github/workflows/ci-cd-java.yml index 00ed1c3..b50fb69 100644 --- a/.github/workflows/ci-cd-java.yml +++ b/.github/workflows/ci-cd-java.yml @@ -1,6 +1,11 @@ name: ci-cd-java.yml on: workflow_call: + secrets: + DOCKER_USERNAME: + required: true + DOCKER_PASSWORD: + required: true inputs: uploadJarArtifact: required: false @@ -12,12 +17,6 @@ on: jarArtifactPath: required: false type: string - dockerUser: - required: true - type: string - dockerPassword: - required: true - type: string env: IMAGE_NAME_MIXED_CASE: "${{ github.repository }}" @@ -94,8 +93,8 @@ jobs: if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' uses: docker/login-action@v3 with: - username: ${{ inputs.dockerUser }} - password: ${{ inputs.dockerPassword }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Build & Push Docker image if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' diff --git a/.github/workflows/ci-cd-kotlin.yml b/.github/workflows/ci-cd-kotlin.yml index edd536f..13fd610 100644 --- a/.github/workflows/ci-cd-kotlin.yml +++ b/.github/workflows/ci-cd-kotlin.yml @@ -1,6 +1,11 @@ name: ci-cd-kotlin.yml on: workflow_call: + secrets: + DOCKER_USERNAME: + required: true + DOCKER_PASSWORD: + required: true inputs: uploadJarArtifact: required: false @@ -12,12 +17,6 @@ on: jarArtifactPath: required: false type: string - dockerUser: - required: true - type: string - dockerPassword: - required: true - type: string env: IMAGE_NAME_MIXED_CASE: "${{ github.repository }}" @@ -85,13 +84,13 @@ jobs: labels: | org.opencontainers.image.title=${{ env.IMAGE_NAME }} org.opencontainers.image.vendor=hsldevcom - + - name: Login to Docker Hub if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' uses: docker/login-action@v3 with: - username: ${{ inputs.dockerUser }} - password: ${{ inputs.dockerPassword }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Build & Push Docker image if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' diff --git a/.github/workflows/ci-cd-typescript.yml b/.github/workflows/ci-cd-typescript.yml index 8a5c95b..59172dd 100644 --- a/.github/workflows/ci-cd-typescript.yml +++ b/.github/workflows/ci-cd-typescript.yml @@ -1,13 +1,12 @@ name: ci-cd-typescript.yml on: workflow_call: - inputs: - dockerUser: + secrets: + DOCKER_USERNAME: required: true - type: string - dockerPassword: + DOCKER_PASSWORD: required: true - type: string + inputs: uploadJarArtifact: required: false type: boolean @@ -89,8 +88,8 @@ jobs: if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/')) uses: docker/login-action@v3 with: - username: ${{ inputs.dockerUser }} - password: ${{ inputs.dockerPassword }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/')) From 6a01665f8fddfa5bbaa6fdc24357c9d1a16c2738 Mon Sep 17 00:00:00 2001 From: bogdandina Date: Sat, 25 Oct 2025 21:34:33 +0300 Subject: [PATCH 3/3] feat(62305): fixes for CI/CD TS --- .github/workflows/ci-cd-typescript.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-cd-typescript.yml b/.github/workflows/ci-cd-typescript.yml index 59172dd..7138745 100644 --- a/.github/workflows/ci-cd-typescript.yml +++ b/.github/workflows/ci-cd-typescript.yml @@ -7,17 +7,11 @@ on: DOCKER_PASSWORD: required: true inputs: - uploadJarArtifact: + checkAndTestOutsideDocker: required: false type: boolean default: false - jarArtifactName: - required: false - type: string - jarArtifactPath: - required: false - type: string - checkAndTestOutsideDocker: + codeCoverageEnabled: required: false type: boolean default: false @@ -52,6 +46,18 @@ jobs: if: ${{ inputs.checkAndTestOutsideDocker }} run: npm run check-and-build + - name: Upload coverage reports to Codecov + if: ${{ codeCoverageEnabled }} + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Upload test results to Codecov + if: ${{ codeCoverageEnabled && !cancelled() }} + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + - name: Lowercase Docker Image Name run: | echo "IMAGE_NAME=${IMAGE_NAME_MIXED_CASE,,}" >> "${GITHUB_ENV}"