From c60d1ce11a2277386c123ea1b38a6d7e151b47cf Mon Sep 17 00:00:00 2001 From: divyaac Date: Thu, 1 Feb 2024 08:46:20 -0800 Subject: [PATCH] Applied Ent Changes (#25160) --- .github/workflows/ci.yml | 4 ++-- .github/workflows/test-go.yml | 42 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da62c3d737..7be859298b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -335,7 +335,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "${{ needs.test-go.result != 'failure' && ':white_check_mark:' || ':x:' }} Go tests\n${{ needs.test-go-race.result != 'failure' && ':white_check_mark:' || ':x:' }} Go race tests\n${{ needs.test-go-testonly.result != 'failure' && ':white_check_mark:' || ':x:' }} Go testonly tests\n${{ needs.test-ui.result != 'failure' && ':white_check_mark:' || ':x:' }} UI tests" + "text": "${{ needs.test-go.result != 'failure' && ':white_check_mark:' || ':x:' }} Go tests\n${{ needs.test-go-race.result != 'failure' && ':white_check_mark:' || ':x:' }} Go race tests\n\t\t${{ needs.test-go-race.outputs.data-race-failures != '' && ':x:' || ':white_check_mark:' }} Data race tests\n${{ needs.test-go-testonly.result != 'failure' && ':white_check_mark:' || ':x:' }} Go testonly tests\n${{ needs.test-ui.result != 'failure' && ':white_check_mark:' || ':x:' }} UI tests" }, "accessory": { "type": "button", @@ -409,7 +409,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "${{ needs.test-go.result != 'failure' && ':white_check_mark:' || ':x:' }} Go tests\n${{ needs.test-go-fips.result != 'failure' && ':white_check_mark:' || ':x:' }} Go FIPS tests\n${{ needs.test-go-race.result != 'failure' && ':white_check_mark:' || ':x:' }} Go race tests\n${{ needs.test-go-testonly.result != 'failure' && ':white_check_mark:' || ':x:' }} Go testonly tests\n${{ needs.test-ui.result != 'failure' && ':white_check_mark:' || ':x:' }} UI tests" + "text": "${{ needs.test-go.result != 'failure' && ':white_check_mark:' || ':x:' }} Go tests\n${{ needs.test-go-fips.result != 'failure' && ':white_check_mark:' || ':x:' }} Go FIPS tests\n${{ needs.test-go-race.result != 'failure' && ':white_check_mark:' || ':x:' }} Go race tests\n\t\t${{ needs.test-go-race.outputs.data-race-failures != '' && ':x:' || ':white_check_mark:' }} Data race tests\n${{ needs.test-go-testonly.result != 'failure' && ':white_check_mark:' || ':x:' }} Go testonly tests\n${{ needs.test-ui.result != 'failure' && ':white_check_mark:' || ':x:' }} UI tests" }, "accessory": { "type": "button", diff --git a/.github/workflows/test-go.yml b/.github/workflows/test-go.yml index 962682d634..601cde1e61 100644 --- a/.github/workflows/test-go.yml +++ b/.github/workflows/test-go.yml @@ -72,6 +72,10 @@ on: required: false default: ${{ github.ref }} type: string + outputs: + data-race-failures: + description: A list of failing tests as result of data races + value: ${{ jobs.data-race-failures.outputs.data_race_failures }} env: ${{ fromJSON(inputs.env-vars) }} @@ -496,6 +500,44 @@ jobs: name: failure-summary path: failure-summary-${{ matrix.id }}${{ inputs.name != '' && '-' || '' }}${{inputs.name}}.md + data-race-failures: + if: ${{ ! cancelled() && needs.test-go.result == 'failure' && inputs.name == 'race' }} + needs: test-go + runs-on: ${{ fromJSON(inputs.runs-on) }} + steps: + - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + name: test-results + path: race-results + - name: Check data race failure + id: data-race-failure + run: | + directory=race-results + + # Use a for loop to iterate over files in the directory + data_race_tests=() + for file in "$directory"/*.json; do + # Check if test results contains offending phrase + if grep -q "WARNING: DATA RACE" "$file"; then + test_number="$(grep -oE '[0-9]+' <<< "$file")" + data_race_tests+=("test-go (${test_number})") + + # Print failing matrix tests + echo "=============== test-go (${test_number}) ===========================" + sed -n '/WARNING: DATA RACE/,/==================/p' "$file" | jq -r -j '.Output' + fi + done + + # Set variable + echo -n "data_race_failures=${data_race_tests[*]}" >> "$GITHUB_OUTPUT" + + # Fail the action if there were any failed race tests + if (("${#data_race_tests[@]}" > 0)); then + exit 1 + fi + outputs: + data_race_failures : ${{ steps.data-race-failure.outputs.data_race_failures }} + test-collect-reports: if: ${{ ! cancelled() && needs.test-go.result == 'success' && inputs.test-timing-cache-enabled }} needs: test-go