From bd98f885def6f452fde37a64a422bf382ae5173f Mon Sep 17 00:00:00 2001 From: "Wojtek.Swieton" Date: Tue, 30 Jan 2024 14:39:45 +0100 Subject: [PATCH] ACS-6309 Integration with Report Portal - changes in CI for remote_api_app_context_test_suites --- .github/workflows/ci.yml | 41 +++++++++++++++++++++++++++++++++- scripts/ci/add_step_summary.sh | 17 ++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 scripts/ci/add_step_summary.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0266826379e..2a5ed0289c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,9 @@ env: CI_WORKSPACE: ${{ github.workspace }} TAS_ENVIRONMENT: ./packaging/tests/environment TAS_SCRIPTS: ../alfresco-community-repo/packaging/tests/scripts + # Report Portal settings + RP_LAUNCH_PREFIX: "${{ github.workflow }} - ${{ github.job }}" + RP_PROJECT: alfresco-backend jobs: prepare: @@ -196,8 +199,44 @@ jobs: run: echo "TRANSFORMERS_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-core.version -q -DforceStdout)" >> $GITHUB_ENV - name: "Set up the environment" run: docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.compose-profile }} up -d + - name: "Prepare Report Portal" + uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v5.1.0 + id: rp-prepare + with: + rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.tests.name }} + rp-token: ${{ secrets.REPORT_PORTAL_TOKEN }} + rp-project: ${{ env.RP_PROJECT }} + rp-use-static-launch-name: true + - name: "Add GitHub Step Summary" + env: + RP_ENABLED: ${{ steps.rp-prepare.outputs.enabled }} + RP_KEY: ${{ steps.rp-prepare.outputs.key }} + RP_URL: ${{ steps.rp-prepare.outputs.url }} + run: bash scripts/ci/add_step_summary.sh - name: "Run tests" - run: mvn -B test -pl remote-api -Dtest=${{ matrix.testSuite }} -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + id: run-tests + env: + RP_OPTS: ${{ steps.rp-prepare.outputs.mvn-opts }} + run: | + eval "args=($RP_OPTS)" + mvn -B test -pl remote-api -Dtest=${{ matrix.testSuite }} -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco "${args[@]}" + continue-on-error: true + - name: "Update GitHub Step Summary" + run: | + echo "#### ⏱ After Tests: $(date -u +'%Y-%m-%d %H:%M:%S%:z')" >> $GITHUB_STEP_SUMMARY + - name: "Summarize Report Portal" + uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v5.1.0 + id: rp-summarize + with: + tests-outcome: ${{ steps.run-tests.outcome }} + rp-launch-key: ${{ steps.rp-prepare.outputs.key }} + rp-project: ${{ env.RP_PROJECT }} + rp-token: ${{ secrets.REPORT_PORTAL_TOKEN }} + - name: "Exit on failure" + if: steps.run-tests.outcome != 'success' + run: | + echo "::error title=run-tests::Tests failed: re-throwing on error." + exit 1 - name: "Clean Maven cache" run: bash ./scripts/ci/cleanup_cache.sh diff --git a/scripts/ci/add_step_summary.sh b/scripts/ci/add_step_summary.sh new file mode 100644 index 00000000000..99b2416c55f --- /dev/null +++ b/scripts/ci/add_step_summary.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +echo "=========================== Starting Add Step Summary Script ===========================" +PS4="\[\e[35m\]+ \[\e[m\]" +set -vex + +echo "#### ⏱ Before Tests: $(date -u +'%Y-%m-%d %H:%M:%S%:z')" >> $GITHUB_STEP_SUMMARY +echo "#### ⚙ Configuration" >> $GITHUB_STEP_SUMMARY + +if [[ "$RP_ENABLED" == 'true' ]]; then + echo "- [Report Portal]($RP_URL) configured with key "'`'$RP_KEY'`' >> $GITHUB_STEP_SUMMARY +else + echo "- Report Portal not enabled" >> $GITHUB_STEP_SUMMARY +fi + +set +vex +echo "=========================== Finishing Add Step Summary Script =========================="