-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 2% tolerance to screenshot testing for subtle differences between Linux and macOS Add a workflow to update the screenshots from GitHub Actions
- Loading branch information
Showing
6 changed files
with
174 additions
and
10 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
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
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,50 @@ | ||
#!/usr/bin/env kotlin | ||
|
||
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.11.0") | ||
|
||
import io.github.typesafegithub.workflows.actions.actions.CheckoutV4 | ||
import io.github.typesafegithub.workflows.actions.actions.SetupJavaV4 | ||
import io.github.typesafegithub.workflows.actions.gradle.GradleBuildActionV3 | ||
import io.github.typesafegithub.workflows.actions.stefanzweifel.GitAutoCommitActionV5 | ||
import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest | ||
import io.github.typesafegithub.workflows.domain.triggers.WorkflowDispatch | ||
import io.github.typesafegithub.workflows.dsl.expressions.expr | ||
import io.github.typesafegithub.workflows.dsl.workflow | ||
import io.github.typesafegithub.workflows.yaml.writeToFile | ||
|
||
workflow( | ||
name = "Fix workflow", | ||
on = listOf( | ||
WorkflowDispatch(), | ||
), | ||
sourceFile = __FILE__.toPath(), | ||
) { | ||
job( | ||
id = "fix-branch", | ||
runsOn = UbuntuLatest, | ||
// Ensure no auto-commits are ever made on the main/default branch. | ||
// This is an extra security measure, especially since we don't control what the | ||
// "stefanzweifel/git-auto-commit-action@v5" GitHub Action could theoretically do. | ||
`if` = expr { github.ref_name + " != " + github.eventWorkflowDispatch.repository.default_branch } | ||
) { | ||
uses(name = "Check out", action = CheckoutV4()) | ||
uses( | ||
name = "Setup Java", | ||
action = SetupJavaV4(distribution = SetupJavaV4.Distribution.Temurin, javaVersion = "17") | ||
) | ||
uses( | ||
name = "Record Screenshots", | ||
action = GradleBuildActionV3( | ||
arguments = "verifyAndRecordRoborazziDebug", | ||
) | ||
) | ||
uses( | ||
name = "Commit Screenshots", | ||
action = GitAutoCommitActionV5( | ||
filePattern = "**/src/test/screenshots/*.png", | ||
disableGlobbing = true, | ||
commitMessage = "🤖 Updates screenshots" | ||
) | ||
) | ||
} | ||
}.writeToFile() |
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,48 @@ | ||
# This file was generated using Kotlin DSL (.github/workflows/fix_workflow.main.kts). | ||
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file. | ||
# Generated with https://github.com/typesafegithub/github-workflows-kt | ||
|
||
name: 'Fix workflow' | ||
on: | ||
workflow_dispatch: {} | ||
jobs: | ||
check_yaml_consistency: | ||
name: 'Check YAML consistency' | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- id: 'step-0' | ||
name: 'Check out' | ||
uses: 'actions/checkout@v4' | ||
- id: 'step-1' | ||
name: 'Execute script' | ||
run: 'rm ''.github/workflows/fix_workflow.yaml'' && ''.github/workflows/fix_workflow.main.kts''' | ||
- id: 'step-2' | ||
name: 'Consistency check' | ||
run: 'git diff --exit-code ''.github/workflows/fix_workflow.yaml''' | ||
fix-branch: | ||
runs-on: 'ubuntu-latest' | ||
needs: | ||
- 'check_yaml_consistency' | ||
if: '${{ github.ref_name != github.event.repository.default_branch }}' | ||
steps: | ||
- id: 'step-0' | ||
name: 'Check out' | ||
uses: 'actions/checkout@v4' | ||
- id: 'step-1' | ||
name: 'Setup Java' | ||
uses: 'actions/setup-java@v4' | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- id: 'step-2' | ||
name: 'Record Screenshots' | ||
uses: 'gradle/gradle-build-action@v3' | ||
with: | ||
arguments: 'verifyAndRecordRoborazziDebug' | ||
- id: 'step-3' | ||
name: 'Commit Screenshots' | ||
uses: 'stefanzweifel/git-auto-commit-action@v5' | ||
with: | ||
commit_message: '🤖 Updates screenshots' | ||
file_pattern: '**/src/test/screenshots/*.png' | ||
disable_globbing: 'true' |
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
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