From 9eeff55ef07992ce090983cdf5f889f3fb769b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=BChringer?= <51900829+puehringer@users.noreply.github.com> Date: Wed, 19 Jun 2024 09:18:08 +0200 Subject: [PATCH 1/4] Update build-node w/ same inputs as build-node-python --- .github/workflows/build-node.yml | 37 ++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-node.yml b/.github/workflows/build-node.yml index f6c5603c..3dee992e 100644 --- a/.github/workflows/build-node.yml +++ b/.github/workflows/build-node.yml @@ -7,6 +7,20 @@ on: type: string required: false default: ${{ github.ref || github.head_ref }} + chromatic_enable: + description: 'Enable Chromatic Tests' + required: false + type: boolean + default: false + node_run_webpack: + description: "Flag to always run the webpack production build." + type: boolean + required: false + default: false + runs_on: + type: string + required: false + default: "ubuntu-22.04" secrets: DATAVISYN_BOT_REPO_TOKEN: required: false @@ -36,19 +50,28 @@ jobs: contents: write runs-on: ubuntu-22.04 steps: - # checkout specific source repository - - uses: actions/checkout@v3 + - name: Checkout source repository + uses: actions/checkout@v4 with: ref: ${{ inputs.branch }} - token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }} # has to set because otherwise it will not work - # checkout this workflow repository to get actions - - uses: actions/checkout@v3 + token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }} + fetch-depth: ${{ inputs.chromatic_enable && '0' || '1' }} + - name: Checkout github-workflows + uses: actions/checkout@v4 with: repository: datavisyn/github-workflows ref: ${{ env.WORKFLOW_BRANCH }} path: ./tmp/github-workflows - - uses: ./tmp/github-workflows/.github/actions/build-node + - name: Build node + uses: ./tmp/github-workflows/.github/actions/build-node with: node_version: ${{ secrets.NODE_VERSION || env.NODE_VERSION }} npm_registry: ${{ env.NPM_REGISTRY }} - github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }} + github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }} + run_webpack: ${{ inputs.node_run_webpack }} + enable_cache: ${{ inputs.runs_on != 'self-hosted' }} + - name: Run Chromatic + if: ${{ inputs.chromatic_enable }} + uses: chromaui/action@v11.3.0 + with: + projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} From 56d8621a25e8ccb574f195a0e6d9652216e8f3da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=BChringer?= <51900829+puehringer@users.noreply.github.com> Date: Wed, 19 Jun 2024 09:58:29 +0200 Subject: [PATCH 2/4] Move build chromatic to build-node action --- .github/actions/build-node/action.yml | 14 ++++++++++++++ .github/workflows/build-node-python.yml | 15 +++++++++------ .github/workflows/build-node.yml | 11 +++++------ 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.github/actions/build-node/action.yml b/.github/actions/build-node/action.yml index 545b6293..3c54d4a0 100644 --- a/.github/actions/build-node/action.yml +++ b/.github/actions/build-node/action.yml @@ -33,6 +33,14 @@ inputs: run_webpack: default: false required: false + chromatic_enable: + description: 'Enable Chromatic tests' + required: false + type: boolean + default: false + chromatic_project_token: + description: 'Chromatic project token' + required: false runs: using: "composite" @@ -107,3 +115,9 @@ runs: with: name: node-bundle path: ./bundles + - name: Run Chromatic + if: ${{ inputs.chromatic_enable }} + uses: chromaui/action@v11.3.0 + with: + projectToken: ${{ inputs.chromatic_project_token }} + diff --git a/.github/workflows/build-node-python.yml b/.github/workflows/build-node-python.yml index ce1a7c4d..07c65baa 100644 --- a/.github/workflows/build-node-python.yml +++ b/.github/workflows/build-node-python.yml @@ -72,7 +72,7 @@ on: description: Unique id per workflow run. Must be set to unique value if dispatched multiple times for a single workflow. default: "" chromatic_enable: - description: 'Enable Chromatic Tests' + description: 'Enable Chromatic tests' required: false type: boolean default: false @@ -137,11 +137,8 @@ jobs: github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }} run_webpack: ${{ inputs.node_run_webpack }} enable_cache: ${{ inputs.runs_on != 'self-hosted' }} - - name: Run Chromatic - if: ${{ inputs.chromatic_enable }} - uses: chromaui/action@v11.3.0 - with: - projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} + chromatic_enable: ${{ inputs.chromatic_enable }} + chromatic_project_token: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} build-python: name: Python @@ -219,6 +216,7 @@ jobs: with: ref: ${{ inputs.branch }} token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }} + fetch-depth: ${{ inputs.chromatic_enable && '0' || '1' }} - name: Checkout github-workflows uses: actions/checkout@v4 with: @@ -233,6 +231,8 @@ jobs: github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }} run_webpack: false # Disable the build here and call afterwards, as otherwise the yarn run env:decrypt will fail due to a missing yarn install enable_cache: ${{ inputs.cypress_runs_on != 'self-hosted' && inputs.runs_on != 'self-hosted' }} + chromatic_enable: ${{ inputs.chromatic_enable }} + chromatic_project_token: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} - name: Build python uses: ./tmp/github-workflows/.github/actions/build-python with: @@ -338,6 +338,7 @@ jobs: with: ref: ${{ inputs.branch }} token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }} + fetch-depth: ${{ inputs.chromatic_enable && '0' || '1' }} - name: Checkout github-workflows uses: actions/checkout@v4 with: @@ -352,6 +353,8 @@ jobs: github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }} run_webpack: false # Disable the build here and call afterwards, as otherwise the yarn run env:decrypt will fail due to a missing yarn install enable_cache: ${{ inputs.playwright_runs_on != 'self-hosted' && inputs.runs_on != 'self-hosted' }} + chromatic_enable: ${{ inputs.chromatic_enable }} + chromatic_project_token: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} - name: Build python uses: ./tmp/github-workflows/.github/actions/build-python with: diff --git a/.github/workflows/build-node.yml b/.github/workflows/build-node.yml index 3dee992e..9c4dce0c 100644 --- a/.github/workflows/build-node.yml +++ b/.github/workflows/build-node.yml @@ -8,7 +8,7 @@ on: required: false default: ${{ github.ref || github.head_ref }} chromatic_enable: - description: 'Enable Chromatic Tests' + description: 'Enable Chromatic tests' required: false type: boolean default: false @@ -26,6 +26,8 @@ on: required: false NODE_VERSION: required: false + CHROMATIC_PROJECT_TOKEN: + required: false env: NPM_REGISTRY: "https://registry.npmjs.org/" @@ -70,8 +72,5 @@ jobs: github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }} run_webpack: ${{ inputs.node_run_webpack }} enable_cache: ${{ inputs.runs_on != 'self-hosted' }} - - name: Run Chromatic - if: ${{ inputs.chromatic_enable }} - uses: chromaui/action@v11.3.0 - with: - projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} + chromatic_enable: ${{ inputs.chromatic_enable }} + chromatic_project_token: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} From 0eca313620865c76abf89214d216744aeb3517e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=BChringer?= <51900829+puehringer@users.noreply.github.com> Date: Wed, 19 Jun 2024 10:48:35 +0200 Subject: [PATCH 3/4] Fix check of chromatic_enable --- .github/actions/build-node/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-node/action.yml b/.github/actions/build-node/action.yml index 3c54d4a0..49eb9688 100644 --- a/.github/actions/build-node/action.yml +++ b/.github/actions/build-node/action.yml @@ -116,8 +116,8 @@ runs: name: node-bundle path: ./bundles - name: Run Chromatic - if: ${{ inputs.chromatic_enable }} - uses: chromaui/action@v11.3.0 + if: inputs.chromatic_enable == 'true' + uses: chromaui/action@v11.5.4 with: projectToken: ${{ inputs.chromatic_project_token }} From b47f340c3a317d9ba6c40245c5293498e023882e Mon Sep 17 00:00:00 2001 From: Hossam Radwan <153196552+dv-hossam-radwan@users.noreply.github.com> Date: Fri, 21 Jun 2024 08:42:32 +0200 Subject: [PATCH 4/4] Feat: add deployment with argocd (#70) * add deployment with argocd * chore: remove argocd-deployed-apps.json file * direct to main * direct to main --- .github/workflows/build-product.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-product.yml b/.github/workflows/build-product.yml index f24f2a98..8cb4b4e0 100644 --- a/.github/workflows/build-product.yml +++ b/.github/workflows/build-product.yml @@ -169,4 +169,4 @@ jobs: workflow_file_name: "deploy-app.yml" ref: ${{ env.WORKFLOW_BRANCH }} github_user: ${{ secrets.DV_BOT_USER }} - client_payload: '{ "app": "${{ needs.prepare-build.outputs.app }}", "customer": "${{ steps.get-parameters.outputs.customer }}", "stage": "${{ steps.get-parameters.outputs.stage }}", "sub_app": "${{ needs.prepare-build.outputs.sub_app }}", "branch": "${{ needs.prepare-build.outputs.image_tag2 }}" }' + client_payload: '{ "app": "${{ needs.prepare-build.outputs.app }}", "customer": "${{ steps.get-parameters.outputs.customer }}", "stage": "${{ steps.get-parameters.outputs.stage }}", "sub_app": "${{ needs.prepare-build.outputs.sub_app }}", "branch": "${{ needs.prepare-build.outputs.image_tag2 }}", "image_tag": "${{ needs.prepare-build.outputs.image_tag1 }}" }'