This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Implement .engine-release.version files for engine Skia Gold tests
#51739
Merged
auto-submit
merged 7 commits into
flutter:main
from
matanlurey:skia-gold-release-versions
Mar 29, 2024
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bd6c280
Add .engine-release.version support to SkiaGoldClient.
matanlurey 7b04dfd
Update README.
matanlurey 1503613
Format.
matanlurey 5086aad
++
matanlurey 4055841
++
matanlurey 3ceba7f
++
matanlurey 7044102
Merge remote-tracking branch 'upstream/main' into skia-gold-release-v…
matanlurey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,8 @@ | ||
| # Used to branch and track golden-file rendering of release branches. | ||
| # | ||
| # See ./testing/skia_gold_client/README.md#release-testing for more information. | ||
|
|
||
| # On the main branch, this should always read 'none'. | ||
| # On release branches, this should be the release version such as '3.21' | ||
| # (without the quotes). | ||
| none |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,70 +1,111 @@ | ||
| # skia_gold_client | ||
| # Skia Gold Client | ||
|
|
||
| This package allows to create a Skia gold client in the engine repo. | ||
| This package interacts with [Skia Gold][] for uploading and comparing | ||
| screenshots. | ||
|
|
||
| The client uses the `goldctl` tool on LUCI builders to upload screenshots, | ||
| and verify if a new screenshot matches the baseline screenshot. | ||
| [skia gold]: https://skia.org/docs/dev/testing/skiagold/ | ||
|
|
||
| The web UI is available on https://flutter-engine-gold.skia.org/. | ||
| The web UI for the engine is located at <https://flutter-engine-gold.skia.org/>. | ||
|
|
||
| ## Using the client | ||
| ## Usage | ||
|
|
||
| 1. In `.ci.yaml`, ensure that the task has a dependency on `goldctl`: | ||
| In the simplest case, import the package and establish a working directory: | ||
|
|
||
| ```yaml | ||
| dependencies: [{ "dependency": "goldctl" }] | ||
| ``` | ||
| ```dart | ||
| import 'dart:io' as io; | ||
| 2. In the builder `.json` file, ensure the drone has a dependency on `goldctl`: | ||
| import 'package:skia_gold_client/skia_gold_client.dart'; | ||
| ```yaml | ||
| "dependencies": [ | ||
| { | ||
| "dependency": "goldctl", | ||
| "version": "git_revision:<sha>" | ||
| } | ||
| ], | ||
| void main() async { | ||
| // Create a temporary working directory. | ||
| final io.Directory tmpDirectory = io.Directory.systemTemp.createTempSync('skia_gold_wd'); | ||
| try { | ||
| final SkiaGoldClient client = SkiaGoldClient(tmpDirectory); | ||
| await client.auth(); | ||
| // ... | ||
| } finally { | ||
| tmpDirectory.deleteSync(recursive: true); | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| 3. Add dependency in `pubspec.yaml`: | ||
| Once you have an authorized instance, use `addImg` to upload a screenshot: | ||
|
|
||
| ```yaml | ||
| dependencies: | ||
| # needed for skia_gold_client to avoid a cache miss. | ||
| engine_repo_tools: | ||
| path: <relative-path>/tools/pkg/engine_repo_tools | ||
| skia_gold_client: | ||
| path: <relative-path>/testing/skia_gold_client | ||
| ```dart | ||
| await client.addImg( | ||
| 'my-screenshot', | ||
| io.File('path/to/screenshot.png'), | ||
| screenshotSize: 400, // i.e. a 20x20 image | ||
| ); | ||
| ``` | ||
|
|
||
| 4. Use the client: | ||
| ## Configuring CI | ||
|
|
||
| ```dart | ||
| import 'package:skia_gold_client/skia_gold_client.dart'; | ||
| Currently[^1], the client is only available on Flutter Engine's CI platform, and | ||
| will fail to authenticate if run elsewhere. | ||
|
|
||
| Future<void> main() { | ||
| final Directory tmpDirectory = Directory.current.createTempSync('skia_gold_wd'); | ||
| final SkiaGoldClient client = SkiaGoldClient( | ||
| tmpDirectory, | ||
| dimensions: <String, String> {'<attribute-name>': '<attribute-value>'}, | ||
| ); | ||
| try { | ||
| if (SkiaGoldClient.isAvailable()) { | ||
| await client.auth(); | ||
| await client.addImg( | ||
| '<file-name>', | ||
| File('gold-file.png'), | ||
| screenshotSize: 1024, | ||
| ); | ||
| } | ||
| } catch (error) { | ||
| // Failed to authenticate or compare pixels. | ||
| stderr.write(error.toString()); | ||
| rethrow; | ||
| } finally { | ||
| tmpDirectory.deleteSync(recursive: true); | ||
| } | ||
| } | ||
| ``` | ||
| To use the client in CI, you'll need to make two changes: | ||
|
|
||
| [^1]: | ||
| The `flutter/flutter` repository has a workaround which downloads digests | ||
| and does basic local image comparison, but because we have forked the | ||
| client and not kept it up-to-date, we cannot use that workaround. Send | ||
| a PR or file an issue if you'd like to see this fixed! | ||
|
|
||
| 1. **Add a dependency on `goldctl`** | ||
|
|
||
| In your task's configuration in [`.ci.yaml`](../../.ci.yaml) file, add a | ||
| dependency on `goldctl`: | ||
|
|
||
| ```diff | ||
| # This is just an example. | ||
| targets: | ||
| - name: Linux linux_android_emulator_tests | ||
| properties: | ||
| config_name: linux_android_emulator | ||
| + dependencies: >- | ||
| + [ | ||
| + {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} | ||
| + ] | ||
|
||
| ``` | ||
|
|
||
| 2. **Ensure the builder (i.e. `config_name: {name}`) also has a dependency** | ||
|
|
||
| For example, for `linux_android_emulator`, modify | ||
| [`ci/builders/linux_android_emulator.json`](../../ci/builders/linux_android_emulator.json): | ||
|
|
||
| ```json | ||
| "dependencies": [ | ||
| { | ||
| "dependency": "goldctl", | ||
| "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd" | ||
| } | ||
| ] | ||
| ``` | ||
|
|
||
| ## Release Testing | ||
|
|
||
| > [!NOTE] | ||
| > This workflow is a work in progress. Contact @matanlurey for more information. | ||
| When we create a release branch (i.e. for a beta or stable release), all | ||
| golden-file tests will have to be regenerated for the new release. This is | ||
| because it's possible that the rendering of the engine has changed in a way | ||
| that affects the golden files (either due to a bug, or intentionally) as we | ||
| apply cherry-picks and other changes to the release branch. | ||
|
|
||
| Fortunately this process is easy and mostly automated. Here's how it works: | ||
|
|
||
| 1. Create your release branch, e.g. `flutter-3.21-candidate.1`. | ||
| 1. Edit [`.engine-release.verison`](../../.engine-release.version) to the new | ||
| release version (e.g. `3.21`). | ||
| 1. Run all the tests, generating new golden files. | ||
| 1. Bulk triage all of the images as positive using the web UI. | ||
|
|
||
|  | ||
|
|
||
| All of the tests will have a unique `_Release_{major}}_{minor}` suffix, so you | ||
| can easily filter them in the web UI and they can diverge from the `main` branch | ||
| as needed. As cherry-picks are applied to the release branch, the tests should | ||
| continue to pass, and the golden files should either _not_ change, or change in | ||
| a way that is expected (i.e. fixing a bug). | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.