Skip to content

Commit

Permalink
[ci][rendering_test] Always collect debug screenshot to help debugging (
Browse files Browse the repository at this point in the history
  • Loading branch information
littleGnAl authored Apr 11, 2024
1 parent fd15755 commit 02aec26
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,12 @@ jobs:
disk-size: 8192M
script: bash ci/rendering_test_android.sh

- uses: actions/upload-artifact@v3
if: always()
with:
name: android-debug-golden-files
path: test_shard/rendering_test/screenshot/*.debug.png

rendering_test_ios:
name: Run Flutter iOS Rendering Tests
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:skip') }}
Expand Down Expand Up @@ -439,9 +445,9 @@ jobs:
- run: bash ci/rendering_test_ios.sh

- uses: actions/upload-artifact@v3
if: failure()
if: always()
with:
name: debug-golden-files-ios
name: ios-debug-golden-files
path: test_shard/rendering_test/screenshot/*.debug.png

rendering_test_macos:
Expand Down Expand Up @@ -493,6 +499,11 @@ jobs:
run: |
export SAVE_DEBUG_GOLDEN="true"
bash ci/rendering_test_macos.sh
- uses: actions/upload-artifact@v3
if: always()
with:
name: macos-debug-golden-files
path: test_shard/rendering_test/screenshot/*.debug.png

rendering_test_windows:
name: Run Flutter Windows Rendering Tests
Expand Down Expand Up @@ -542,6 +553,11 @@ jobs:
export SAVE_DEBUG_GOLDEN="true"
bash ci/rendering_test_windows.sh
- uses: actions/upload-artifact@v3
if: always()
with:
name: windows-debug-golden-files
path: test_shard/rendering_test/screenshot/*.debug.png

rendering_test_web:
name: Run Flutter Web Rendering Tests
Expand Down Expand Up @@ -570,7 +586,7 @@ jobs:
bash ci/run_rendering_test.sh web
- uses: actions/upload-artifact@v3
if: failure()
if: always()
with:
name: debug-golden-files
name: web-debug-golden-files
path: test_shard/rendering_test/screenshot/*.debug.png
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ Future<void> matchScreenShotDesktop(
if (updateGolden == 'true') {
imageFile.writeAsBytesSync(imageBytes);
} else {
if ((Platform.environment['SAVE_DEBUG_GOLDEN'] ?? 'false') == 'true') {
final File debugGoldenFile =
File('screenshot/$screenshotName.debug.png');
debugGoldenFile.writeAsBytesSync(imageBytes);
}

final expectedImage = decodePng(imageFile.readAsBytesSync());

double tolerance = 0.3;
Expand Down

0 comments on commit 02aec26

Please sign in to comment.