-
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (111 loc) · 4.05 KB
/
vrt.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: VRT
run-name: Visual Regression Test ${{ (vars.RUNS_ON_SELF_HOSTED == null && '(on GitHub-hosted)') || '(on self-hosted)' }}
on:
pull_request:
paths:
- 'lib/**'
- 'test/**'
- 'android/**'
- 'ios/**'
- 'pubspec.yaml'
- 'pubspec.lock'
- '.github/workflows/vrt.yml' # this file
workflow_dispatch:
permissions:
contents: read
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lookup:
runs-on: ${{ (vars.RUNS_ON_SELF_HOSTED == null && 'ubuntu-latest') || 'self-hosted' }}
timeout-minutes: 30
outputs:
actual-sha: ${{ steps.lookup.outputs.actual-sha }}
actual-cache-hit: ${{ steps.lookup.outputs.actual-cache-hit }}
expected-sha: ${{ steps.lookup.outputs.expected-sha }}
expected-cache-hit: ${{ steps.lookup.outputs.expected-cache-hit }}
steps:
- uses: yorifuji/easy-vrt@main
id: lookup
with:
mode: lookup
expected:
if: ${{ !cancelled() && !failure() && needs.lookup.outputs.expected-cache-hit != 'true' }}
needs: lookup
runs-on: ${{ (vars.RUNS_ON_SELF_HOSTED == null && 'ubuntu-latest') || 'self-hosted' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.lookup.outputs.expected-sha }}
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (vars.FLUTTER_VERSION != null && vars.FLUTTER_VERSION) || '' }}
channel: stable
cache: ${{ (vars.RUNS_ON_SELF_HOSTED == null && true) || false }}
- run: flutter pub get
- name: Run pre-process script
env:
PREPROCESS_SCRIPT_BASE64: ${{ secrets.PREPROCESS_SCRIPT_BASE64 }}
run: |
if [ -n "$PREPROCESS_SCRIPT_BASE64" ]; then
echo $PREPROCESS_SCRIPT_BASE64 | base64 --decode > ${{ runner.temp }}/pre-process.sh && bash ${{ runner.temp }}/pre-process.sh
fi
- name: Create golden images
run: |
flutter test --update-goldens --tags=golden
- uses: yorifuji/easy-vrt@main
with:
mode: expected
expected-dir: test/golden_test/goldens
expected-cache-key: ${{ needs.lookup.outputs.expected-sha }}
actual:
if: ${{ !cancelled() && !failure() && needs.lookup.outputs.actual-cache-hit != 'true' }}
needs: lookup
runs-on: ${{ (vars.RUNS_ON_SELF_HOSTED == null && 'ubuntu-latest') || 'self-hosted' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.lookup.outputs.actual-sha }}
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (vars.FLUTTER_VERSION != null && vars.FLUTTER_VERSION) || '' }}
channel: stable
cache: ${{ (vars.RUNS_ON_SELF_HOSTED == null && true) || false }}
- run: flutter pub get
- name: Run pre-process script
env:
PREPROCESS_SCRIPT_BASE64: ${{ secrets.PREPROCESS_SCRIPT_BASE64 }}
run: |
if [ -n "$PREPROCESS_SCRIPT_BASE64" ]; then
echo $PREPROCESS_SCRIPT_BASE64 | base64 --decode > ${{ runner.temp }}/pre-process.sh && bash ${{ runner.temp }}/pre-process.sh
fi
- name: Create golden images
run: |
flutter test --update-goldens --tags=golden
- uses: yorifuji/easy-vrt@main
with:
mode: actual
actual-dir: test/golden_test/goldens
actual-cache-key: ${{ needs.lookup.outputs.actual-sha }}
compare:
if: ${{ !cancelled() && !failure() }}
needs: [lookup, expected, actual]
runs-on: ubuntu-latest
steps:
- uses: yorifuji/easy-vrt@v1
with:
mode: compare
expected-cache-key: ${{ needs.lookup.outputs.expected-sha }}
actual-cache-key: ${{ needs.lookup.outputs.actual-sha }}
summary-comment: true
review-comment: true
action-timeline:
needs: [lookup, actual, expected, compare]
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
- uses: Kesin11/actions-timeline@v2