forked from fossasia/pslab-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
97 lines (85 loc) · 3.34 KB
/
Copy pathaction.yml
File metadata and controls
97 lines (85 loc) · 3.34 KB
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
name: "Android Screenshots Workflow"
inputs:
ANDROID_EMULATOR_API:
description: 'Emulator API to be used when running tests'
required: false
default: 34
ANDROID_EMULATOR_ARCH:
description: 'Emulator architecture to be used when running tests'
required: false
default: x86_64
runs:
using: "composite"
steps:
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'adopt'
cache: 'gradle'
- name: Enable KVM group perms
shell: bash
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Cache AVD
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ inputs.ANDROID_EMULATOR_API }}-${{ inputs.ANDROID_EMULATOR_ARCH }}
- name: Create AVD and Cache Snapshot
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ inputs.ANDROID_EMULATOR_API }}
arch: ${{ inputs.ANDROID_EMULATOR_ARCH }}
profile: pixel_6
avd-name: pixel_6
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
cache: true
flutter-version-file: .flutter-version
- name: Create Android Screenshots
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ inputs.ANDROID_EMULATOR_API }}
arch: ${{ inputs.ANDROID_EMULATOR_ARCH }}
profile: pixel_6
avd-name: pixel_6
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: |
DEVICE_NAME="Pixel 6" flutter drive --driver=test_integration/test_driver.dart --target=test_integration/screenshots.dart -d emulator
- name: Update Fastlane Metadata
if: ${{ github.event_name == 'push' }}
shell: bash
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
cd ./android
git clone --branch=fastlane-android --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane
cd fastlane
rm -rf metadata/android/en-US/images/phoneScreenshots/*
cp -r ../../screenshots/. metadata/android/en-US/images/phoneScreenshots/
# Force push to fastlane branch
git checkout --orphan temporary
git add --all .
git commit -am "[Auto] Update screenshots ($(date +%Y-%m-%d.%H:%M:%S))"
git branch -D fastlane-android
git branch -m fastlane-android
git push --force origin fastlane-android
- name: Upload Screenshots
uses: actions/upload-artifact@v4
with:
name: Android Screenshots
path: screenshots/*