From e4f9e6d100debe6178877f441b7b3a17f77f00d1 Mon Sep 17 00:00:00 2001 From: mananrangkuti Date: Fri, 28 Jun 2024 11:00:23 +0700 Subject: [PATCH 1/2] ci: handle env variables --- sdet/automation-test/action.yaml | 28 +++++++-------- sdet/tools/env/action.yaml | 60 ++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 sdet/tools/env/action.yaml diff --git a/sdet/automation-test/action.yaml b/sdet/automation-test/action.yaml index f4f03e99..b4716242 100644 --- a/sdet/automation-test/action.yaml +++ b/sdet/automation-test/action.yaml @@ -143,21 +143,21 @@ runs: shell: bash run: ${{ inputs.custom_command_packages }} - - name: setup environment - env: - TEST_TYPE: ${{ inputs.profile }} - BASE_URL_STG: ${{ inputs.base_url_stg }} - QA_SERVICE_URL: ${{ inputs.qa_service_url }} - WONG_SERVICE_URL: ${{ inputs.wong_service_url }} - SLACK_WEBHOOK_URL: ${{ inputs.slack_webhook_url }} - SLACK_WEBHOOK_DEBUG_URL: ${{ inputs.slack_webhook_debug_url }} - TESTRAIL_URL: ${{ inputs.testrail_url }} - TESTRAIL_USERNAME: ${{ inputs.testrail_username }} - TESTRAIL_PASSWORD: ${{ inputs.testrail_password }} + - name: setup environment variables test automation + uses: kitabisa/composite-actions/sdet/tools/env@v2 + with: + profile: ${{ inputs.profile }} + qa_service_url: ${{ inputs.qa_service_url }} + wong_service_url: ${{ inputs.wong_service_url }} + slack_webhook_url: ${{ inputs.slack_webhook_url }} + slack_webhook_debug_url: ${{ inputs.slack_webhook_debug_url }} + testrail_url: ${{ inputs.testrail_url }} + testrail_username: ${{ inputs.testrail_username }} + testrail_password: ${{ inputs.testrail_password }} - name: create test run on testrails shell: bash - if: "${{ inputs.platform = 'api' }}" + if: "${{ inputs.platform == 'api' }}" run: ${{ inputs.custom_command_create_test_run }} - name: run automation test @@ -167,7 +167,7 @@ runs: - name: Install rsync shell: bash - if: "${{ inputs.platform = 'api' }}" + if: "${{ inputs.platform == 'api' }}" run: ${{ inputs.custom_command_setup_rsync }} - name: deploy reports to github pages @@ -181,7 +181,7 @@ runs: - name: insert result to testrails shell: bash - if: "${{ inputs.platform = 'api' }}" + if: "${{ inputs.platform == 'api' }}" run: ${{ inputs.custom_command_insert_testrails }} - name: send report to slack diff --git a/sdet/tools/env/action.yaml b/sdet/tools/env/action.yaml new file mode 100644 index 00000000..5aea02cf --- /dev/null +++ b/sdet/tools/env/action.yaml @@ -0,0 +1,60 @@ +name: "manage env" +description: "manage environment variables for test automation" + +inputs: + profile: + required: true + description: "test profile" + type: string + + qa_service_url: + required: true + description: "qa service url" + type: string + + wong_service_url: + required: true + description: "wong service url" + type: string + + slack_webhook_url: + required: true + description: "slack webhook url" + type: string + + slack_webhook_debug_url: + required: true + description: "slack webhook debug url" + type: string + + testrail_url: + required: true + description: "testrail url" + type: string + + testrail_username: + required: true + description: "testrail username" + type: string + + testrail_password: + required: true + description: "testrail password" + type: string + +runs: + using: "composite" + steps: + - name: setup env variables + shell: bash + run: cp .env.example .env + env: + TEST_TYPE: ${{ inputs.profile }} + QA_SERVICE_URL: ${{ inputs.qa_service_url }} + WONG_SERVICE_URL: ${{ inputs.wong_service_url }} + SLACK_WEBHOOK_URL: ${{ inputs.slack_webhook_url }} + SLACK_WEBHOOK_DEBUG_URL: ${{ inputs.slack_webhook_debug_url }} + TESTRAIL_URL: ${{ inputs.testrail_url }} + TESTRAIL_USERNAME: ${{ inputs.testrail_username }} + TESTRAIL_PASSWORD: ${{ inputs.testrail_password }} + \ No newline at end of file From 6b2fb5aa43759be8cd726cf04120bbaf0b02fe7d Mon Sep 17 00:00:00 2001 From: mananrangkuti Date: Fri, 28 Jun 2024 11:30:45 +0700 Subject: [PATCH 2/2] ci: remove unused params --- sdet/automation-test/action.yaml | 20 -------------------- sdet/tools/env/action.yaml | 12 ------------ 2 files changed, 32 deletions(-) diff --git a/sdet/automation-test/action.yaml b/sdet/automation-test/action.yaml index b4716242..7723761a 100644 --- a/sdet/automation-test/action.yaml +++ b/sdet/automation-test/action.yaml @@ -6,24 +6,6 @@ inputs: required: true description: "gh token" - base_url_stg: - required: false - description: "base url stg" - default: "" - type: string - - qa_service_url: - required: false - description: "qa service url" - default: "" - type: string - - wong_service_url: - required: false - description: "wong service url" - default: "" - type: string - slack_webhook_url: required: false description: "slack webhook url" @@ -147,8 +129,6 @@ runs: uses: kitabisa/composite-actions/sdet/tools/env@v2 with: profile: ${{ inputs.profile }} - qa_service_url: ${{ inputs.qa_service_url }} - wong_service_url: ${{ inputs.wong_service_url }} slack_webhook_url: ${{ inputs.slack_webhook_url }} slack_webhook_debug_url: ${{ inputs.slack_webhook_debug_url }} testrail_url: ${{ inputs.testrail_url }} diff --git a/sdet/tools/env/action.yaml b/sdet/tools/env/action.yaml index 5aea02cf..744b0622 100644 --- a/sdet/tools/env/action.yaml +++ b/sdet/tools/env/action.yaml @@ -7,16 +7,6 @@ inputs: description: "test profile" type: string - qa_service_url: - required: true - description: "qa service url" - type: string - - wong_service_url: - required: true - description: "wong service url" - type: string - slack_webhook_url: required: true description: "slack webhook url" @@ -50,8 +40,6 @@ runs: run: cp .env.example .env env: TEST_TYPE: ${{ inputs.profile }} - QA_SERVICE_URL: ${{ inputs.qa_service_url }} - WONG_SERVICE_URL: ${{ inputs.wong_service_url }} SLACK_WEBHOOK_URL: ${{ inputs.slack_webhook_url }} SLACK_WEBHOOK_DEBUG_URL: ${{ inputs.slack_webhook_debug_url }} TESTRAIL_URL: ${{ inputs.testrail_url }}