Updated strings from Crowdin 2026/09/05 19:15 #1953
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
| # Adapted from https://github.com/takahirom/roborazzi/blob/4be7f304fa23f2f00fad67ab612aec2035ac9db2/.github/workflows/CompareScreenshot.yml | |
| # Modified from the original: adapted to AnkiDroid CI conventions. | |
| # | |
| # Copyright 2023 takahirom | |
| # Copyright 2019 Square, Inc. | |
| # Copyright The Android Open Source Project | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| name: "🛠️ Screenshots: Compare" # do not rename - referenced by screenshot_comment.yml | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| permissions: {} | |
| jobs: | |
| compare-screenshot-test: | |
| name: compare | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| permissions: | |
| contents: read # for clone | |
| actions: write # for upload-artifact | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Configure JDK | |
| uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0 | |
| with: | |
| distribution: "jetbrains" | |
| java-version: "21" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | |
| with: | |
| # Use open source provider: https://github.com/gradle/actions/blob/main/docs/setup-gradle.md#basic-caching | |
| cache-provider: basic | |
| gradle-version: wrapper | |
| - name: Warm Gradle Cache | |
| # This makes sure we fetch gradle network resources with a retry | |
| uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0 | |
| with: | |
| timeout_minutes: 10 | |
| retry_wait_seconds: 60 | |
| max_attempts: 3 | |
| command: ./gradlew robolectricSdkDownload :AnkiDroid:compilePlayDebugUnitTestKotlin -Pscreenshot --daemon | |
| - name: Download base branch screenshots | |
| uses: dawidd6/action-download-artifact@d63b86af1b34672e53c440b1b83979861906bad7 # v24 | |
| continue-on-error: true | |
| with: | |
| name: screenshot | |
| workflow: screenshot_store.yml | |
| branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.repository.default_branch }} | |
| - name: Compare screenshots | |
| id: compare-screenshot-test | |
| run: | | |
| ./gradlew compareRoborazziPlayDebug -Pscreenshot --stacktrace | |
| - name: Stage screenshot diffs | |
| if: ${{ always() }} | |
| env: | |
| # Folder name inside the artifact (e.g. "screenshot-diff-pr-12345" on PRs, "screenshot-diff-main" on push) | |
| SUBDIR: ${{ github.event_name == 'pull_request' && format('screenshot-diff-pr-{0}', github.event.number) || format('screenshot-diff-{0}', github.ref_name) }} | |
| run: | | |
| # Trim 'AnkiDroid/build/outputs/roborazzi' from the artifact | |
| # Only keep diagnostic content for failing cases: each <class>/diffs/ becomes <class>/ | |
| mkdir -p "screenshot-diff/$SUBDIR" | |
| shopt -s nullglob | |
| for diffs_dir in AnkiDroid/build/outputs/roborazzi/*/diffs; do | |
| class_name="$(basename "$(dirname "$diffs_dir")")" | |
| mv "$diffs_dir" "screenshot-diff/$SUBDIR/$class_name" | |
| done | |
| - name: Upload screenshot diffs | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| if: ${{ always() }} | |
| with: | |
| name: screenshot-diff # referenced by screenshot_comment.yml | |
| path: screenshot-diff | |
| retention-days: 30 | |
| - name: Upload screenshot diff reports | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| if: ${{ always() }} | |
| with: | |
| name: screenshot-diff-reports | |
| path: | | |
| **/build/reports | |
| retention-days: 30 | |
| - name: Upload screenshot diff test results | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| if: ${{ always() }} | |
| with: | |
| name: screenshot-diff-test-results | |
| path: | | |
| **/build/test-results | |
| retention-days: 30 | |
| - name: Save PR number | |
| if: ${{ github.event_name == 'pull_request' }} | |
| run: | | |
| mkdir -p ./pr | |
| echo ${{ github.event.number }} > ./pr/NR | |
| - name: Persist PR number | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: pr # downloaded by screenshot_comment.yml | |
| path: pr/ |