diff --git a/.github/actions/acc_test/action.yaml b/.github/actions/acc_test/action.yaml index 46565e96..30d82776 100644 --- a/.github/actions/acc_test/action.yaml +++ b/.github/actions/acc_test/action.yaml @@ -207,7 +207,7 @@ runs: id: testrun shell: bash run: | - echo "::group::go test file" + echo "::group::go test" set -e set -o pipefail @@ -233,18 +233,19 @@ runs: TF_ACC_KEK_KEY_VERSION=${TF_ACC_KEK_KEY_VERSION} \ TF_ACC_KEK_SERVICE_ACCOUNT=${TF_ACC_KEK_SERVICE_ACCOUNT} \ go test -v ${testfile} -timeout=${{ inputs.test_timeout_string }} | tee -a acc_test_run.log - echo "::endgroup::" set -e - echo "::group::go test result" if [[ $(cat acc_test_run.log | grep "FAIL") ]]; then + echo "::endgroup::" + echo "::group::go test result" echo "Test failed, see acc_test_run.log for details" res=$(cat acc_test_run.log | grep -v "=== RUN" | grep -v "\-\-\- PASS" | grep -v "=== CONT" | grep -v "=== PAUSE") echo "result=FAIL: ${res}" >> "$GITHUB_OUTPUT" + echo "::endgroup::" exit 1 - else - echo "result=no FAIL detected" >> "$GITHUB_OUTPUT" fi + + echo "result=no FAIL detected" >> "$GITHUB_OUTPUT" echo "::endgroup::" env: TF_ACC_PROJECT_ID: ${{ inputs.project_id }} diff --git a/.github/workflows/tf-acc-test.yaml b/.github/workflows/tf-acc-test.yaml index be9c4c58..17ace8ad 100644 --- a/.github/workflows/tf-acc-test.yaml +++ b/.github/workflows/tf-acc-test.yaml @@ -42,8 +42,10 @@ jobs: - name: set start time id: start_time run: | - echo "time=$(date --rfc-3339=ns)" >> ${GITHUB_ENV} - echo "start=$(date +%s%N)" >> ${GITHUB_ENV} + time=$(date --rfc-3339=ns) + echo "start_time=$time" >> ${GITHUB_ENV} + start=$(date +%s%N) + echo "start=$start" >> ${GITHUB_ENV} - name: Notify uses: ./.github/actions/notify @@ -51,7 +53,7 @@ jobs: webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }} title: "[START] Terraform Acceptance Tests" subtitle: "${{ forgejo.event_name }} on branch ${{ forgejo.ref }}" - event_title: "started: ${{ steps.start_time.outputs.time }}" + event_title: "started: ${{ steps.start_time.outputs.start_time }}" event_author: ${{ forgejo.actor }} event_body: ${{ inputs.test_file }} event_number: ${{ forgejo.run_number }} @@ -93,12 +95,14 @@ jobs: - name: set end time id: end_time run: | - echo "time=$(date --rfc-3339=ns)" >> ${GITHUB_ENV} + echo "end_time=$(date --rfc-3339=ns)" >> ${GITHUB_ENV} end=$(date +%s%N) echo "end=${end}" >> ${GITHUB_ENV} start=${{ steps.start_time.outputs.start }} diff=$((end-start)) + echo "diff=${diff}" duration=$(printf "%s.%s" "${diff:0: -9}" "${diff: -9:3}") + echoh "duration=${duration}" echo "duration=${duration}" >> ${GITHUB_ENV} - name: Notify @@ -107,7 +111,7 @@ jobs: webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }} title: "[END] Terraform Acceptance Tests" subtitle: "${{ forgejo.event_name }} on branch ${{ forgejo.ref }} with status: ${{ forgejo.event_name == 'workflow_dispatch' && steps.manual_run.outputs.status || steps.automatic_run.outputs.status }}" - event_title: "run ended: ${{ steps.end_time.outputs.time }}, duration: ${{ steps.end_time.outputs.duration }} seconds" + event_title: "run ended: ${{ steps.end_time.outputs.end_time }}, duration: ${{ steps.end_time.outputs.duration }} seconds" event_author: ${{ forgejo.actor }} event_body: "${{ forgejo.event_name == 'workflow_dispatch' && steps.manual_run.outputs.result || steps.automatic_run.outputs.result }}" event_number: ${{ forgejo.event.id }}