From 04a142d50ca080a9cc41204994e0059da8d5eb89 Mon Sep 17 00:00:00 2001 From: Tim Yao <31641325+tim-yao@users.noreply.github.com> Date: Wed, 20 Mar 2024 10:14:40 +1100 Subject: [PATCH 1/4] API test fix --- .github/workflows/api.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index 354becd4..c02f234f 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -46,7 +46,7 @@ jobs: cd /app if [ -e tests/newman/tide.collection.json ] then - if [[ ${TEST_NEWMAN_DISABLE_CORE} == true ]] + if [[ "${TEST_NEWMAN_DISABLE_CORE}" == "true" ]] then echo "==> Core Tests are disabled by env var TEST_NEWMAN_DISABLE_CORE. Skip the test." else From 00a52692418d33d4f15b12a363716b35f5887df3 Mon Sep 17 00:00:00 2001 From: Tim Yao <31641325+tim-yao@users.noreply.github.com> Date: Wed, 20 Mar 2024 15:51:09 +1100 Subject: [PATCH 2/4] Fix the API report issue --- .github/workflows/notify_slack.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/notify_slack.yml b/.github/workflows/notify_slack.yml index b5b1ec1e..62a0232a 100644 --- a/.github/workflows/notify_slack.yml +++ b/.github/workflows/notify_slack.yml @@ -54,6 +54,11 @@ jobs: with: name: ${{ inputs.artifact_name }} - name: prepare-report + if: ${{ inputs.test_type == ':postman:' }} + run: | + echo "REPORT_TEXT=API test report is stored in the CI job summary artifacts" >> $GITHUB_ENV + - name: prepare-report + if: ${{ inputs.test_type != ':postman:' }} run: | if [[ -z $FE_BASE_URL ]]; then echo TEST_ENVIRONMENTS="*BE URL:* $BE_BASE_URL" >> $GITHUB_ENV @@ -158,4 +163,4 @@ jobs: LINK: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} BRANCH_LINK: ${{ github.event.pull_request && github.head_ref || github.ref_name }} SLACK_BOT_TOKEN: ${{ secrets.TEST_SLACK_BOT_TOKEN }} - ARTIFACTS_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ No newline at end of file + ARTIFACTS_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" From e7b533482fbb063f2fb552aec912b4f7b0ee8341 Mon Sep 17 00:00:00 2001 From: Tim Yao <31641325+tim-yao@users.noreply.github.com> Date: Wed, 20 Mar 2024 15:52:51 +1100 Subject: [PATCH 3/4] Update notify_slack.yml --- .github/workflows/notify_slack.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/notify_slack.yml b/.github/workflows/notify_slack.yml index 62a0232a..a4e6c7e1 100644 --- a/.github/workflows/notify_slack.yml +++ b/.github/workflows/notify_slack.yml @@ -53,11 +53,11 @@ jobs: - uses: actions/download-artifact@v3 with: name: ${{ inputs.artifact_name }} - - name: prepare-report + - name: prepare-report-api if: ${{ inputs.test_type == ':postman:' }} run: | echo "REPORT_TEXT=API test report is stored in the CI job summary artifacts" >> $GITHUB_ENV - - name: prepare-report + - name: prepare-report-e2e if: ${{ inputs.test_type != ':postman:' }} run: | if [[ -z $FE_BASE_URL ]]; then From 20b5c37269abec919239aa256e0306cb7b24c98c Mon Sep 17 00:00:00 2001 From: Tim Yao <31641325+tim-yao@users.noreply.github.com> Date: Wed, 20 Mar 2024 16:03:38 +1100 Subject: [PATCH 4/4] Fix the slack api error --- .github/workflows/notify_slack.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/notify_slack.yml b/.github/workflows/notify_slack.yml index a4e6c7e1..a05bebb5 100644 --- a/.github/workflows/notify_slack.yml +++ b/.github/workflows/notify_slack.yml @@ -53,6 +53,16 @@ jobs: - uses: actions/download-artifact@v3 with: name: ${{ inputs.artifact_name }} + - name: prepare-report + run: | + if [[ -z $FE_BASE_URL ]]; then + echo TEST_ENVIRONMENTS="*BE URL:* $BE_BASE_URL" >> $GITHUB_ENV + else + echo TEST_ENVIRONMENTS="*BE URL:* $BE_BASE_URL \n *FE URL:* $FE_BASE_URL" >> $GITHUB_ENV + fi + env: + BE_BASE_URL: ${{ inputs.be_url }} + FE_BASE_URL: ${{ inputs.fe_url }} - name: prepare-report-api if: ${{ inputs.test_type == ':postman:' }} run: | @@ -60,11 +70,6 @@ jobs: - name: prepare-report-e2e if: ${{ inputs.test_type != ':postman:' }} run: | - if [[ -z $FE_BASE_URL ]]; then - echo TEST_ENVIRONMENTS="*BE URL:* $BE_BASE_URL" >> $GITHUB_ENV - else - echo TEST_ENVIRONMENTS="*BE URL:* $BE_BASE_URL \n *FE URL:* $FE_BASE_URL" >> $GITHUB_ENV - fi if [ -f "report-url.txt" -a -s "report-url.txt" ]; then echo "Workflow status is $WORKFLOW_CONCLUSION" if [ "$WORKFLOW_CONCLUSION" = "success" ]; then @@ -75,9 +80,6 @@ jobs: else echo "REPORT_TEXT=:crying_cat_face: No report found. Testing may have been skipped." >> $GITHUB_ENV fi - env: - BE_BASE_URL: ${{ inputs.be_url }} - FE_BASE_URL: ${{ inputs.fe_url }} - name: sdp-test-report-success uses: slackapi/slack-github-action@v1.24.0 if: env.WORKFLOW_CONCLUSION == 'success'