forked from garris/BackstopJS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
71 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: "Validate Sanity Report" | ||
description: "Diff the sanity-test report with a fixture and validate expected shape." | ||
|
||
inputs: | ||
WORKSPACE_ROOT: | ||
description: "Working Directory" | ||
required: true | ||
RUNNER: | ||
description: "Test Runner" | ||
required: true | ||
FIXTURE: | ||
description: "Test Report Fixture" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: "Validate ${{ inputs.RUNNER }} Report" | ||
id: validate-report | ||
continue-on-error: true | ||
shell: bash | ||
working-directory: ${{ inputs.WORKSPACE_ROOT }} | ||
run: | | ||
set +e | ||
TEST_RESULT=$(diff -c <(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end)' test/__fixtures__/${{ inputs.FIXTURE }}) \ | ||
<(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end)' test/configs/backstop_data/bitmaps_test/**/report.json)) | ||
echo "TEST_RESULT=$TEST_RESULT" >> $GITHUB_ENV | ||
if [[ "$TEST_RESULT" != "" ]]; then | ||
echo "# ❎ ${{ inputs.RUNNER }} Sanity Different" >> $GITHUB_STEP_SUMMARY | ||
echo '```diff' >> $GITHUB_STEP_SUMMARY | ||
echo "${TEST_RESULT}" >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
else | ||
echo "# ✅ ${{ inputs.RUNNER }} Sanity Report Valid" >> $GITHUB_STEP_SUMMARY | ||
fi | ||
- name: "Full Smoke Test Diff" | ||
id: diff | ||
continue-on-error: true | ||
shell: bash | ||
working-directory: ${{ inputs.WORKSPACE_ROOT }} | ||
run: | | ||
set +e | ||
FULL_TEST_DIFF=$(diff <(jq -S '.tests[]' test/__fixtures__/${{ inputs.FIXTURE }}.json) <(jq -S '.tests[]' test/configs/backstop_data/bitmaps_test/**/report.json)) | ||
echo "## Unfiltered Diff" >> $GITHUB_STEP_SUMMARY | ||
echo "<details>" >> $GITHUB_STEP_SUMMARY | ||
echo "<summary>Expand Diff</summary>" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo '```diff' >> $GITHUB_STEP_SUMMARY | ||
echo "${FULL_TEST_DIFF}" >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo "</details>" >> $GITHUB_STEP_SUMMARY | ||
- name: "Report Validation Outcome" | ||
run: | | ||
if [[ "$TEST_RESULT" != "" ]]; then | ||
exit 1 | ||
else | ||
exit 0 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters