Skip to content

Commit cb8f32e

Browse files
author
ramin-deriv
committed
add performance testing workflow
1 parent 715c1d5 commit cb8f32e

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Test Workflow with Flashlight
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "*" # Trigger on commits to any branch involved in a PR
7+
8+
jobs:
9+
test-workflow:
10+
name: Build, Test, and Flashlight for Example App
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
# Step 1: Checkout master branch
15+
- name: Checkout master branch
16+
uses: actions/checkout@v3
17+
with:
18+
ref: master
19+
path: master
20+
21+
# Step 2: Build example app for master branch
22+
- name: Build example app for master branch
23+
working-directory: master/example
24+
run: |
25+
flutter pub get
26+
flutter build apk --target-platform android-arm,android-arm64,android-x64
27+
env:
28+
JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64
29+
30+
# Step 3: Upload master APK
31+
- name: Upload Master APK
32+
uses: actions/upload-artifact@v3
33+
with:
34+
name: master-example-apk
35+
path: master/example/build/app/outputs/flutter-apk/app-release.apk
36+
37+
# Step 4: Checkout PR branch
38+
- name: Checkout PR branch
39+
uses: actions/checkout@v3
40+
with:
41+
ref: ${{ github.head_ref }}
42+
path: pr
43+
44+
# Step 5: Build example app for PR branch
45+
- name: Build example app for PR branch
46+
working-directory: pr/example
47+
run: |
48+
flutter pub get
49+
flutter build apk --target-platform android-arm,android-arm64,android-x64
50+
env:
51+
JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64
52+
53+
# Step 6: Upload PR APK
54+
- name: Upload PR APK
55+
uses: actions/upload-artifact@v3
56+
with:
57+
name: pr-example-apk
58+
path: pr/example/build/app/outputs/flutter-apk/app-release.apk
59+
60+
# Step 7: Set up Android Emulator
61+
- name: Set up Android Emulator
62+
uses: reactivecircus/android-emulator-runner@v2
63+
with:
64+
api-level: 30
65+
target: default
66+
arch: x86_64
67+
profile: Nexus_5X
68+
emulator-options: -no-window
69+
70+
# Step 8: Download APKs
71+
- name: Download Master APK
72+
uses: actions/download-artifact@v3
73+
with:
74+
name: master-example-apk
75+
path: master/
76+
77+
- name: Download PR APK
78+
uses: actions/download-artifact@v3
79+
with:
80+
name: pr-example-apk
81+
path: pr/
82+
83+
# Step 9: Install Flashlight
84+
- name: Install Flashlight
85+
run: |
86+
curl -sSL https://get.flashlight.dev | bash
87+
88+
# Step 10: Install and Test Master APK
89+
- name: Install and Test Master APK
90+
run: |
91+
adb install master/app-release.apk
92+
flashlight test --bundleId com.example.master --testCommand "adb shell monkey -p com.example.master -c android.intent.category.LAUNCHER 1" --duration 10000 --resultsFilePath master_results.json
93+
94+
# Step 11: Install and Test PR APK
95+
- name: Install and Test PR APK
96+
run: |
97+
adb install pr/app-release.apk
98+
flashlight test --bundleId com.example.pr --testCommand "adb shell monkey -p com.example.pr -c android.intent.category.LAUNCHER 1" --duration 10000 --resultsFilePath pr_results.json
99+
100+
# Step 12: Upload Flashlight Results
101+
- name: Upload Flashlight Reports
102+
uses: actions/upload-artifact@v3
103+
with:
104+
name: Flashlight Reports
105+
path: |
106+
master_results.json
107+
pr_results.json

0 commit comments

Comments
 (0)