From 87f1fc7cb1206914aa33921fba65f93c81a33df7 Mon Sep 17 00:00:00 2001 From: DavePearce Date: Sun, 22 Dec 2024 21:34:46 +1300 Subject: [PATCH 1/2] feat: extract counters from JSON report This extracts the various counters from the JSON report and packages them up into the SLACK status report. --- .../workflows/reference-blockchain-tests.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/reference-blockchain-tests.yml b/.github/workflows/reference-blockchain-tests.yml index 10b559598..ec6156209 100644 --- a/.github/workflows/reference-blockchain-tests.yml +++ b/.github/workflows/reference-blockchain-tests.yml @@ -89,6 +89,21 @@ jobs: name: blockchain-refrence-tests-report path: reference-tests/build/reports/tests/**/* + - name: Extract Metrics + if: always() + run: | + # Gather metrics + SUCCESS_COUNTER=$(cat $JSON_REPORT | sed -e "s/.*\"successCounter\":\([0-9]*\).*/\1/") + FAILED_COUNTER=$(cat $JSON_REPORT | sed -e "s/.*\"failedCounter\":\([0-9]*\).*/\1/") + ABORTED_COUNTER=$(cat $JSON_REPORT | sed -e "s/.*\"abortedCounter\":\([0-9]*\).*/\1/") + DISABLED_COUNTER=$(cat $JSON_REPORT | sed -e "s/.*\"disabledCounter\":\([0-9]*\).*/\1/") + # Set environment variables + echo "SUCCESS=$SUCCESS_COUNTER" >> $GITHUB_ENV + echo "FAILED=$FAILED_COUNTER" >> $GITHUB_ENV + echo "ABORTED=$ABORTED_COUNTER" >> $GITHUB_ENV + echo "DISABLED=$DISABLED_COUNTER" >> $GITHUB_ENV + env: + JSON_REPORT: ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTes - name: Failure Notification if: ${{ failure() || cancelled() }} uses: slackapi/slack-github-action@v2.0.0 @@ -97,4 +112,4 @@ jobs: webhook-type: webhook-trigger payload: | name: "Daily Blockchain" - status: "${{ job.status }}" + status: "${{ job.status }}, ${{ env.SUCCESS }} successful, ${{ env.FAILED }} failed, ${{ env.ABORTED }} aborted, ${{ env.DISABLED }} disabled." From 91489b41671e66f931b5cd46330b0bccbd0f148d Mon Sep 17 00:00:00 2001 From: DavePearce Date: Mon, 23 Dec 2024 09:33:56 +1300 Subject: [PATCH 2/2] chore: add test_filter option to workflow This adds a test_filter option to the workflow so that is possible to just rerun a specific test, or set of tests based on a filter. --- .github/workflows/reference-blockchain-tests.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/reference-blockchain-tests.yml b/.github/workflows/reference-blockchain-tests.yml index ec6156209..a6945da87 100644 --- a/.github/workflows/reference-blockchain-tests.yml +++ b/.github/workflows/reference-blockchain-tests.yml @@ -5,6 +5,11 @@ on: - cron: 0 21 * * 1-5 workflow_dispatch: inputs: + test_filter: + description: Filter tests to run (via Gradle) + required: false + type: string + default: "BlockchainReferenceTest_*" failed_module: description: Specific module to filter from failed tests required: false @@ -63,7 +68,7 @@ jobs: run: mv ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTests.json ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTests-input.json - name: Run reference blockchain tests - run: GOMEMLIMIT=32GiB ./gradlew referenceBlockchainTests -x spotlessCheck + run: GOMEMLIMIT=32GiB ./gradlew referenceBlockchainTests -x spotlessCheck --tests "${{ inputs.test_filter }}" timeout-minutes: 360 env: REFERENCE_TESTS_PARALLELISM: 2 @@ -90,7 +95,7 @@ jobs: path: reference-tests/build/reports/tests/**/* - name: Extract Metrics - if: always() + if: ${{ failure() || cancelled() }} run: | # Gather metrics SUCCESS_COUNTER=$(cat $JSON_REPORT | sed -e "s/.*\"successCounter\":\([0-9]*\).*/\1/") @@ -103,7 +108,8 @@ jobs: echo "ABORTED=$ABORTED_COUNTER" >> $GITHUB_ENV echo "DISABLED=$DISABLED_COUNTER" >> $GITHUB_ENV env: - JSON_REPORT: ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTes + JSON_REPORT: ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/BlockchainReferenceTestOutcome.json + - name: Failure Notification if: ${{ failure() || cancelled() }} uses: slackapi/slack-github-action@v2.0.0 @@ -112,4 +118,4 @@ jobs: webhook-type: webhook-trigger payload: | name: "Daily Blockchain" - status: "${{ job.status }}, ${{ env.SUCCESS }} successful, ${{ env.FAILED }} failed, ${{ env.ABORTED }} aborted, ${{ env.DISABLED }} disabled." + status: "${{ env.SUCCESS }} successful, ${{ env.FAILED }} failed, ${{ env.ABORTED }} aborted, ${{ env.DISABLED }} disabled"