1
+ name : " Screenshots Workflow"
2
+
3
+ inputs :
4
+ ANDROID_EMULATOR_API :
5
+ description : ' Emulator API to be used when running tests'
6
+ required : false
7
+ default : 34
8
+ ANDROID_EMULATOR_ARCH :
9
+ description : ' Emulator architecture to be used when running tests'
10
+ required : false
11
+ default : x86_64
12
+
13
+ runs :
14
+ using : " composite"
15
+ steps :
16
+ - name : Setup Java
17
+ uses : actions/setup-java@v3
18
+ with :
19
+ distribution : ' adopt'
20
+ java-version : ' 17'
21
+
22
+ - name : Build APKs
23
+ shell : bash
24
+ run : |
25
+ ./gradlew assembleDebug assembleAndroidTest --stacktrace
26
+
27
+ - name : Enable KVM group perms
28
+ shell : bash
29
+ run : |
30
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
31
+ sudo udevadm control --reload-rules
32
+ sudo udevadm trigger --name-match=kvm
33
+
34
+ - name : Cache AVD
35
+ uses : actions/cache@v4
36
+ id : avd-cache
37
+ with :
38
+ path : |
39
+ ~/.android/avd/*
40
+ ~/.android/adb*
41
+ key : avd-${{ inputs.ANDROID_EMULATOR_API }}-${{ inputs.ANDROID_EMULATOR_ARCH }}
42
+
43
+ - name : Create AVD and Cache Snapshot
44
+ if : steps.avd-cache.outputs.cache-hit != 'true'
45
+ uses :
reactivecircus/[email protected]
46
+ with :
47
+ api-level : ${{ inputs.ANDROID_EMULATOR_API }}
48
+ arch : ${{ inputs.ANDROID_EMULATOR_ARCH }}
49
+ profile : pixel_6
50
+ avd-name : pixel_6
51
+ force-avd-creation : false
52
+ emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
53
+ disable-animations : false
54
+ script : echo "Generated AVD snapshot for caching."
55
+
56
+ - name : Setup Ruby
57
+ uses : ruby/setup-ruby@v1
58
+ with :
59
+ ruby-version : ' 3.3'
60
+ bundler-cache : true
61
+
62
+ - name : Prepare Bundler
63
+ shell : bash
64
+ run : |
65
+ bundle config path vendor/bundle
66
+ bundle install --jobs 4 --retry 3
67
+
68
+ - name : Setup Fastlane
69
+ shell : bash
70
+ run : |
71
+ git clone --branch=fastlane-android --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane
72
+
73
+ - name : Create Android Screenshots
74
+ uses :
reactivecircus/[email protected]
75
+ with :
76
+ api-level : ${{ inputs.ANDROID_EMULATOR_API }}
77
+ arch : ${{ inputs.ANDROID_EMULATOR_ARCH }}
78
+ profile : pixel_6
79
+ avd-name : pixel_6
80
+ force-avd-creation : false
81
+ emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
82
+ disable-animations : true
83
+ script : |
84
+ bundle exec fastlane screengrab || exit 1
85
+
86
+ - name : Upload Screenshots
87
+ uses : actions/upload-artifact@v4
88
+ with :
89
+ name : Android Screenshots
90
+ path : fastlane/metadata/android/en-US/images/phoneScreenshots
0 commit comments