m3_lightmeter/.github/workflows/run_golden_tests.yml
Vadim 27d56d1061
ML-166 Golden tests (#167)
* setup golden toolkit

* implemented `GoldenTestApplicationMock`

* added devices with dark theme

* implemented MeteringScreen golden test

* moved platform channel logic to app mock

* implemented SettingsScreen golden test

* gitignore golden tests failures

* Create dart_test.yaml

* adjusted `RulerSlider` ticks height

* set master screenshots

* run golden tests on ci

* fixed `LightSensorService` tests

* removed golden workflow call from PR check

* Update pr_check.yml
2024-04-12 08:07:20 +02:00

62 lines
1.7 KiB
YAML

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Run golden tests
on:
workflow_dispatch:
inputs:
update-goldens:
type: boolean
description: Update goldens
default: false
jobs:
run-golden-tests:
name: Run golden tests
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.13.9"
- name: Prepare app
run: |
flutter --version
flutter pub get
flutter pub run intl_utils:generate
- name: Run tests
env:
UPDATE_GOLDENS: ${{inputs.update-goldens && '--update-goldens' || '' }}ƒ
run: |
goldens=$(find ./test -name "*_golden_test.dart" -print)
for f in $goldens; do
flutter test "$f"\
--dart-define cameraStubImage=assets/camera_stub_image.jpg \
$UPDATE_GOLDENS
done
- name: Commit changes
if: ${{ inputs.update-goldens }}
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add -A
git commit -m "Updated goldens"
- name: Push to main
if: ${{ inputs.update-goldens }}
uses: CasperWA/push-protected@v2
with:
token: ${{ secrets.PUSH_TO_MAIN_TOKEN }}
branch: ${{ github.ref_name }}
unprotect_reviews: true